Merge "SpecialLockdb and SpecialUnlockdb don't do database writes"
[lhc/web/wiklou.git] / maintenance / update.php
index 06e947c..775fa7b 100755 (executable)
@@ -83,6 +83,13 @@ class UpdateMediaWiki extends Maintenance {
                                "ABORTING (see https://bugs.php.net/bug.php?id=45996).\n",
                                true );
                }
+
+               if ( !function_exists( 'mb_strlen' ) ) {
+                       $this->error(
+                               "MediaWiki now requires the mbstring PHP extension, your system doesn't have it.\n"
+                               . "ABORTING.\n",
+                               true );
+               }
        }
 
        function execute() {
@@ -112,7 +119,10 @@ class UpdateMediaWiki extends Maintenance {
                        }
                }
 
-               $wgLang = Language::factory( 'en' );
+               $lang = Language::factory( 'en' );
+               // Set global language to ensure localised errors are in English (bug 20633)
+               RequestContext::getMain()->setLanguage( $lang );
+               $wgLang = $lang; // BackCompat
 
                define( 'MW_UPDATER', true );
 
@@ -124,7 +134,7 @@ class UpdateMediaWiki extends Maintenance {
                        $this->compatChecks();
                } else {
                        $this->output( "Skipping compatibility checks, proceed at your own risk (Ctrl+C to abort)\n" );
-                       wfCountdown( 5 );
+                       wfCountDown( 5 );
                }
 
                // Check external dependencies are up to date
@@ -157,7 +167,7 @@ class UpdateMediaWiki extends Maintenance {
 
                $shared = $this->hasOption( 'doshared' );
 
-               $updates = array( 'core', 'extensions' );
+               $updates = [ 'core', 'extensions' ];
                if ( !$this->hasOption( 'schema' ) ) {
                        if ( $this->hasOption( 'noschema' ) ) {
                                $updates[] = 'noschema';
@@ -165,7 +175,7 @@ class UpdateMediaWiki extends Maintenance {
                        $updates[] = 'stats';
                }
 
-               $updater = DatabaseUpdater::newForDb( $db, $shared, $this );
+               $updater = DatabaseUpdater::newForDB( $db, $shared, $this );
                $updater->doUpdates( $updates );
 
                foreach ( $updater->getPostDatabaseUpdateMaintenance() as $maint ) {
@@ -191,7 +201,7 @@ class UpdateMediaWiki extends Maintenance {
 
                $time2 = microtime( true );
 
-               $timeDiff = $wgLang->formatTimePeriod( $time2 - $time1 );
+               $timeDiff = $lang->formatTimePeriod( $time2 - $time1 );
                $this->output( "\nDone in $timeDiff.\n" );
        }
 
@@ -201,12 +211,12 @@ class UpdateMediaWiki extends Maintenance {
                # Don't try to access the database
                # This needs to be disabled early since extensions will try to use the l10n
                # cache from $wgExtensionFunctions (bug 20471)
-               $wgLocalisationCacheConf = array(
+               $wgLocalisationCacheConf = [
                        'class' => 'LocalisationCache',
                        'storeClass' => 'LCStoreNull',
                        'storeDirectory' => false,
                        'manualRecache' => false,
-               );
+               ];
        }
 }