Add sanity checkbox for external HTTP requests
authorChad Horohoe <demon@users.mediawiki.org>
Mon, 1 Nov 2010 14:29:17 +0000 (14:29 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Mon, 1 Nov 2010 14:29:17 +0000 (14:29 +0000)
includes/installer/Installer.i18n.php
includes/installer/Installer.php
includes/installer/WebInstallerPage.php

index ad7708b..f496a10 100644 (file)
@@ -36,6 +36,8 @@ Check your php.ini and make sure <code>session.save_path</code> 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.</span>', // 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].",
index 266a631..d8effa6 100644 (file)
@@ -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
index 3f3ac5d..732d08b 100644 (file)
@@ -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();