From 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 8 Dec 2013 09:55:49 +0100 Subject: Update to MediaWiki 1.22.0 --- includes/installer/WebInstaller.php | 208 ++++++++++++++++++++---------------- 1 file changed, 118 insertions(+), 90 deletions(-) (limited to 'includes/installer/WebInstaller.php') 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 = "
\n"; @@ -539,7 +546,14 @@ class WebInstaller extends Installer { $s .= "
\n"; // end list pane + // End list pane + $s .= "\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 = "
  • "; + + // 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( - "
    \n" . - "\n" . - "
    \n" . + "
    \n" . + "\n" . + "
    \n" . "" ); } @@ -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 = '
    ' . - $this->parse( wfMessage( $msg, $args )->useDatabase( false )->plain() ) . + $this->parse( wfMessage( $msg, $args )->useDatabase( false )->plain() ) . "
    \n"; $this->output->addHTML( $html ); } @@ -724,16 +747,16 @@ class WebInstaller extends Installer { $attributes['for'] = $forId; } - return - "
    \n" . + return "
    \n" . "
    \n" . Xml::tags( 'label', $attributes, - $labelText ) . "\n" . - $helpData . + $labelText + ) . "\n" . + $helpData . "
    \n" . "
    \n" . - $contents . + $contents . "
    \n" . "
    \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 - "
    \n" . + return "
    \n" . $params['help'] . "