Merge "No longer support installs where register_globals is enabled"
[lhc/web/wiklou.git] / includes / installer / Installer.php
index 17c5ab2..f014032 100644 (file)
@@ -351,10 +351,23 @@ abstract class Installer {
        public function __construct() {
                global $wgMessagesDirs, $wgUser;
 
-               // Disable the i18n cache and LoadBalancer
+               // Disable the i18n cache
                Language::getLocalisationCache()->disableBackend();
+               // Disable LoadBalancer and wfGetDB etc.
                LBFactory::disableBackend();
 
+               // Disable object cache (otherwise CACHE_ANYTHING will try CACHE_DB and
+               // SqlBagOStuff will then throw since we just disabled wfGetDB)
+               $GLOBALS['wgMemc'] = new EmptyBagOStuff;
+               ObjectCache::clear();
+               $emptyCache = array( 'class' => 'EmptyBagOStuff' );
+               $GLOBALS['wgObjectCaches'] = array(
+                       CACHE_NONE => $emptyCache,
+                       CACHE_DB => $emptyCache,
+                       CACHE_ANYTHING => $emptyCache,
+                       CACHE_MEMCACHED => $emptyCache,
+               );
+
                // Load the installer's i18n.
                $wgMessagesDirs['MediawikiInstaller'] = __DIR__ . '/i18n';
 
@@ -367,29 +380,18 @@ abstract class Installer {
                        $this->settings[$var] = $GLOBALS[$var];
                }
 
-               $compiledDBs = array();
+               $this->compiledDBs = array();
                foreach ( self::getDBTypes() as $type ) {
                        $installer = $this->getDBInstaller( $type );
 
                        if ( !$installer->isCompiled() ) {
                                continue;
                        }
-                       $compiledDBs[] = $type;
-
-                       $defaults = $installer->getGlobalDefaults();
-
-                       foreach ( $installer->getGlobalNames() as $var ) {
-                               if ( isset( $defaults[$var] ) ) {
-                                       $this->settings[$var] = $defaults[$var];
-                               } else {
-                                       $this->settings[$var] = $GLOBALS[$var];
-                               }
-                       }
+                       $this->compiledDBs[] = $type;
                }
-               $this->compiledDBs = $compiledDBs;
 
                $this->parserTitle = Title::newFromText( 'Installer' );
-               $this->parserOptions = new ParserOptions; // language will  be wrong :(
+               $this->parserOptions = new ParserOptions; // language will be wrong :(
                $this->parserOptions->setEditSection( false );
        }
 
@@ -713,11 +715,15 @@ abstract class Installer {
 
        /**
         * Environment check for register_globals.
+        * Prevent installation if enabled
         */
        protected function envCheckRegisterGlobals() {
                if ( wfIniGetBool( 'register_globals' ) ) {
-                       $this->showMessage( 'config-register-globals' );
+                       $this->showMessage( 'config-register-globals-error' );
+                       return false;
                }
+
+               return true;
        }
 
        /**
@@ -1518,8 +1524,8 @@ abstract class Installer {
        /**
         * Actually perform the installation.
         *
-        * @param array $startCB A callback array for the beginning of each step
-        * @param array $endCB A callback array for the end of each step
+        * @param callable $startCB A callback array for the beginning of each step
+        * @param callable $endCB A callback array for the end of each step
         *
         * @return array Array of Status objects
         */
@@ -1734,7 +1740,7 @@ abstract class Installer {
        /**
         * Add an installation step following the given step.
         *
-        * @param array $callback A valid installation callback array, in this form:
+        * @param callable $callback A valid installation callback array, in this form:
         *    array( 'name' => 'some-unique-name', 'callback' => array( $obj, 'function' ) );
         * @param string $findStep The step to find. Omit to put the step at the beginning
         */