From: Chad Horohoe Date: Mon, 1 Nov 2010 14:29:17 +0000 (+0000) Subject: Add sanity checkbox for external HTTP requests X-Git-Tag: 1.31.0-rc.0~34155 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=43ed05fbda1c387fd69e88c3193237e6d9bb9181;p=lhc%2Fweb%2Fwiklou.git Add sanity checkbox for external HTTP requests --- diff --git a/includes/installer/Installer.i18n.php b/includes/installer/Installer.i18n.php index ad7708b61e..f496a1059a 100644 --- a/includes/installer/Installer.i18n.php +++ b/includes/installer/Installer.i18n.php @@ -36,6 +36,8 @@ Check your php.ini and make sure session.save_path is set to an app 'config-your-language-help' => 'Select a language to use during the installation process.', 'config-wiki-language' => 'Wiki language:', 'config-wiki-language-help' => 'Select the language that the wiki will predominantly be written in.', + 'config-allow-requests' => 'Allow external requests to MediaWiki.org', + 'config-allow-requests-help' => 'If enabled, allow the installer to check MediaWiki.org to make sure you are installing the latest stable version', 'config-back' => '← Back', 'config-continue' => 'Continue →', 'config-page-language' => 'Language', @@ -77,6 +79,7 @@ You can install MediaWiki.', // FIXME: take span out of message. 'config-env-bad' => 'The environment has been checked. You cannot install MediaWiki.', 'config-env-php' => 'PHP $1 is installed.', + 'config-env-latest-disabled' => 'External HTTP requests disabled, skipping version check', 'config-env-latest-ok' => 'You are installing the latest version of MediaWiki.', 'config-env-latest-new' => "'''Note:''' You are installing a development version of MediaWiki.", 'config-env-latest-can-not-check' => "'''Warning:''' The installer was unable to retrieve information about the latest MediaWiki release from [$1].", diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 266a631525..d8effa633f 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -391,11 +391,14 @@ abstract class Installer { public function envLatestVersion() { global $wgVersion; + if( !$this->getVar( '_ExternalHTTP' ) ) { + $this->showMessage( 'config-env-latest-disabled' ); + return; + } + $repository = wfGetRepository(); $currentVersion = $repository->getLatestCoreVersion(); - $this->setVar( '_ExternalHTTP', true ); - if ( $currentVersion === false ) { # For when the request is successful but there's e.g. some silly man in # the middle firewall blocking us, e.g. one of those annoying airport ones diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index 3f3ac5dbd3..732d08b491 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -197,6 +197,7 @@ class WebInstaller_Language extends WebInstallerPage { if ( isset( $languages[$contLang] ) ) { $this->setVar( 'wgLanguageCode', $contLang ); } + $this->setVar( '_ExternalHTTP', $r->getBool( 'config__ExternalHTTP' ) ); return 'continue'; } } elseif ( $this->parent->showSessionWarning ) { @@ -218,8 +219,10 @@ class WebInstaller_Language extends WebInstallerPage { $this->getLanguageSelector( 'UserLang', 'config-your-language', $userLang ) . $this->parent->getHelpBox( 'config-your-language-help' ) . $this->getLanguageSelector( 'ContLang', 'config-wiki-language', $contLang ) . - $this->parent->getHelpBox( 'config-wiki-language-help' ); - + $this->parent->getHelpBox( 'config-wiki-language-help' ) . + $this->parent->getCheckBox( + array( 'var' => '_ExternalHTTP', 'label' => 'config-allow-requests' ) + ) . $this->parent->getHelpBox( 'config-allow-requests-help' ); $this->addHTML( $s ); $this->endForm();