Index: branches/REL1_4/phase3/includes/Article.php |
— | — | @@ -1897,8 +1897,10 @@ |
1898 | 1898 | |
1899 | 1899 | wfSeedRandom(); |
1900 | 1900 | if ( 0 == mt_rand( 0, 999 ) ) { |
| 1901 | + # Periodically flush old entries from the recentchanges table. |
| 1902 | + global $wgRCMaxAge; |
1901 | 1903 | $dbw =& wfGetDB( DB_MASTER ); |
1902 | | - $cutoff = $dbw->timestamp( time() - ( 7 * 86400 ) ); |
| 1904 | + $cutoff = $dbw->timestamp( time() - $wgRCMaxAge ); |
1903 | 1905 | $sql = "DELETE FROM recentchanges WHERE rc_timestamp < '{$cutoff}'"; |
1904 | 1906 | $dbw->query( $sql ); |
1905 | 1907 | } |
Index: branches/REL1_4/phase3/includes/RecentChange.php |
— | — | @@ -125,16 +125,22 @@ |
126 | 126 | $now = $this->mAttribs['rc_timestamp']; |
127 | 127 | $curId = $this->mAttribs['rc_cur_id']; |
128 | 128 | |
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 | + } |
139 | 145 | |
140 | 146 | # Update rc_cur_time |
141 | 147 | $dbw->update( 'recentchanges', array( 'rc_cur_time' => $now ), |
Index: branches/REL1_4/phase3/includes/DefaultSettings.php |
— | — | @@ -648,6 +648,10 @@ |
649 | 649 | # Log IP addresses in the recentchanges table |
650 | 650 | $wgPutIPinRC = false; |
651 | 651 | |
| 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 | + |
652 | 656 | # RDF metadata toggles |
653 | 657 | $wgEnableDublinCoreRdf = false; |
654 | 658 | $wgEnableCreativeCommonsRdf = false; |
Index: branches/REL1_4/phase3/RELEASE-NOTES |
— | — | @@ -255,6 +255,7 @@ |
256 | 256 | * Suppress notice error on bogus timestamp input (returns epoch as before) |
257 | 257 | * Remove unnecessary initialization and double-caching of parser variables |
258 | 258 | * Call-tree output mode for profiling |
| 259 | +* (bug 730) configurable $wgRCMaxAge; don't try to update purged RC entries |
259 | 260 | |
260 | 261 | === Caveats === |
261 | 262 | |