X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Finstaller%2FDatabaseUpdater.php;h=7970d5d9c8c60cefc07426a385f07880fed01f15;hb=9a37fb8e4851d13bfb208eb886c9947a7f21571c;hp=a317822c0a806d860e48640228ad7d73ce8fecf3;hpb=63752d25bfc28159f5f9b6a2e9a6a6d784959fd0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index a317822c0a..7970d5d9c8 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -179,12 +179,12 @@ abstract class DatabaseUpdater { /** * @param Database $db * @param bool $shared - * @param Maintenance $maintenance + * @param Maintenance|null $maintenance * * @throws MWException * @return DatabaseUpdater */ - public static function newForDB( Database $db, $shared = false, $maintenance = null ) { + public static function newForDB( Database $db, $shared = false, Maintenance $maintenance = null ) { $type = $db->getType(); if ( in_array( $type, Installer::getDBTypes() ) ) { $class = ucfirst( $type ) . 'Updater'; @@ -340,12 +340,22 @@ abstract class DatabaseUpdater { * * @param string $tableName The table name * @param string $fieldName The field to be modified - * @param string $sqlPath The path to the SQL change path + * @param string $sqlPath The path to the SQL patch */ public function modifyExtensionField( $tableName, $fieldName, $sqlPath ) { $this->extensionUpdates[] = [ 'modifyField', $tableName, $fieldName, $sqlPath, true ]; } + /** + * @since 1.31 + * + * @param string $tableName The table name + * @param string $sqlPath The path to the SQL patch + */ + public function modifyExtensionTable( $tableName, $sqlPath ) { + $this->extensionUpdates[] = [ 'modifyTable', $tableName, $sqlPath, true ]; + } + /** * * @since 1.20 @@ -606,7 +616,7 @@ abstract class DatabaseUpdater { * 1.13...) with the values being arrays of updates, identical to how * updaters.inc did it (for now) * - * @return array + * @return array[] */ abstract protected function getCoreUpdateList(); @@ -1062,7 +1072,7 @@ abstract class DatabaseUpdater { "maintenance/populateLogUsertext.php.\n" ); - $task = $this->maintenance->runChild( 'PopulateLogUsertext' ); + $task = $this->maintenance->runChild( PopulateLogUsertext::class ); $task->execute(); $this->output( "done.\n" ); } @@ -1078,7 +1088,7 @@ abstract class DatabaseUpdater { "databases, you may want to hit Ctrl-C and do this manually with\n" . "maintenance/populateLogSearch.php.\n" ); - $task = $this->maintenance->runChild( 'PopulateLogSearch' ); + $task = $this->maintenance->runChild( PopulateLogSearch::class ); $task->execute(); $this->output( "done.\n" ); } @@ -1118,7 +1128,7 @@ abstract class DatabaseUpdater { } $this->output( "Updating category collations..." ); - $task = $this->maintenance->runChild( 'UpdateCollation' ); + $task = $this->maintenance->runChild( UpdateCollation::class ); $task->execute(); $this->output( "...done.\n" ); } @@ -1129,7 +1139,7 @@ abstract class DatabaseUpdater { */ protected function doMigrateUserOptions() { if ( $this->db->tableExists( 'user_properties' ) ) { - $cl = $this->maintenance->runChild( 'ConvertUserOptions', 'convertUserOptions.php' ); + $cl = $this->maintenance->runChild( ConvertUserOptions::class, 'convertUserOptions.php' ); $cl->execute(); $this->output( "done.\n" ); } @@ -1167,7 +1177,9 @@ abstract class DatabaseUpdater { /** * @var $cl RebuildLocalisationCache */ - $cl = $this->maintenance->runChild( 'RebuildLocalisationCache', 'rebuildLocalisationCache.php' ); + $cl = $this->maintenance->runChild( + RebuildLocalisationCache::class, 'rebuildLocalisationCache.php' + ); $this->output( "Rebuilding localisation cache...\n" ); $cl->setForce(); $cl->execute(); @@ -1214,10 +1226,41 @@ abstract class DatabaseUpdater { "databases, you may want to hit Ctrl-C and do this manually with\n" . "maintenance/migrateComments.php.\n" ); - $task = $this->maintenance->runChild( 'MigrateComments', 'migrateComments.php' ); - $task->execute(); - $this->output( "done.\n" ); + $task = $this->maintenance->runChild( MigrateComments::class, 'migrateComments.php' ); + $ok = $task->execute(); + $this->output( $ok ? "done.\n" : "errors were encountered.\n" ); } } + /** + * Migrate actors to the new 'actor' table + * @since 1.31 + */ + protected function migrateActors() { + global $wgActorTableSchemaMigrationStage; + if ( $wgActorTableSchemaMigrationStage >= MIGRATION_WRITE_NEW && + !$this->updateRowExists( 'MigrateActors' ) + ) { + $this->output( + "Migrating actors to the 'actor' table, printing progress markers. For large\n" . + "databases, you may want to hit Ctrl-C and do this manually with\n" . + "maintenance/migrateActors.php.\n" + ); + $task = $this->maintenance->runChild( 'MigrateActors', 'migrateActors.php' ); + $ok = $task->execute(); + $this->output( $ok ? "done.\n" : "errors were encountered.\n" ); + } + } + + /** + * Migrate ar_text to modern storage + * @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" ); + } + }