* @file
*/
-use MediaWiki\Storage\MutableRevisionRecord;
-use MediaWiki\Storage\RevisionAccessException;
-use MediaWiki\Storage\RevisionFactory;
-use MediaWiki\Storage\RevisionLookup;
-use MediaWiki\Storage\RevisionRecord;
-use MediaWiki\Storage\RevisionStore;
-use MediaWiki\Storage\RevisionStoreRecord;
-use MediaWiki\Storage\SlotRecord;
+use MediaWiki\Revision\MutableRevisionRecord;
+use MediaWiki\Revision\RevisionAccessException;
+use MediaWiki\Revision\RevisionFactory;
+use MediaWiki\Revision\RevisionLookup;
+use MediaWiki\Revision\RevisionRecord;
+use MediaWiki\Revision\RevisionStore;
+use MediaWiki\Revision\RevisionStoreRecord;
+use MediaWiki\Revision\SlotRecord;
use MediaWiki\Storage\SqlBlobStore;
use Wikimedia\Rdbms\IDatabase;
use MediaWiki\Linker\LinkTarget;
*/
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
);
}
+ 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 = [
*/
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
);
}
+ 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 = [
* @return SlotRecord
*/
private function getMainSlotRaw() {
- return $this->mRecord->getSlot( 'main', RevisionRecord::RAW );
+ return $this->mRecord->getSlot( SlotRecord::MAIN, RevisionRecord::RAW );
}
/**
}
try {
- return $this->mRecord->getContent( 'main', $audience, $user );
+ return $this->mRecord->getContent( SlotRecord::MAIN, $audience, $user );
}
catch ( RevisionAccessException $e ) {
return null;
$rec = self::getRevisionStore()->newNullRevision( $dbw, $title, $comment, $minor, $user );
- return new Revision( $rec );
+ return $rec ? new Revision( $rec ) : null;
}
/**