| Index: trunk/phase3/includes/Article.php |
| — | — | @@ -1815,8 +1815,10 @@ |
| 1816 | 1816 | |
| 1817 | 1817 | wfSeedRandom(); |
| 1818 | 1818 | if ( 0 == mt_rand( 0, 999 ) ) { |
| | 1819 | + # Periodically flush old entries from the recentchanges table. |
| | 1820 | + global $wgRCMaxAge; |
| 1819 | 1821 | $dbw =& wfGetDB( DB_MASTER ); |
| 1820 | | - $cutoff = $dbw->timestamp( time() - ( 7 * 86400 ) ); |
| | 1822 | + $cutoff = $dbw->timestamp( time() - $wgRCMaxAge ); |
| 1821 | 1823 | $sql = "DELETE FROM recentchanges WHERE rc_timestamp < '{$cutoff}'"; |
| 1822 | 1824 | $dbw->query( $sql ); |
| 1823 | 1825 | } |
| Index: trunk/phase3/includes/RecentChange.php |
| — | — | @@ -131,16 +131,22 @@ |
| 132 | 132 | $now = $this->mAttribs['rc_timestamp']; |
| 133 | 133 | $curId = $this->mAttribs['rc_cur_id']; |
| 134 | 134 | |
| 135 | | - # Update rc_this_oldid for the entries which were current |
| 136 | | - $dbw->update( 'recentchanges', |
| 137 | | - array( /* SET */ |
| 138 | | - 'rc_this_oldid' => $oldid |
| 139 | | - ), array( /* WHERE */ |
| 140 | | - 'rc_namespace' => $ns, |
| 141 | | - 'rc_title' => $title, |
| 142 | | - 'rc_timestamp' => $dbw->timestamp($lastTime) |
| 143 | | - ), $fname |
| 144 | | - ); |
| | 135 | + # Don't bother looking for entries that have probably |
| | 136 | + # been purged, it just locks up the indexes needlessly. |
| | 137 | + global $wgRCMaxAge; |
| | 138 | + $age = time() - wfTimestamp( TS_UNIX, $lastTime ); |
| | 139 | + if( $age < $wgRCMaxAge ) { |
| | 140 | + # Update rc_this_oldid for the entries which were current |
| | 141 | + $dbw->update( 'recentchanges', |
| | 142 | + array( /* SET */ |
| | 143 | + 'rc_this_oldid' => $oldid |
| | 144 | + ), array( /* WHERE */ |
| | 145 | + 'rc_namespace' => $ns, |
| | 146 | + 'rc_title' => $title, |
| | 147 | + 'rc_timestamp' => $dbw->timestamp( $lastTime ) |
| | 148 | + ), $fname |
| | 149 | + ); |
| | 150 | + } |
| 145 | 151 | |
| 146 | 152 | # Update rc_cur_time |
| 147 | 153 | $dbw->update( 'recentchanges', array( 'rc_cur_time' => $now ), |
| Index: trunk/phase3/includes/DefaultSettings.php |
| — | — | @@ -721,6 +721,10 @@ |
| 722 | 722 | # Log IP addresses in the recentchanges table |
| 723 | 723 | $wgPutIPinRC = false; |
| 724 | 724 | |
| | 725 | +# Recentchanges items are periodically purged; |
| | 726 | +# entries older than this many seconds will go. |
| | 727 | +$wgRCMaxAge = 7 * 24 * 3600; # our one week cutoff |
| | 728 | + |
| 725 | 729 | # RDF metadata toggles |
| 726 | 730 | $wgEnableDublinCoreRdf = false; |
| 727 | 731 | $wgEnableCreativeCommonsRdf = false; |