r45808 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45807‎ | r45808 | r45809 >
Date:19:32, 16 January 2009
Author:werdna
Status:deferred
Tags:
Comment:
Add a courtesy lookup of rcid, if logid or revid are specified.
Modified paths:
  • /branches/change-tagging/phase3/includes/ChangeTags.php (modified) (history)

Diff [purge]

Index: branches/change-tagging/phase3/includes/ChangeTags.php
@@ -32,10 +32,20 @@
3333 throw new MWException( "At least one of: RCID, revision ID, and log ID MUST be specified when adding a tag to a change!" );
3434 }
3535
 36+ $dbr = wfGetDB( DB_SLAVE );
 37+
 38+ // Might as well look for rcids and so on.
 39+ if (!$rc_id) {
 40+ if ($log_id) {
 41+ $rc_id = $dbr->selectField( 'recentchanges', 'rc_id', array( 'rc_logid' => $log_id ), __METHOD__ );
 42+ } elseif ($rev_id) {
 43+ $rc_id = $dbr->selectField( 'recentchanges', 'rc_id', array( 'rc_this_oldid' => $rev_id ), __METHOD__ );
 44+ }
 45+ }
 46+
3647 $tsConds = array_filter( array( 'ts_rc_id' => $rc_id, 'ts_rev_id' => $rev_id, 'ts_log_id' => $log_id ) );
3748
3849 ## Update the summary row.
39 - $dbr = wfGetDB( DB_SLAVE );
4050 $prevTags = $dbr->selectField( 'tag_summary', 'ts_tags', $tsConds, __METHOD__ );
4151 $prevTags = $prevTags ? $prevTags : '';
4252 $prevTags = array_filter( explode( ',', $prevTags ) );
@@ -50,7 +60,7 @@
5161 }
5262
5363 $dbw = wfGetDB( DB_MASTER );
54 - $dbw->replace( 'tag_summary', array( 'ts_rev_id', 'ts_rc_id', 'ts_log_id' ), array( array_merge( $tsConds, array( 'ts_tags' => implode( ',', $newTags ) ) ) ), __METHOD__ );
 64+ $dbw->replace( 'tag_summary', array( 'ts_rev_id', 'ts_rc_id', 'ts_log_id' ), array_filter( array_merge( $tsConds, array( 'ts_tags' => implode( ',', $newTags ) ) ) ), __METHOD__ );
5565
5666 // Insert the tags rows.
5767 $tagsRows = array();

Status & tagging log