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.php208
1 files changed, 118 insertions, 90 deletions
diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php
index 35d649b2..95765259 100644
--- a/includes/installer/WebInstaller.php
+++ b/includes/installer/WebInstaller.php
@@ -154,9 +154,9 @@ class WebInstaller extends Installer {
$this->exportVars();
$this->setupLanguage();
- if( ( $this->getVar( '_InstallDone' ) || $this->getVar( '_UpgradeDone' ) )
- && $this->request->getVal( 'localsettings' ) )
- {
+ if ( ( $this->getVar( '_InstallDone' ) || $this->getVar( '_UpgradeDone' ) )
+ && $this->request->getVal( 'localsettings' )
+ ) {
$this->request->response()->header( 'Content-type: application/x-httpd-php' );
$this->request->response()->header(
'Content-Disposition: attachment; filename="LocalSettings.php"'
@@ -164,18 +164,20 @@ class WebInstaller extends Installer {
$ls = InstallerOverrides::getLocalSettingsGenerator( $this );
$rightsProfile = $this->rightsProfiles[$this->getVar( '_RightsProfile' )];
- foreach( $rightsProfile as $group => $rightsArr ) {
+ foreach ( $rightsProfile as $group => $rightsArr ) {
$ls->setGroupRights( $group, $rightsArr );
}
echo $ls->getText();
+
return $this->session;
}
$cssDir = $this->request->getVal( 'css' );
- if( $cssDir ) {
+ if ( $cssDir ) {
$cssDir = ( $cssDir == 'rtl' ? 'rtl' : 'ltr' );
$this->request->response()->header( 'Content-type: text/css' );
echo $this->output->getCSS( $cssDir );
+
return $this->session;
}
@@ -199,6 +201,7 @@ class WebInstaller extends Installer {
$this->output->useShortHeader();
$this->output->allowFrames();
$page->submitCC();
+
return $this->finish();
}
@@ -207,6 +210,7 @@ class WebInstaller extends Installer {
$this->output->useShortHeader();
$this->output->allowFrames();
$this->output->addHTML( $page->getCCDoneBox() );
+
return $this->finish();
}
@@ -250,12 +254,13 @@ class WebInstaller extends Installer {
do {
$nextPageId--;
$nextPage = $this->pageSequence[$nextPageId];
- } while( isset( $this->skippedPages[$nextPage] ) );
+ } while ( isset( $this->skippedPages[$nextPage] ) );
} else {
$nextPage = $this->pageSequence[$lowestUnhappy];
}
$this->output->redirect( $this->getUrl( array( 'page' => $nextPage ) ) );
+
return $this->finish();
}
@@ -263,7 +268,7 @@ class WebInstaller extends Installer {
$this->currentPageName = $page->getName();
$this->startPageWrapper( $pageName );
- if( $page->isSlow() ) {
+ if ( $page->isSlow() ) {
$this->disableTimeLimit();
}
@@ -324,7 +329,7 @@ class WebInstaller extends Installer {
* @return bool
*/
public function startSession() {
- if( wfIniGetBool( 'session.auto_start' ) || session_id() ) {
+ if ( wfIniGetBool( 'session.auto_start' ) || session_id() ) {
// Done already
return true;
}
@@ -336,6 +341,7 @@ class WebInstaller extends Installer {
if ( $this->phpErrors ) {
$this->showError( 'config-session-error', $this->phpErrors[0] );
+
return false;
}
@@ -353,7 +359,7 @@ class WebInstaller extends Installer {
public function getFingerprint() {
// Get the base URL of the installation
$url = $this->request->getFullRequestURL();
- if ( preg_match( '!^(.*\?)!', $url, $m) ) {
+ if ( preg_match( '!^(.*\?)!', $url, $m ) ) {
// Trim query string
$url = $m[1];
}
@@ -362,6 +368,7 @@ class WebInstaller extends Installer {
// the /mw-config/index.php. Kinda scary though?
$url = $m[1];
}
+
return md5( serialize( array(
'local path' => dirname( __DIR__ ),
'url' => $url,
@@ -516,7 +523,7 @@ class WebInstaller extends Installer {
/**
* Called by execute() before page output starts, to show a page list.
*
- * @param $currentPageName String
+ * @param $currentPageName string
*/
private function startPageWrapper( $currentPageName ) {
$s = "<div class=\"config-page-wrapper\">\n";
@@ -539,7 +546,14 @@ class WebInstaller extends Installer {
$s .= "</ul><br/><ul>\n";
$s .= $this->getPageListItem( 'Restart', true, $currentPageName );
- $s .= "</ul></div>\n"; // end list pane
+ // End list pane
+ $s .= "</ul></div>\n";
+
+ // Messages:
+ // config-page-language, config-page-welcome, config-page-dbconnect, config-page-upgrade,
+ // config-page-dbsettings, config-page-name, config-page-options, config-page-install,
+ // config-page-complete, config-page-restart, config-page-readme, config-page-releasenotes,
+ // config-page-copying, config-page-upgradedoc, config-page-existingwiki
$s .= Html::element( 'h2', array(),
wfMessage( 'config-page-' . strtolower( $currentPageName ) )->text() );
@@ -549,14 +563,20 @@ class WebInstaller extends Installer {
/**
* Get a list item for the page list.
*
- * @param $pageName String
- * @param $enabled Boolean
- * @param $currentPageName String
+ * @param $pageName string
+ * @param $enabled boolean
+ * @param $currentPageName string
*
* @return string
*/
private function getPageListItem( $pageName, $enabled, $currentPageName ) {
$s = "<li class=\"config-page-list-item\">";
+
+ // Messages:
+ // config-page-language, config-page-welcome, config-page-dbconnect, config-page-upgrade,
+ // config-page-dbsettings, config-page-name, config-page-options, config-page-install,
+ // config-page-complete, config-page-restart, config-page-readme, config-page-releasenotes,
+ // config-page-copying, config-page-upgradedoc, config-page-existingwiki
$name = wfMessage( 'config-page-' . strtolower( $pageName ) )->text();
if ( $enabled ) {
@@ -601,9 +621,9 @@ class WebInstaller extends Installer {
*/
private function endPageWrapper() {
$this->output->addHTMLNoFlush(
- "<div class=\"visualClear\"></div>\n" .
- "</div>\n" .
- "<div class=\"visualClear\"></div>\n" .
+ "<div class=\"visualClear\"></div>\n" .
+ "</div>\n" .
+ "<div class=\"visualClear\"></div>\n" .
"</div>" );
}
@@ -640,8 +660,11 @@ class WebInstaller extends Installer {
*/
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;
+ $icon = ( $icon == false ) ?
+ '../skins/common/images/info-32.png' :
+ '../skins/common/images/' . $icon;
$alt = wfMessage( 'config-information' )->text();
+
return Html::infoBox( $text, $icon, $alt, $class, false );
}
@@ -686,7 +709,7 @@ class WebInstaller extends Installer {
$args = func_get_args();
array_shift( $args );
$html = '<div class="config-message">' .
- $this->parse( wfMessage( $msg, $args )->useDatabase( false )->plain() ) .
+ $this->parse( wfMessage( $msg, $args )->useDatabase( false )->plain() ) .
"</div>\n";
$this->output->addHTML( $html );
}
@@ -724,16 +747,16 @@ class WebInstaller extends Installer {
$attributes['for'] = $forId;
}
- return
- "<div class=\"config-block\">\n" .
+ return "<div class=\"config-block\">\n" .
" <div class=\"config-block-label\">\n" .
Xml::tags( 'label',
$attributes,
- $labelText ) . "\n" .
- $helpData .
+ $labelText
+ ) . "\n" .
+ $helpData .
" </div>\n" .
" <div class=\"config-block-elements\">\n" .
- $contents .
+ $contents .
" </div>\n" .
"</div>\n";
}
@@ -743,12 +766,12 @@ class WebInstaller extends Installer {
*
* @param $params Array
* Parameters are:
- * var: The variable to be configured (required)
- * label: The message name for the label (required)
- * attribs: Additional attributes for the input element (optional)
+ * var: The variable to be configured (required)
+ * label: The message name for the label (required)
+ * attribs: Additional attributes for the input element (optional)
* controlName: The name for the input element (optional)
- * value: The current value of the variable (optional)
- * help: The html for the help text (optional)
+ * value: The current value of the variable (optional)
+ * help: The html for the help text (optional)
*
* @return string
*/
@@ -767,22 +790,22 @@ class WebInstaller extends Installer {
if ( !isset( $params['help'] ) ) {
$params['help'] = "";
}
- return
- $this->label(
- $params['label'],
+
+ return $this->label(
+ $params['label'],
+ $params['controlName'],
+ Xml::input(
$params['controlName'],
- Xml::input(
- $params['controlName'],
- 30, // intended to be overridden by CSS
- $params['value'],
- $params['attribs'] + array(
- 'id' => $params['controlName'],
- 'class' => 'config-input-text',
- 'tabindex' => $this->nextTabIndex()
- )
- ),
- $params['help']
- );
+ 30, // intended to be overridden by CSS
+ $params['value'],
+ $params['attribs'] + array(
+ 'id' => $params['controlName'],
+ 'class' => 'config-input-text',
+ 'tabindex' => $this->nextTabIndex()
+ )
+ ),
+ $params['help']
+ );
}
/**
@@ -790,12 +813,12 @@ class WebInstaller extends Installer {
*
* @param $params Array
* Parameters are:
- * var: The variable to be configured (required)
- * label: The message name for the label (required)
- * attribs: Additional attributes for the input element (optional)
+ * var: The variable to be configured (required)
+ * label: The message name for the label (required)
+ * attribs: Additional attributes for the input element (optional)
* controlName: The name for the input element (optional)
- * value: The current value of the variable (optional)
- * help: The html for the help text (optional)
+ * value: The current value of the variable (optional)
+ * help: The html for the help text (optional)
*
* @return string
*/
@@ -814,23 +837,23 @@ class WebInstaller extends Installer {
if ( !isset( $params['help'] ) ) {
$params['help'] = "";
}
- return
- $this->label(
- $params['label'],
+
+ return $this->label(
+ $params['label'],
+ $params['controlName'],
+ Xml::textarea(
$params['controlName'],
- Xml::textarea(
- $params['controlName'],
- $params['value'],
- 30,
- 5,
- $params['attribs'] + array(
- 'id' => $params['controlName'],
- 'class' => 'config-input-text',
- 'tabindex' => $this->nextTabIndex()
- )
- ),
- $params['help']
- );
+ $params['value'],
+ 30,
+ 5,
+ $params['attribs'] + array(
+ 'id' => $params['controlName'],
+ 'class' => 'config-input-text',
+ 'tabindex' => $this->nextTabIndex()
+ )
+ ),
+ $params['help']
+ );
}
/**
@@ -839,12 +862,12 @@ class WebInstaller extends Installer {
* Implements password hiding
* @param $params Array
* Parameters are:
- * var: The variable to be configured (required)
- * label: The message name for the label (required)
- * attribs: Additional attributes for the input element (optional)
+ * var: The variable to be configured (required)
+ * label: The message name for the label (required)
+ * attribs: Additional attributes for the input element (optional)
* controlName: The name for the input element (optional)
- * value: The current value of the variable (optional)
- * help: The html for the help text (optional)
+ * value: The current value of the variable (optional)
+ * help: The html for the help text (optional)
*
* @return string
*/
@@ -868,12 +891,12 @@ class WebInstaller extends Installer {
*
* @param $params Array
* Parameters are:
- * var: The variable to be configured (required)
- * label: The message name for the label (required)
- * attribs: Additional attributes for the input element (optional)
+ * var: The variable to be configured (required)
+ * label: The message name for the label (required)
+ * attribs: Additional attributes for the input element (optional)
* controlName: The name for the input element (optional)
- * value: The current value of the variable (optional)
- * help: The html for the help text (optional)
+ * value: The current value of the variable (optional)
+ * help: The html for the help text (optional)
*
* @return string
*/
@@ -892,14 +915,15 @@ class WebInstaller extends Installer {
if ( !isset( $params['help'] ) ) {
$params['help'] = "";
}
- if( isset( $params['rawtext'] ) ) {
+ if ( isset( $params['rawtext'] ) ) {
$labelText = $params['rawtext'];
- } else {
+ } else if ( isset( $params['label'] ) ) {
$labelText = $this->parse( wfMessage( $params['label'] )->text() );
+ } else {
+ $labelText = "";
}
- return
- "<div class=\"config-input-check\">\n" .
+ return "<div class=\"config-input-check\">\n" .
$params['help'] .
"<label>\n" .
Xml::check(
@@ -920,15 +944,15 @@ class WebInstaller extends Installer {
*
* @param $params Array
* Parameters are:
- * var: The variable to be configured (required)
- * label: The message name for the label (required)
+ * var: The variable to be configured (required)
+ * label: The message name for the label (required)
* itemLabelPrefix: The message name prefix for the item labels (required)
- * values: List of allowed values (required)
- * itemAttribs Array of attribute arrays, outer key is the value name (optional)
- * commonAttribs Attribute array applied to all items
- * controlName: The name for the input element (optional)
- * value: The current value of the variable (optional)
- * help: The html for the help text (optional)
+ * values: List of allowed values (required)
+ * itemAttribs: Array of attribute arrays, outer key is the value name (optional)
+ * commonAttribs: Attribute array applied to all items
+ * 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
*/
@@ -987,10 +1011,10 @@ class WebInstaller extends Installer {
* @param $status Status
*/
public function showStatusBox( $status ) {
- if( !$status->isGood() ) {
+ if ( !$status->isGood() ) {
$text = $status->getWikiText();
- if( $status->isOk() ) {
+ if ( $status->isOk() ) {
$box = $this->getWarningBox( $text );
} else {
$box = $this->getErrorBox( $text );
@@ -1058,6 +1082,7 @@ class WebInstaller extends Installer {
*/
public function docLink( $linkText, $attribs, $parser ) {
$url = $this->getDocUrl( $attribs['href'] );
+
return '<a href="' . htmlspecialchars( $url ) . '">' .
htmlspecialchars( $linkText ) .
'</a>';
@@ -1071,7 +1096,7 @@ class WebInstaller extends Installer {
* @param $parser
* @return String Html for download link
*/
- public function downloadLinkHook( $text, $attribs, $parser ) {
+ public function downloadLinkHook( $text, $attribs, $parser ) {
$img = Html::element( 'img', array(
'src' => '../skins/common/images/download-32.png',
'width' => '32',
@@ -1080,6 +1105,7 @@ class WebInstaller extends Installer {
$anchor = Html::rawElement( 'a',
array( 'href' => $this->getURL( array( 'localsettings' => 1 ) ) ),
$img . ' ' . wfMessage( 'config-download-localsettings' )->parse() );
+
return Html::rawElement( 'div', array( 'class' => 'config-download-link' ), $anchor );
}
@@ -1101,8 +1127,10 @@ class WebInstaller extends Installer {
$this->setVar( 'wgScriptPath', $uri );
} else {
$this->showError( 'config-no-uri' );
+
return false;
}
+
return parent::envCheckPath();
}