From a2f8caa37193ccf63e88ead2269cb5d1880954f0 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Thu, 18 Oct 2018 17:12:44 -0400 Subject: [PATCH] Fix comment handling on image upload or deletion Before Iab5f5215, the call to CommentStore::insertWithTempTable() also happened to populate image_comment_temp for the later call to insertSelect() when moving rows from the image table to oldimage or filearchive. There was nothing in the image table itself that needed updating. In that change those calls were changed to CommentStore::insert(), but it was missed that in that case we do have to update the image table itself. Bug: T207419 Change-Id: I26c417c9ab8a9160a7c7ec548ffdfabf17f01980 --- includes/filerepo/file/LocalFile.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 254ceff1b0..32d130143b 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -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__ + ); } } -- 2.20.1