r7169 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r7168‎ | r7169 | r7170 >
Date:03:53, 19 January 2005
Author:vibber
Status:old
Tags:
Comment:
* (bug 730) configurable $wgRCMaxAge; don't try to update purged RC entries
Modified paths:
  • /branches/REL1_4/phase3/RELEASE-NOTES (modified) (history)
  • /branches/REL1_4/phase3/includes/Article.php (modified) (history)
  • /branches/REL1_4/phase3/includes/DefaultSettings.php (modified) (history)
  • /branches/REL1_4/phase3/includes/RecentChange.php (modified) (history)

Diff [purge]

Index: branches/REL1_4/phase3/includes/Article.php
@@ -1897,8 +1897,10 @@
18981898
18991899 wfSeedRandom();
19001900 if ( 0 == mt_rand( 0, 999 ) ) {
 1901+ # Periodically flush old entries from the recentchanges table.
 1902+ global $wgRCMaxAge;
19011903 $dbw =& wfGetDB( DB_MASTER );
1902 - $cutoff = $dbw->timestamp( time() - ( 7 * 86400 ) );
 1904+ $cutoff = $dbw->timestamp( time() - $wgRCMaxAge );
19031905 $sql = "DELETE FROM recentchanges WHERE rc_timestamp < '{$cutoff}'";
19041906 $dbw->query( $sql );
19051907 }
Index: branches/REL1_4/phase3/includes/RecentChange.php
@@ -125,16 +125,22 @@
126126 $now = $this->mAttribs['rc_timestamp'];
127127 $curId = $this->mAttribs['rc_cur_id'];
128128
129 - # Update rc_this_oldid for the entries which were current
130 - $dbw->update( 'recentchanges',
131 - array( /* SET */
132 - 'rc_this_oldid' => $oldid
133 - ), array( /* WHERE */
134 - 'rc_namespace' => $ns,
135 - 'rc_title' => $title,
136 - 'rc_timestamp' => $dbw->timestamp($lastTime)
137 - ), $fname
138 - );
 129+ # Don't bother looking for entries that have probably
 130+ # been purged, it just locks up the indexes needlessly.
 131+ global $wgRCMaxAge;
 132+ $age = time() - wfTimestamp( TS_UNIX, $lastTime );
 133+ if( $age < $wgRCMaxAge ) {
 134+ # Update rc_this_oldid for the entries which were current
 135+ $dbw->update( 'recentchanges',
 136+ array( /* SET */
 137+ 'rc_this_oldid' => $oldid
 138+ ), array( /* WHERE */
 139+ 'rc_namespace' => $ns,
 140+ 'rc_title' => $title,
 141+ 'rc_timestamp' => $dbw->timestamp( $lastTime )
 142+ ), $fname
 143+ );
 144+ }
139145
140146 # Update rc_cur_time
141147 $dbw->update( 'recentchanges', array( 'rc_cur_time' => $now ),
Index: branches/REL1_4/phase3/includes/DefaultSettings.php
@@ -648,6 +648,10 @@
649649 # Log IP addresses in the recentchanges table
650650 $wgPutIPinRC = false;
651651
 652+# Recentchanges items are periodically purged;
 653+# entries older than this many seconds will go.
 654+$wgRCMaxAge = 7 * 24 * 3600; # our one week cutoff
 655+
652656 # RDF metadata toggles
653657 $wgEnableDublinCoreRdf = false;
654658 $wgEnableCreativeCommonsRdf = false;
Index: branches/REL1_4/phase3/RELEASE-NOTES
@@ -255,6 +255,7 @@
256256 * Suppress notice error on bogus timestamp input (returns epoch as before)
257257 * Remove unnecessary initialization and double-caching of parser variables
258258 * Call-tree output mode for profiling
 259+* (bug 730) configurable $wgRCMaxAge; don't try to update purged RC entries
259260
260261 === Caveats ===
261262

Follow-up revisions

RevisionCommit summaryAuthorDate
r7170* (bug 730) configurable $wgRCMaxAge; don't try to update purged RC entriesvibber03:54, 19 January 2005

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r6659(bug 730) Hack at Jamesday's request to avoid trying to update old recentchan...vibber21:15, 12 December 2004

Status & tagging log