Merge "Fix comment handling on image upload or deletion"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 22 Oct 2018 15:08:42 +0000 (15:08 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 22 Oct 2018 15:08:42 +0000 (15:08 +0000)
includes/filerepo/file/LocalFile.php

index d22c9a6..ebbc8f8 100644 (file)
@@ -1570,7 +1570,13 @@ class LocalFile extends File {
                                        [ 'image_comment_temp' => [ 'LEFT JOIN', [ 'imgcomment_name = img_name' ] ] ]
                                );
                                foreach ( $res as $row ) {
-                                       $commentStore->insert( $dbw, 'img_description', $row->img_description );
+                                       $imgFields = $commentStore->insert( $dbw, 'img_description', $row->img_description );
+                                       $dbw->update(
+                                               'image',
+                                               $imgFields,
+                                               [ 'img_name' => $row->img_name ],
+                                               __METHOD__
+                                       );
                                }
                        }
 
@@ -2566,7 +2572,13 @@ class LocalFileDeleteBatch {
                                        [ 'image_comment_temp' => [ 'LEFT JOIN', [ 'imgcomment_name = img_name' ] ] ]
                                );
                                foreach ( $res as $row ) {
-                                       $commentStore->insert( $dbw, 'img_description', $row->img_description );
+                                       $imgFields = $commentStore->insert( $dbw, 'img_description', $row->img_description );
+                                       $dbw->update(
+                                               'image',
+                                               $imgFields,
+                                               [ 'img_name' => $row->img_name ],
+                                               __METHOD__
+                                       );
                                }
                        }