From 9ceb2e08a049ed60e669c4636bcb8eb5eb1d87c6 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Sun, 18 Mar 2018 11:37:05 -0400 Subject: [PATCH] Move image_comment_temp entries when the file is moved Bug: T189985 Change-Id: I437102d62cb94fd3195ff06ee8185ce5a2dc941e --- includes/filerepo/file/LocalFile.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index ec4a5fb5f1..7fc45ebf4a 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -3374,6 +3374,8 @@ class LocalFileMoveBatch { * many rows where updated. */ protected function doDBUpdates() { + global $wgCommentTableSchemaMigrationStage; + $dbw = $this->db; // Update current image @@ -3383,6 +3385,15 @@ class LocalFileMoveBatch { [ 'img_name' => $this->oldName ], __METHOD__ ); + if ( $wgCommentTableSchemaMigrationStage > MIGRATION_OLD ) { + $dbw->update( + 'image_comment_temp', + [ 'imgcomment_name' => $this->newName ], + [ 'imgcomment_name' => $this->oldName ], + __METHOD__ + ); + } + // Update old images $dbw->update( 'oldimage', -- 2.20.1