WikiExporter: Remove unnecessary check for SCHEMA_COMPAT_WRITE_OLD flag
authordaniel <dkinzler@wikimedia.org>
Mon, 28 Oct 2019 20:09:44 +0000 (21:09 +0100)
committerDaniel Kinzler <dkinzler@wikimedia.org>
Mon, 18 Nov 2019 18:12:15 +0000 (18:12 +0000)
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
tests/phpunit/maintenance/backup_PageTest.php

index fd200d1..51a1870 100644 (file)
@@ -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' ]
                );
index 54a362e..1b67179 100644 (file)
@@ -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();