From: Brad Jorsch Date: Thu, 18 Oct 2018 21:12:44 +0000 (-0400) Subject: Fix comment handling on image upload or deletion X-Git-Tag: 1.34.0-rc.0~3702^2 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=a2f8caa37193ccf63e88ead2269cb5d1880954f0;p=lhc%2Fweb%2Fwiklou.git 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 --- 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__ + ); } }