From: Bartosz DziewoƄski Date: Thu, 7 Jan 2016 02:31:53 +0000 (-0800) Subject: ChangeTags: Teach updateTags() to derive log_id from rev_id (and the other way) X-Git-Tag: 1.31.0-rc.0~8296^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=68cc94540d1d6f84b267ab742ce8ff3a46e3ec2f;p=lhc%2Fweb%2Fwiklou.git ChangeTags: Teach updateTags() to derive log_id from rev_id (and the other way) This means that, for example, the tags for a file upload's log entry and the associated page revision should finally be in sync. Bug: T122090 Change-Id: I3537278ff728d160bbdcf149d0f99fe9621c02e6 --- diff --git a/includes/changetags/ChangeTags.php b/includes/changetags/ChangeTags.php index 5aac495641..a8c9f7b526 100644 --- a/includes/changetags/ChangeTags.php +++ b/includes/changetags/ChangeTags.php @@ -212,6 +212,22 @@ class ChangeTags { ); } + if ( $log_id && !$rev_id ) { + $rev_id = $dbw->selectField( + 'log_search', + 'ls_value', + array( 'ls_field' => 'associated_rev_id', 'ls_log_id' => $log_id ), + __METHOD__ + ); + } elseif ( !$log_id && $rev_id ) { + $log_id = $dbw->selectField( + 'log_search', + 'ls_log_id', + array( 'ls_field' => 'associated_rev_id', 'ls_value' => $rev_id ), + __METHOD__ + ); + } + // update the tag_summary row $prevTags = array(); if ( !self::updateTagSummaryRow( $tagsToAdd, $tagsToRemove, $rc_id, $rev_id,