summaryrefslogtreecommitdiff
path: root/includes/installer/WebInstaller.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/installer/WebInstaller.php')
-rw-r--r--includes/installer/WebInstaller.php89
1 files changed, 67 insertions, 22 deletions
diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php
index b75db74e..40726437 100644
--- a/includes/installer/WebInstaller.php
+++ b/includes/installer/WebInstaller.php
@@ -247,6 +247,10 @@ class WebInstaller extends Installer {
$this->currentPageName = $page->getName();
$this->startPageWrapper( $pageName );
+ if( $page->isSlow() ) {
+ $this->disableTimeLimit();
+ }
+
$result = $page->execute();
$this->endPageWrapper();
@@ -300,6 +304,8 @@ class WebInstaller extends Installer {
/**
* Start the PHP session. This may be called before execute() to start the PHP session.
+ *
+ * @return bool
*/
public function startSession() {
if( wfIniGetBool( 'session.auto_start' ) || session_id() ) {
@@ -325,6 +331,8 @@ class WebInstaller extends Installer {
*
* This is used by mw-config/index.php to prevent multiple installations of MW
* on the same cookie domain from interfering with each other.
+ *
+ * @return string
*/
public function getFingerprint() {
// Get the base URL of the installation
@@ -390,7 +398,7 @@ class WebInstaller extends Installer {
/**
* Get a URL for submission back to the same script.
*
- * @param $query: Array
+ * @param $query array
* @return string
*/
public function getUrl( $query = array() ) {
@@ -412,9 +420,6 @@ class WebInstaller extends Installer {
* @return WebInstallerPage
*/
public function getPageByName( $pageName ) {
- // Totally lame way to force autoload of WebInstallerPage.php
- class_exists( 'WebInstallerPage' );
-
$pageClass = 'WebInstaller_' . $pageName;
return new $pageClass( $this );
@@ -587,6 +592,8 @@ class WebInstaller extends Installer {
* Get HTML for an error box with an icon.
*
* @param $text String: wikitext, get this with wfMsgNoTrans()
+ *
+ * @return string
*/
public function getErrorBox( $text ) {
return $this->getInfoBox( $text, 'critical-32.png', 'config-error-box' );
@@ -596,6 +603,8 @@ class WebInstaller extends Installer {
* Get HTML for a warning box with an icon.
*
* @param $text String: wikitext, get this with wfMsgNoTrans()
+ *
+ * @return string
*/
public function getWarningBox( $text ) {
return $this->getInfoBox( $text, 'warning-32.png', 'config-warning-box' );
@@ -607,29 +616,21 @@ class WebInstaller extends Installer {
* @param $text String: wikitext, get this with wfMsgNoTrans()
* @param $icon String: icon name, file in skins/common/images
* @param $class String: additional class name to add to the wrapper div
+ *
+ * @return string
*/
- public function getInfoBox( $text, $icon = 'info-32.png', $class = false ) {
- $s =
- "<div class=\"config-info $class\">\n" .
- "<div class=\"config-info-left\">\n" .
- Html::element( 'img',
- array(
- 'src' => '../skins/common/images/' . $icon,
- 'alt' => wfMsg( 'config-information' ),
- )
- ) . "\n" .
- "</div>\n" .
- "<div class=\"config-info-right\">\n" .
- $this->parse( $text, true ) . "\n" .
- "</div>\n" .
- "<div style=\"clear: left;\"></div>\n" .
- "</div>\n";
- return $s;
+ public function getInfoBox( $text, $icon = false, $class = false ) {
+ $text = $this->parse( $text, true );
+ $icon = ( $icon == false ) ? '../skins/common/images/info-32.png' : '../skins/common/images/'.$icon;
+ $alt = wfMsg( 'config-information' );
+ return Html::infoBox( $text, $icon, $alt, $class, false );
}
/**
* Get small text indented help for a preceding form field.
* Parameters like wfMsg().
+ *
+ * @return string
*/
public function getHelpBox( $msg /*, ... */ ) {
$args = func_get_args();
@@ -685,6 +686,8 @@ class WebInstaller extends Installer {
/**
* Label a control by wrapping a config-input div around it and putting a
* label before it.
+ *
+ * @return string
*/
public function label( $msg, $forId, $contents, $helpData = "" ) {
if ( strval( $msg ) == '' ) {
@@ -724,6 +727,8 @@ class WebInstaller extends Installer {
* controlName: The name for the input element (optional)
* value: The current value of the variable (optional)
* help: The html for the help text (optional)
+ *
+ * @return string
*/
public function getTextBox( $params ) {
if ( !isset( $params['controlName'] ) ) {
@@ -769,6 +774,8 @@ class WebInstaller extends Installer {
* controlName: The name for the input element (optional)
* value: The current value of the variable (optional)
* help: The html for the help text (optional)
+ *
+ * @return string
*/
public function getTextArea( $params ) {
if ( !isset( $params['controlName'] ) ) {
@@ -816,6 +823,8 @@ class WebInstaller extends Installer {
* controlName: The name for the input element (optional)
* value: The current value of the variable (optional)
* help: The html for the help text (optional)
+ *
+ * @return string
*/
public function getPasswordBox( $params ) {
if ( !isset( $params['value'] ) ) {
@@ -843,6 +852,8 @@ class WebInstaller extends Installer {
* controlName: The name for the input element (optional)
* value: The current value of the variable (optional)
* help: The html for the help text (optional)
+ *
+ * @return string
*/
public function getCheckBox( $params ) {
if ( !isset( $params['controlName'] ) ) {
@@ -896,6 +907,8 @@ class WebInstaller extends Installer {
* controlName: The name for the input element (optional)
* value: The current value of the variable (optional)
* help: The html for the help text (optional)
+ *
+ * @return string
*/
public function getRadioSet( $params ) {
if ( !isset( $params['controlName'] ) ) {
@@ -948,6 +961,8 @@ class WebInstaller extends Installer {
/**
* Output an error or warning box using a Status object.
+ *
+ * @param $status Status
*/
public function showStatusBox( $status ) {
if( !$status->isGood() ) {
@@ -970,6 +985,8 @@ class WebInstaller extends Installer {
*
* @param $varNames Array
* @param $prefix String: the prefix added to variables to obtain form names
+ *
+ * @return array
*/
public function setVarsFromRequest( $varNames, $prefix = 'config_' ) {
$newValues = array();
@@ -995,6 +1012,8 @@ class WebInstaller extends Installer {
/**
* Helper for Installer::docLink()
+ *
+ * @return string
*/
protected function getDocUrl( $page ) {
$url = "{$_SERVER['PHP_SELF']}?page=" . urlencode( $page );
@@ -1008,6 +1027,8 @@ class WebInstaller extends Installer {
/**
* Extension tag hook for a documentation link.
+ *
+ * @return string
*/
public function docLink( $linkText, $attribs, $parser ) {
$url = $this->getDocUrl( $attribs['href'] );
@@ -1015,9 +1036,10 @@ class WebInstaller extends Installer {
htmlspecialchars( $linkText ) .
'</a>';
}
-
+
/**
* Helper for "Download LocalSettings" link on WebInstall_Complete
+ *
* @return String Html for download link
*/
public function downloadLinkHook( $text, $attribs, $parser ) {
@@ -1031,4 +1053,27 @@ class WebInstaller extends Installer {
$img . ' ' . wfMsgHtml( 'config-download-localsettings' ) );
return Html::rawElement( 'div', array( 'class' => 'config-download-link' ), $anchor );
}
+
+ public function envCheckPath( ) {
+ // PHP_SELF isn't available sometimes, such as when PHP is CGI but
+ // cgi.fix_pathinfo is disabled. In that case, fall back to SCRIPT_NAME
+ // to get the path to the current script... hopefully it's reliable. SIGH
+ $path = false;
+ if ( !empty( $_SERVER['PHP_SELF'] ) ) {
+ $path = $_SERVER['PHP_SELF'];
+ } elseif ( !empty( $_SERVER['SCRIPT_NAME'] ) ) {
+ $path = $_SERVER['SCRIPT_NAME'];
+ }
+ if ($path !== false) {
+ $uri = preg_replace( '{^(.*)/(mw-)?config.*$}', '$1', $path );
+ $this->setVar( 'wgScriptPath', $uri );
+ } else {
+ $this->showError( 'config-no-uri' );
+ return false;
+ }
+
+
+ return parent::envCheckPath();
+ }
+
}