Fix order of @var parameter in PHP
[lhc/web/wiklou.git] / includes / installer / DatabaseUpdater.php
index 43000b8..24f7dc8 100644 (file)
@@ -22,6 +22,7 @@
  */
 use Wikimedia\Rdbms\Database;
 use Wikimedia\Rdbms\IDatabase;
+use Wikimedia\Rdbms\IMaintainableDatabase;
 use MediaWiki\MediaWikiServices;
 
 require_once __DIR__ . '/../../maintenance/Maintenance.php';
@@ -177,14 +178,18 @@ abstract class DatabaseUpdater {
        }
 
        /**
-        * @param Database $db
+        * @param IMaintainableDatabase $db
         * @param bool $shared
         * @param Maintenance|null $maintenance
         *
         * @throws MWException
         * @return DatabaseUpdater
         */
-       public static function newForDB( Database $db, $shared = false, Maintenance $maintenance = null ) {
+       public static function newForDB(
+               IMaintainableDatabase $db,
+               $shared = false,
+               Maintenance $maintenance = null
+       ) {
                $type = $db->getType();
                if ( in_array( $type, Installer::getDBTypes() ) ) {
                        $class = ucfirst( $type ) . 'Updater';
@@ -410,9 +415,7 @@ abstract class DatabaseUpdater {
                $this->updatesSkipped = [];
 
                foreach ( $updates as $funcList ) {
-                       $func = $funcList[0];
-                       $args = $funcList[1];
-                       $origParams = $funcList[2];
+                       list( $func, $args, $origParams ) = $funcList;
                        $func( ...$args );
                        flush();
                        $this->updatesSkipped[] = $origParams;
@@ -1074,7 +1077,9 @@ abstract class DatabaseUpdater {
                }
 
                // ResourceLoader: Message cache
-               $blobStore = new MessageBlobStore();
+               $blobStore = new MessageBlobStore(
+                       MediaWikiServices::getInstance()->getResourceLoader()
+               );
                $blobStore->clear();
 
                // ResourceLoader: File-dependency cache
@@ -1219,7 +1224,7 @@ abstract class DatabaseUpdater {
         */
        protected function rebuildLocalisationCache() {
                /**
-                * @var $cl RebuildLocalisationCache
+                * @var RebuildLocalisationCache $cl
                 */
                $cl = $this->maintenance->runChild(
                        RebuildLocalisationCache::class, 'rebuildLocalisationCache.php'
@@ -1261,10 +1266,7 @@ abstract class DatabaseUpdater {
         * @since 1.30
         */
        protected function migrateComments() {
-               global $wgCommentTableSchemaMigrationStage;
-               if ( $wgCommentTableSchemaMigrationStage >= MIGRATION_WRITE_NEW &&
-                       !$this->updateRowExists( 'MigrateComments' )
-               ) {
+               if ( !$this->updateRowExists( 'MigrateComments' ) ) {
                        $this->output(
                                "Migrating comments to the 'comments' table, printing progress markers. For large\n" .
                                "databases, you may want to hit Ctrl-C and do this manually with\n" .
@@ -1281,20 +1283,14 @@ abstract class DatabaseUpdater {
         * @since 1.32
         */
        protected function migrateImageCommentTemp() {
-               global $wgCommentTableSchemaMigrationStage;
-
                if ( $this->tableExists( 'image_comment_temp' ) ) {
-                       if ( $wgCommentTableSchemaMigrationStage > MIGRATION_OLD ) {
-                               $this->output( "Merging image_comment_temp into the image table\n" );
-                               $task = $this->maintenance->runChild(
-                                       MigrateImageCommentTemp::class, 'migrateImageCommentTemp.php'
-                               );
-                               $task->setForce();
-                               $ok = $task->execute();
-                               $this->output( $ok ? "done.\n" : "errors were encountered.\n" );
-                       } else {
-                               $ok = true;
-                       }
+                       $this->output( "Merging image_comment_temp into the image table\n" );
+                       $task = $this->maintenance->runChild(
+                               MigrateImageCommentTemp::class, 'migrateImageCommentTemp.php'
+                       );
+                       $task->setForce();
+                       $ok = $task->execute();
+                       $this->output( $ok ? "done.\n" : "errors were encountered.\n" );
                        if ( $ok ) {
                                $this->dropTable( 'image_comment_temp' );
                        }