From 4708404fe8bb4979f859ce336e4bde220ee9ef01 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Sat, 8 Oct 2005 19:24:47 +0000 Subject: [PATCH] * Added a new hook which allows an extension to control whether or not the recentchanges table gets purged, default behaviour: same as before --- includes/Article.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 9aa9092e86..f4de39eb06 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -2133,20 +2133,21 @@ class Article { global $wgDeferredUpdateList, $wgDBname, $wgMemc; global $wgMessageCache, $wgUser, $wgUseEnotif; - wfSeedRandom(); - if ( 0 == mt_rand( 0, 999 ) ) { - # Periodically flush old entries from the recentchanges table. - global $wgRCMaxAge; - $dbw =& wfGetDB( DB_MASTER ); - $cutoff = $dbw->timestamp( time() - $wgRCMaxAge ); - $recentchanges = $dbw->tableName( 'recentchanges' ); - $sql = "DELETE FROM $recentchanges WHERE rc_timestamp < '{$cutoff}'"; - //$dbw->query( $sql ); // HACK: disabled for now, slowness - - // re-enabled for commit of unrelated live changes -- TS - $dbw->query( $sql ); - } + if ( wfRunHooks( 'ArticleEditUpdatesDeleteFromRecentchanges', &$this ) ) { + wfSeedRandom(); + if ( 0 == mt_rand( 0, 999 ) ) { + # Periodically flush old entries from the recentchanges table. + global $wgRCMaxAge; + + $dbw =& wfGetDB( DB_MASTER ); + $cutoff = $dbw->timestamp( time() - $wgRCMaxAge ); + $recentchanges = $dbw->tableName( 'recentchanges' ); + $sql = "DELETE FROM $recentchanges WHERE rc_timestamp < '{$cutoff}'"; + $dbw->query( $sql ); + } + } + $id = $this->getID(); $title = $this->mTitle->getPrefixedDBkey(); $shortTitle = $this->mTitle->getDBkey(); -- 2.20.1