r69132 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69131‎ | r69132 | r69133 >
Date:06:59, 7 July 2010
Author:aaron
Status:ok
Tags:
Comment:
Follow up r69082:
* Improved FRDependencyUpdate query wrt lag
* Made FRSquidUpdate traverse imagelinks too
Modified paths:
  • /trunk/extensions/FlaggedRevs/FRCacheUpdate.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FRDependencyUpdate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FRCacheUpdate.php
@@ -196,6 +196,8 @@
197197 # Invalidate caches of articles which include this page
198198 $update = new HTMLCacheUpdate( $this->title, 'templatelinks' );
199199 $update->doUpdate();
 200+ $update = new HTMLCacheUpdate( $this->title, 'imagelinks' );
 201+ $update->doUpdate();
200202 }
201203 }
202204 }
Index: trunk/extensions/FlaggedRevs/FRDependencyUpdate.php
@@ -59,25 +59,31 @@
6060 }
6161 # Get any dependency tracking changes
6262 $existing = $this->getExistingDeps();
63 - $insertions = $this->getDepInsertions( $existing, $deps );
64 - $deletions = $this->getDepDeletions( $existing, $deps );
65 - # Delete removed links
66 - if ( $deletions ) {
67 - $this->dbw->delete( 'flaggedrevs_tracking', $deletions, __METHOD__ );
 63+ # Do incremental updates...
 64+ if ( $existing != $deps ) {
 65+ $existing = $this->getExistingDeps( FR_MASTER );
 66+ $insertions = $this->getDepInsertions( $existing, $deps );
 67+ $deletions = $this->getDepDeletions( $existing, $deps );
 68+ # Delete removed links
 69+ if ( $deletions ) {
 70+ $this->dbw->delete( 'flaggedrevs_tracking', $deletions, __METHOD__ );
 71+ }
 72+ # Add any new links
 73+ if ( $insertions ) {
 74+ $this->dbw->insert( 'flaggedrevs_tracking', $insertions, __METHOD__, 'IGNORE' );
 75+ }
6876 }
69 - # Add any new links
70 - if ( $insertions ) {
71 - $this->dbw->insert( 'flaggedrevs_tracking', $insertions, __METHOD__, 'IGNORE' );
72 - }
7377 }
7478
7579 /*
7680 * Get existing cache dependancies
 81+ * @param int $flags FR_MASTER
7782 * @return array (ns => dbKey => 1)
7883 */
79 - protected function getExistingDeps() {
80 - $dbr = wfGetDB( DB_SLAVE );
81 - $res = $dbr->select( 'flaggedrevs_tracking',
 84+ protected function getExistingDeps( $flags = 0 ) {
 85+ $db = ( $flags & FR_MASTER ) ?
 86+ wfGetDB( DB_MASTER ) : wfGetDB( DB_SLAVE );
 87+ $res = $db->select( 'flaggedrevs_tracking',
8288 array( 'ftr_namespace', 'ftr_title' ),
8389 array( 'ftr_from' => $this->title->getArticleId() ),
8490 __METHOD__

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r69082* Split off inclusion handling code into FRInclusionManager class. $wgParser-...aaron05:47, 6 July 2010

Status & tagging log