Merge "Move image_comment_temp entries when the file is moved"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 19 Mar 2018 01:44:06 +0000 (01:44 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 19 Mar 2018 01:44:06 +0000 (01:44 +0000)
includes/filerepo/file/LocalFile.php

index ec4a5fb..7fc45eb 100644 (file)
@@ -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',