X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Finstaller%2FDatabaseUpdater.php;h=b56ab62dac5037d8647d7d993169b5045f14bd74;hb=f1907d3f012cf3ae4b56e256fb71cc04b5ec33ee;hp=500bc5af59fd9638eb7f5b43ede6462fce30659d;hpb=30ec9d51c6c17cd47f25cc74a0517878ed18df10;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index 500bc5af59..b56ab62dac 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -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']; } @@ -1047,7 +1047,7 @@ abstract class DatabaseUpdater { * Sets the number of active users in the site_stats table */ protected function doActiveUsersInit() { - $activeUsers = $this->db->selectField( 'site_stats', 'ss_active_users', false, __METHOD__ ); + $activeUsers = $this->db->selectField( 'site_stats', 'ss_active_users', '', __METHOD__ ); if ( $activeUsers == -1 ) { $activeUsers = $this->db->selectField( 'recentchanges', 'COUNT( DISTINCT rc_user_text )', @@ -1227,7 +1227,7 @@ abstract class DatabaseUpdater { "maintenance/migrateComments.php.\n" ); $task = $this->maintenance->runChild( MigrateComments::class, 'migrateComments.php' ); - $task->execute(); + $ok = $task->execute(); $this->output( $ok ? "done.\n" : "errors were encountered.\n" ); } } @@ -1257,10 +1257,34 @@ 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' ); + } + } } + /** + * Populate ar_rev_id, then make it not nullable + * @since 1.31 + */ + protected function populateArchiveRevId() { + $info = $this->db->fieldInfo( 'archive', 'ar_rev_id', __METHOD__ ); + if ( !$info ) { + throw new MWException( 'Missing ar_rev_id field of archive table. Should not happen.' ); + } + if ( $info->isNullable() ) { + $this->output( "Populating ar_rev_id.\n" ); + $task = $this->maintenance->runChild( 'PopulateArchiveRevId', 'populateArchiveRevId.php' ); + if ( $task->execute() ) { + $this->applyPatch( 'patch-ar_rev_id-not-null.sql', false, + 'Making ar_rev_id not nullable' ); + } + } + } + }