Merge "Drop archive.ar_text and ar_flags"
[lhc/web/wiklou.git] / includes / installer / DatabaseUpdater.php
index 7a1aba6..1f6110b 100644 (file)
@@ -136,7 +136,7 @@ abstract class DatabaseUpdater {
                        $wgExtPGAlteredFields, $wgExtNewIndexes, $wgExtModifiedFields;
 
                # For extensions only, should be populated via hooks
-               # $wgDBtype should be checked to specifiy the proper file
+               # $wgDBtype should be checked to specify the proper file
                $wgExtNewTables = []; // table, dir
                $wgExtNewFields = []; // table, column, dir
                $wgExtPGNewFields = []; // table, column, column attributes; for PostgreSQL
@@ -150,7 +150,7 @@ abstract class DatabaseUpdater {
         * LoadExtensionSchemaUpdates hook.
         */
        private function loadExtensions() {
-               if ( !defined( 'MEDIAWIKI_INSTALL' ) ) {
+               if ( !defined( 'MEDIAWIKI_INSTALL' ) || defined( 'MW_EXTENSIONS_LOADED' ) ) {
                        return; // already loaded
                }
                $vars = Installer::getExistingLocalSettings();
@@ -162,7 +162,7 @@ abstract class DatabaseUpdater {
 
                // This will automatically add "AutoloadClasses" to $wgAutoloadClasses
                $data = $registry->readFromQueue( $queue );
-               $hooks = [ 'wgHooks' => [ 'LoadExtensionSchemaUpdates' => [] ] ];
+               $hooks = [];
                if ( isset( $data['globals']['wgHooks']['LoadExtensionSchemaUpdates'] ) ) {
                        $hooks = $data['globals']['wgHooks']['LoadExtensionSchemaUpdates'];
                }
@@ -1257,10 +1257,15 @@ abstract class DatabaseUpdater {
         * @since 1.31
         */
        protected function migrateArchiveText() {
-               $this->output( "Migrating archive ar_text to modern storage.\n" );
-               $task = $this->maintenance->runChild( MigrateArchiveText::class, 'migrateArchiveText.php' );
-               $task->execute();
-               $this->output( "done.\n" );
+               if ( $this->db->fieldExists( 'archive', 'ar_text', __METHOD__ ) ) {
+                       $this->output( "Migrating archive ar_text to modern storage.\n" );
+                       $task = $this->maintenance->runChild( MigrateArchiveText::class, 'migrateArchiveText.php' );
+                       $task->setForce();
+                       if ( $task->execute() ) {
+                               $this->applyPatch( 'patch-drop-ar_text.sql', false,
+                                       'Dropping ar_text and ar_flags columns' );
+                       }
+               }
        }
 
        /**