From 992e83c6255b2bec6d8cc70b88f0c236b08dcd15 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 11 Dec 2008 00:42:50 +0000 Subject: [PATCH] Revert r44365 "Cleanup Title::getTouched()" Rather than a cleanup, this rev seems to be adding a per-Title-object cache of page_touched. I'm a little leery of adding extra caches like this, particularly since it's not clear that it'll get consistently updated. --- includes/Article.php | 1 - includes/Title.php | 13 +++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 22e1514ef5..15ca8c533d 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -369,7 +369,6 @@ class Article { $lc->addGoodLinkObj( $data->page_id, $this->mTitle, $data->page_len, $data->page_is_redirect ); $this->mTitle->mArticleID = $data->page_id; - $this->mTitle->mTouched = wfTimestamp( TS_MW, $data->page_touched ); # Old-fashioned restrictions $this->mTitle->loadRestrictions( $data->page_restrictions ); diff --git a/includes/Title.php b/includes/Title.php index 2c1c01c796..9e52e5aa99 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -69,7 +69,6 @@ class Title { var $mLength = -1; ///< The page length, 0 for special pages var $mRedirect = null; ///< Is the article at this title a redirect? var $mNotificationTimestamp = array(); ///< Associative array of user ID -> timestamp/false - var $mTouched = null; // //@} @@ -3136,15 +3135,13 @@ class Title { /** * Get the last touched timestamp + * @param Database $db, optional db * @return \type{\string} Last touched timestamp */ - public function getTouched() { - if( !is_null($this->mTouched) ) { - return wfTimestamp( TS_MW, $this->mTouched ); - } - $dbr = wfGetDB( DB_SLAVE ); - $this->mTouched = $dbr->selectField( 'page', 'page_touched', $this->pageCond(), __METHOD__ ); - return $this->mTouched; + public function getTouched( $db = NULL ) { + $db = isset($db) ? $db : wfGetDB( DB_SLAVE ); + $touched = $db->selectField( 'page', 'page_touched', $this->pageCond(), __METHOD__ ); + return $touched; } /** -- 2.20.1