diff options
author | Alexander Vorwerk <zabe@avorwerk.net> | 2022-12-31 14:09:07 +0100 |
---|---|---|
committer | Alexander Vorwerk <zabe@avorwerk.net> | 2023-01-02 22:33:16 +0100 |
commit | cf127211018031a23ab881f1c6697fc5d7a65d36 (patch) | |
tree | e6519d8295acab1cf769c4aef42c2f66d31fe819 /includes/CommentStore | |
parent | 0bb3d1fd8c6acfe79bc26bd2c76de75a07b9adc8 (diff) | |
download | mediawikicore-cf127211018031a23ab881f1c6697fc5d7a65d36.tar.gz mediawikicore-cf127211018031a23ab881f1c6697fc5d7a65d36.zip |
Prepare migration from revision_comment_temp to rev_comment_id
This patch introduces a configuration variable that allows one
to control the migration stage in production.
Bug: T299954
Change-Id: I36f1e3cd9fb0f25fd43f4dbb97f791da5eb1147b
Diffstat (limited to 'includes/CommentStore')
-rw-r--r-- | includes/CommentStore/CommentStore.php | 7 | ||||
-rw-r--r-- | includes/CommentStore/CommentStoreBase.php | 9 |
2 files changed, 7 insertions, 9 deletions
diff --git a/includes/CommentStore/CommentStore.php b/includes/CommentStore/CommentStore.php index c47f6e49d435..df21ef797115 100644 --- a/includes/CommentStore/CommentStore.php +++ b/includes/CommentStore/CommentStore.php @@ -69,9 +69,14 @@ class CommentStore extends CommentStoreBase { * @param int $stage One of the MIGRATION_* constants, or an appropriate * combination of SCHEMA_COMPAT_* constants. Always MIGRATION_NEW for * MediaWiki core since 1.33. + * @param array $tempTableStageOverrides */ - public function __construct( Language $lang, $stage ) { + public function __construct( Language $lang, $stage, $tempTableStageOverrides ) { parent::__construct( self::TEMP_TABLES, $lang, $stage ); + + foreach ( $tempTableStageOverrides as $key => $stageOverride ) { + $this->tempTables[$key]['stage'] = $stageOverride; + } } /** diff --git a/includes/CommentStore/CommentStoreBase.php b/includes/CommentStore/CommentStoreBase.php index 4c2e0bde8994..abcdd97ead8d 100644 --- a/includes/CommentStore/CommentStoreBase.php +++ b/includes/CommentStore/CommentStoreBase.php @@ -23,7 +23,6 @@ namespace MediaWiki\CommentStore; use FormatJson; use InvalidArgumentException; use Language; -use LogicException; use MediaWiki\Language\RawMessage; use Message; use OverflowException; @@ -61,7 +60,7 @@ class CommentStoreBase { * - stage: Migration stage * - deprecatedIn: Version when using insertWithTempTable() was deprecated */ - private $tempTables; + protected $tempTables; /** * @var int One of the MIGRATION_* constants, or an appropriate combination @@ -174,14 +173,8 @@ class CommentStoreBase { if ( ( $tempTableStage & SCHEMA_COMPAT_READ_BOTH ) === SCHEMA_COMPAT_READ_OLD ) { $joinField = "{$alias}.{$t['field']}"; } else { - // Nothing hits this code path for now, but will in the future when we set - // $this->tempTables['rev_comment']['stage'] to MIGRATION_WRITE_NEW while - // merging revision_comment_temp into revision. - // @codeCoverageIgnoreStart $joins[$alias][0] = 'LEFT JOIN'; $joinField = "(CASE WHEN {$key}_id != 0 THEN {$key}_id ELSE {$alias}.{$t['field']} END)"; - throw new LogicException( 'Nothing should reach this code path at this time' ); - // @codeCoverageIgnoreEnd } } else { $joinField = "{$key}_id"; |