From: Aaron Schulz Date: Tue, 9 Dec 2008 22:03:41 +0000 (+0000) Subject: Cleanup Title::getTouched() X-Git-Tag: 1.31.0-rc.0~44083 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=6c30ef8f0dfaa1914f9b84464ee0e979b1e986cb;p=lhc%2Fweb%2Fwiklou.git Cleanup Title::getTouched() --- diff --git a/includes/Article.php b/includes/Article.php index dcb58dbc73..bb1d7a0206 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -369,6 +369,7 @@ 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 9e52e5aa99..2c1c01c796 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -69,6 +69,7 @@ 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; // //@} @@ -3135,13 +3136,15 @@ class Title { /** * Get the last touched timestamp - * @param Database $db, optional db * @return \type{\string} Last touched timestamp */ - public function getTouched( $db = NULL ) { - $db = isset($db) ? $db : wfGetDB( DB_SLAVE ); - $touched = $db->selectField( 'page', 'page_touched', $this->pageCond(), __METHOD__ ); - return $touched; + 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; } /**