Merge "Remove these two rights autoreview and torunblocked from mediawiki"
[lhc/web/wiklou.git] / includes / installer / Installer.php
index 97214da..7c161ca 100644 (file)
@@ -2,6 +2,9 @@
 /**
  * Base code for MediaWiki installer.
  *
+ * DO NOT PATCH THIS FILE IF YOU NEED TO CHANGE INSTALLER BEHAVIOR IN YOUR PACKAGE!
+ * See mw-config/overrides/README for details.
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -20,6 +23,7 @@
  * @file
  * @ingroup Deployment
  */
+use MediaWiki\MediaWikiServices;
 
 /**
  * This documentation group collects source code files with deployment functionality.
@@ -383,14 +387,24 @@ abstract class Installer {
 
                $configOverrides->set( 'MessagesDirs', $messageDirs );
 
-               return new MultiConfig( [ $configOverrides, $baseConfig ] );
+               $installerConfig = new MultiConfig( [ $configOverrides, $baseConfig ] );
+
+               // make sure we use the installer config as the main config
+               $configRegistry = $baseConfig->get( 'ConfigRegistry' );
+               $configRegistry['main'] = function() use ( $installerConfig ) {
+                       return $installerConfig;
+               };
+
+               $configOverrides->set( 'ConfigRegistry', $configRegistry );
+
+               return $installerConfig;
        }
 
        /**
         * Constructor, always call this from child classes.
         */
        public function __construct() {
-               global $wgMemc, $wgUser;
+               global $wgMemc, $wgUser, $wgObjectCaches;
 
                $defaultConfig = new GlobalVarConfig(); // all the stuff from DefaultSettings.php
                $installerConfig = self::getInstallerConfig( $defaultConfig );
@@ -411,6 +425,7 @@ abstract class Installer {
 
                // Disable object cache (otherwise CACHE_ANYTHING will try CACHE_DB and
                // SqlBagOStuff will then throw since we just disabled wfGetDB)
+               $wgObjectCaches = MediaWikiServices::getInstance()->getMainConfig()->get( 'ObjectCaches' );
                $wgMemc = ObjectCache::getInstance( CACHE_NONE );
 
                // Having a user with id = 0 safeguards us from DB access via User::loadOptions().
@@ -1267,7 +1282,7 @@ abstract class Installer {
                        $command = $path . DIRECTORY_SEPARATOR . $name;
 
                        MediaWiki\suppressWarnings();
-                       $file_exists = file_exists( $command );
+                       $file_exists = is_executable( $command );
                        MediaWiki\restoreWarnings();
 
                        if ( $file_exists ) {
@@ -1727,7 +1742,7 @@ abstract class Installer {
                                wfMessage( 'mainpagedocfooter' )->inContentLanguage()->text()
                        );
 
-                       $page->doEditContent( $content,
+                       $status = $page->doEditContent( $content,
                                '',
                                EDIT_NEW,
                                false,