From: daniel Date: Fri, 7 Sep 2018 12:12:12 +0000 (+0200) Subject: Allow dumps to function with MCR in read-new mode. X-Git-Tag: 1.34.0-rc.0~4164^2 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=7c2d0202ab302a8a2b53114fdcf893f69fc3110e;p=lhc%2Fweb%2Fwiklou.git Allow dumps to function with MCR in read-new mode. This is a temporary fix that forces the dump code to continue to use the old database schema, even when MCR is in SCHEMA_COMPAT_READ_NEW mode. This will continue to function until SCHEMA_COMPAT_WRITE_OLD mode is disabled. Bug: T198561 Change-Id: Ic54ee703f47d1843f70fdb7185ac1b098f148680 --- diff --git a/includes/export/WikiExporter.php b/includes/export/WikiExporter.php index 6c7a449372..b0185843e2 100644 --- a/includes/export/WikiExporter.php +++ b/includes/export/WikiExporter.php @@ -263,6 +263,8 @@ class WikiExporter { * @throws Exception */ protected function dumpFrom( $cond = '', $orderRevs = false ) { + global $wgMultiContentRevisionSchemaMigrationStage; + # For logging dumps... if ( $this->history & self::LOGS ) { $where = []; @@ -330,8 +332,17 @@ class WikiExporter { } # For page dumps... } else { + 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!' + ); + } + $revOpts = [ 'page' ]; if ( $this->text != self::STUB ) { + // TODO: remove the text and make XmlDumpWriter use a RevisionStore instead! (T198706) $revOpts[] = 'text'; } $revQuery = Revision::getQueryInfo( $revOpts ); @@ -343,7 +354,8 @@ class WikiExporter { ]; unset( $join['page'] ); - $fields = array_merge( $revQuery['fields'], [ 'page_restrictions' ] ); + // TODO: remove rev_text_id and make XmlDumpWriter use a RevisionStore instead! (T198706) + $fields = array_merge( $revQuery['fields'], [ 'page_restrictions, rev_text_id' ] ); $conds = []; if ( $cond !== '' ) {