From ccb2bb29951ac88ac29ab52a4319788f5b6081c3 Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 28 Oct 2019 21:09:44 +0100 Subject: [PATCH] WikiExporter: Remove unnecessary check for SCHEMA_COMPAT_WRITE_OLD flag WikiExporter used to require SCHEMA_COMPAT_WRITE_OLD to be enabled, until that requirement was fixed in I5ea972bb07ca1cfb3a2ad8ef120aef7. However, I failed to remove the explicit check for the flag at the time, causing all exports to fail in SCHEMA_COMPAT_NEW mode. This change removes the obsolete check. Bug: T236735 Change-Id: I809ed4e2f1f30fdc4bd817f815d733d8a62f3d4f (cherry picked from commit d9209707cc62ea2eb0f0fe9d2c79e56a8cc87552) --- includes/export/WikiExporter.php | 9 ------- tests/phpunit/maintenance/backup_PageTest.php | 26 ++++++------------- 2 files changed, 8 insertions(+), 27 deletions(-) diff --git a/includes/export/WikiExporter.php b/includes/export/WikiExporter.php index fd200d1fbb..51a187070a 100644 --- a/includes/export/WikiExporter.php +++ b/includes/export/WikiExporter.php @@ -351,15 +351,6 @@ class WikiExporter { * @throws Exception */ protected function dumpPages( $cond, $orderRevs ) { - global $wgMultiContentRevisionSchemaMigrationStage; - if ( !( $wgMultiContentRevisionSchemaMigrationStage & SCHEMA_COMPAT_WRITE_OLD ) ) { - // TODO: Make XmlDumpWriter use a RevisionStore! (see T198706 and T174031) - throw new MWException( - 'Cannot use WikiExporter with SCHEMA_COMPAT_WRITE_OLD mode disabled!' - . ' Support for dumping from the new schema is not implemented yet!' - ); - } - $revQuery = MediaWikiServicesAlias::getInstance()->getRevisionStore()->getQueryInfo( [ 'page' ] ); diff --git a/tests/phpunit/maintenance/backup_PageTest.php b/tests/phpunit/maintenance/backup_PageTest.php index 54a362e705..1b67179760 100644 --- a/tests/phpunit/maintenance/backup_PageTest.php +++ b/tests/phpunit/maintenance/backup_PageTest.php @@ -136,11 +136,7 @@ class BackupDumperPageTest extends DumpTestCase { if ( ( $wgMultiContentRevisionSchemaMigrationStage & SCHEMA_COMPAT_WRITE_OLD ) ) { $this->db->update( 'revision', - [ - 'rev_text_id' => 0, - 'rev_sha1' => '', - 'rev_len' => '0', - ], + [ 'rev_text_id' => 0 ], [ 'rev_id' => $revision->getId() ] ); } @@ -148,11 +144,7 @@ class BackupDumperPageTest extends DumpTestCase { if ( ( $wgMultiContentRevisionSchemaMigrationStage & SCHEMA_COMPAT_WRITE_NEW ) ) { $this->db->update( 'content', - [ - 'content_address' => 'tt:0', - 'content_sha1' => '', - 'content_size' => '0', - ], + [ 'content_address' => 'tt:0' ], [ 'content_id' => $revision->getSlot( SlotRecord::MAIN )->getContentId() ] ); } @@ -337,8 +329,7 @@ class BackupDumperPageTest extends DumpTestCase { "Talk about BackupDumperTestP1 Text1", false, CONTENT_MODEL_WIKITEXT, - CONTENT_FORMAT_WIKITEXT, - $schemaVersion + CONTENT_FORMAT_WIKITEXT ); $asserter->assertPageEnd(); @@ -352,13 +343,12 @@ class BackupDumperPageTest extends DumpTestCase { $this->revId5_1, "BackupDumperTestP5 Summary1", null, - 0, - "", + 24, + "d2vipufvkfs9wfruwjfj8eschxw0fbl", false, false, CONTENT_MODEL_WIKITEXT, - CONTENT_FORMAT_WIKITEXT, - $schemaVersion + CONTENT_FORMAT_WIKITEXT ); $asserter->assertPageEnd(); @@ -484,8 +474,8 @@ class BackupDumperPageTest extends DumpTestCase { $this->revId5_1, "BackupDumperTestP5 Summary1", null, - 0, - "" + 24, + "d2vipufvkfs9wfruwjfj8eschxw0fbl" ); $asserter->assertPageEnd(); -- 2.20.1