From 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 12 Aug 2013 09:28:15 +0200 Subject: Update to MediaWiki 1.21.1 --- includes/installer/WebInstallerPage.php | 49 +++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 17 deletions(-) (limited to 'includes/installer/WebInstallerPage.php') diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index a193afb7..78830293 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -36,7 +36,7 @@ abstract class WebInstallerPage { */ public $parent; - public abstract function execute(); + abstract public function execute(); /** * Constructor. @@ -128,7 +128,7 @@ abstract class WebInstallerPage { /** * Get the starting tags of a fieldset. * - * @param $legend String: message name + * @param string $legend message name * * @return string */ @@ -357,7 +357,7 @@ class WebInstaller_ExistingWiki extends WebInstallerPage { /** * Initiate an upgrade of the existing database - * @param $vars array Variables from LocalSettings.php and AdminSettings.php + * @param array $vars Variables from LocalSettings.php and AdminSettings.php * @return Status */ protected function handleExistingUpgrade( $vars ) { @@ -369,7 +369,7 @@ class WebInstaller_ExistingWiki extends WebInstallerPage { // Set the relevant variables from LocalSettings.php $requiredVars = array( 'wgDBtype' ); - $status = $this->importVariables( $requiredVars , $vars ); + $status = $this->importVariables( $requiredVars, $vars ); $installer = $this->parent->getDBInstaller(); $status->merge( $this->importVariables( $installer->getGlobalNames(), $vars ) ); if ( !$status->isOK() ) { @@ -422,6 +422,7 @@ class WebInstaller_Welcome extends WebInstallerPage { } else { $this->parent->showStatusMessage( $status ); } + return ''; } } @@ -459,7 +460,14 @@ class WebInstaller_DBConnect extends WebInstallerPage { $this->addHTML( $this->parent->getInfoBox( wfMessage( 'config-support-info', trim( $dbSupport ) )->text() ) ); - foreach ( $this->parent->getVar( '_CompiledDBs' ) as $type ) { + // It's possible that the library for the default DB type is not compiled in. + // In that case, instead select the first supported DB type in the list. + $compiledDBs = $this->parent->getVar( '_CompiledDBs' ); + if ( !in_array( $defaultType, $compiledDBs ) ) { + $defaultType = $compiledDBs[0]; + } + + foreach ( $compiledDBs as $type ) { $installer = $this->parent->getDBInstaller( $type ); $types .= '
  • ' . @@ -493,6 +501,9 @@ class WebInstaller_DBConnect extends WebInstallerPage { public function submit() { $r = $this->parent->request; $type = $r->getVal( 'DBType' ); + if ( !$type ) { + return Status::newFatal( 'config-invalid-db-type' ); + } $this->setVar( 'wgDBtype', $type ); $installer = $this->parent->getDBInstaller( $type ); if ( !$installer ) { @@ -644,7 +655,7 @@ class WebInstaller_Name extends WebInstallerPage { $this->parent->getTextBox( array( 'var' => 'wgSitename', 'label' => 'config-site-name', - 'help' => $this->parent->getHelpBox( 'config-site-name-help' ) + 'help' => $this->parent->getHelpBox( 'config-site-name-help' ) ) ) . $this->parent->getRadioSet( array( 'var' => '_NamespaceType', @@ -911,6 +922,10 @@ class WebInstaller_Options extends WebInstallerPage { $this->getVar( 'wgDeletedDirectory' ) ) ); + // If we're using the default, let the user set it relative to $wgScriptPath + $curLogo = $this->getVar( 'wgLogo' ); + $logoString = ( $curLogo == "/wiki/skins/common/images/wiki.png" ) ? + '$wgStylePath/common/images/wiki.png' : $curLogo; $uploadwrapperStyle = $this->getVar( 'wgEnableUploads' ) ? '' : 'display: none'; $this->addHTML( @@ -932,6 +947,7 @@ class WebInstaller_Options extends WebInstallerPage { '' . $this->parent->getTextBox( array( 'var' => 'wgLogo', + 'value' => $logoString, 'label' => 'config-logo', 'attribs' => array( 'dir' => 'ltr' ), 'help' => $this->parent->getHelpBox( 'config-logo-help' ) @@ -954,7 +970,7 @@ class WebInstaller_Options extends WebInstallerPage { // We'll hide/show this on demand when the value changes, see config.js. $cacheval = $this->getVar( 'wgMainCacheType' ); - if (!$cacheval) { + if ( !$cacheval ) { // We need to set a default here; but don't hardcode it // or we lose it every time we reload the page for validation // or going back! @@ -1001,7 +1017,7 @@ class WebInstaller_Options extends WebInstallerPage { $styleUrl = $server . dirname( dirname( $this->parent->getUrl() ) ) . '/skins/common/config-cc.css'; $iframeUrl = 'http://creativecommons.org/license/?' . - wfArrayToCGI( array( + wfArrayToCgi( array( 'partner' => 'MediaWiki', 'exit_url' => $exitUrl, 'lang' => $this->getVar( '_UserLang' ), @@ -1024,7 +1040,7 @@ class WebInstaller_Options extends WebInstallerPage { } else { $iframeAttribs['src'] = $this->getCCPartnerUrl(); } - $wrapperStyle = ($this->getVar('_LicenseCode') == 'cc-choose') ? '' : 'display: none'; + $wrapperStyle = ($this->getVar( '_LicenseCode' ) == 'cc-choose') ? '' : 'display: none'; return "
    \n" . @@ -1154,12 +1170,12 @@ class WebInstaller_Install extends WebInstallerPage { return 'continue'; } elseif( $this->parent->request->wasPosted() ) { $this->startForm(); - $this->addHTML("
      "); + $this->addHTML( "
        " ); $results = $this->parent->performInstallation( - array( $this, 'startStage'), + array( $this, 'startStage' ), array( $this, 'endStage' ) ); - $this->addHTML("
      "); + $this->addHTML( "
    " ); // PerformInstallation bails on a fatal, so make sure the last item // completed before giving 'next.' Likewise, only provide back on failure $lastStep = end( $results ); @@ -1175,7 +1191,7 @@ class WebInstaller_Install extends WebInstallerPage { } public function startStage( $step ) { - $this->addHTML( "
  • " . wfMessage( "config-install-$step" )->escaped() . wfMessage( 'ellipsis')->escaped() ); + $this->addHTML( "
  • " . wfMessage( "config-install-$step" )->escaped() . wfMessage( 'ellipsis' )->escaped() ); if ( $step == 'extension-tables' ) { $this->startLiveBox(); } @@ -1258,7 +1274,7 @@ class WebInstaller_Restart extends WebInstallerPage { abstract class WebInstaller_Document extends WebInstallerPage { - protected abstract function getFileName(); + abstract protected function getFileName(); public function execute() { $text = $this->getFileContents(); @@ -1286,8 +1302,8 @@ class WebInstaller_ReleaseNotes extends WebInstaller_Document { protected function getFileName() { global $wgVersion; - if(! preg_match( '/^(\d+)\.(\d+).*/i', $wgVersion, $result ) ) { - throw new MWException('Variable $wgVersion has an invalid value.'); + if( !preg_match( '/^(\d+)\.(\d+).*/i', $wgVersion, $result ) ) { + throw new MWException( 'Variable $wgVersion has an invalid value.' ); } return 'RELEASE-NOTES-' . $result[1] . '.' . $result[2]; @@ -1301,4 +1317,3 @@ class WebInstaller_UpgradeDoc extends WebInstaller_Document { class WebInstaller_Copying extends WebInstaller_Document { protected function getFileName() { return 'COPYING'; } } - -- cgit v1.2.3-54-g00ecf