*/
use Wikimedia\Rdbms\Database;
use Wikimedia\Rdbms\IDatabase;
+use Wikimedia\Rdbms\IMaintainableDatabase;
use MediaWiki\MediaWikiServices;
require_once __DIR__ . '/../../maintenance/Maintenance.php';
}
/**
- * @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';
$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;
}
// ResourceLoader: Message cache
- $blobStore = new MessageBlobStore();
+ $blobStore = new MessageBlobStore(
+ MediaWikiServices::getInstance()->getResourceLoader()
+ );
$blobStore->clear();
// ResourceLoader: File-dependency cache
*/
protected function rebuildLocalisationCache() {
/**
- * @var $cl RebuildLocalisationCache
+ * @var RebuildLocalisationCache $cl
*/
$cl = $this->maintenance->runChild(
RebuildLocalisationCache::class, 'rebuildLocalisationCache.php'
* @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" .
* @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' );
}