X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FRevision.php;h=1e35ddaeaf672da273e7c76f6c9a8f07b3045c91;hb=9dcdac86a52b28093aff046bc9c4c98363dafb61;hp=7ff73dddbf56fc4849c7c5e1d2450c453fece557;hpb=7a90cdd12a29633232e81c13c6003b9d8cb168b8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Revision.php b/includes/Revision.php index 7ff73dddbf..1e35ddaeaf 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -350,6 +350,7 @@ class Revision implements IDBAccessObject { */ public static function selectFields() { global $wgContentHandlerUseDB, $wgActorTableSchemaMigrationStage; + global $wgMultiContentRevisionSchemaMigrationStage; if ( $wgActorTableSchemaMigrationStage > MIGRATION_WRITE_BOTH ) { // If code is using this instead of self::getQueryInfo(), there's a @@ -361,6 +362,18 @@ class Revision implements IDBAccessObject { ); } + if ( !( $wgMultiContentRevisionSchemaMigrationStage & SCHEMA_COMPAT_WRITE_OLD ) ) { + // If code is using this instead of self::getQueryInfo(), there's a + // decent chance it's going to try to directly access + // $row->rev_text_id or $row->rev_content_model and we can't give it + // useful values here once those aren't being written anymore, + // and may not exist at all. + throw new BadMethodCallException( + 'Cannot use ' . __METHOD__ . ' when $wgMultiContentRevisionSchemaMigrationStage ' + . 'does not have SCHEMA_COMPAT_WRITE_OLD set.' + ); + } + wfDeprecated( __METHOD__, '1.31' ); $fields = [ @@ -396,6 +409,7 @@ class Revision implements IDBAccessObject { */ public static function selectArchiveFields() { global $wgContentHandlerUseDB, $wgActorTableSchemaMigrationStage; + global $wgMultiContentRevisionSchemaMigrationStage; if ( $wgActorTableSchemaMigrationStage > MIGRATION_WRITE_BOTH ) { // If code is using this instead of self::getQueryInfo(), there's a @@ -407,6 +421,18 @@ class Revision implements IDBAccessObject { ); } + if ( !( $wgMultiContentRevisionSchemaMigrationStage & SCHEMA_COMPAT_WRITE_OLD ) ) { + // If code is using this instead of self::getQueryInfo(), there's a + // decent chance it's going to try to directly access + // $row->ar_text_id or $row->ar_content_model and we can't give it + // useful values here once those aren't being written anymore, + // and may not exist at all. + throw new BadMethodCallException( + 'Cannot use ' . __METHOD__ . ' when $wgMultiContentRevisionSchemaMigrationStage ' + . 'does not have SCHEMA_COMPAT_WRITE_OLD set.' + ); + } + wfDeprecated( __METHOD__, '1.31' ); $fields = [ @@ -1013,7 +1039,7 @@ class Revision implements IDBAccessObject { * @param stdClass $row The text data * @param string $prefix Table prefix (default 'old_') * @param string|bool $wiki The name of the wiki to load the revision text from - * (same as the the wiki $row was loaded from) or false to indicate the local + * (same as the wiki $row was loaded from) or false to indicate the local * wiki (this is the default). Otherwise, it must be a symbolic wiki database * identifier as understood by the LoadBalancer class. * @return string|false Text the text requested or false on failure