r44438 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44437‎ | r44438 | r44439 >
Date:00:42, 11 December 2008
Author:brion
Status:ok
Tags:
Comment:
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.
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -369,7 +369,6 @@
370370 $lc->addGoodLinkObj( $data->page_id, $this->mTitle, $data->page_len, $data->page_is_redirect );
371371
372372 $this->mTitle->mArticleID = $data->page_id;
373 - $this->mTitle->mTouched = wfTimestamp( TS_MW, $data->page_touched );
374373
375374 # Old-fashioned restrictions
376375 $this->mTitle->loadRestrictions( $data->page_restrictions );
Index: trunk/phase3/includes/Title.php
@@ -69,7 +69,6 @@
7070 var $mLength = -1; ///< The page length, 0 for special pages
7171 var $mRedirect = null; ///< Is the article at this title a redirect?
7272 var $mNotificationTimestamp = array(); ///< Associative array of user ID -> timestamp/false
73 - var $mTouched = null; // <last cache date>
7473 //@}
7574
7675
@@ -3136,15 +3135,13 @@
31373136
31383137 /**
31393138 * Get the last touched timestamp
 3139+ * @param Database $db, optional db
31403140 * @return \type{\string} Last touched timestamp
31413141 */
3142 - public function getTouched() {
3143 - if( !is_null($this->mTouched) ) {
3144 - return wfTimestamp( TS_MW, $this->mTouched );
3145 - }
3146 - $dbr = wfGetDB( DB_SLAVE );
3147 - $this->mTouched = $dbr->selectField( 'page', 'page_touched', $this->pageCond(), __METHOD__ );
3148 - return $this->mTouched;
 3142+ public function getTouched( $db = NULL ) {
 3143+ $db = isset($db) ? $db : wfGetDB( DB_SLAVE );
 3144+ $touched = $db->selectField( 'page', 'page_touched', $this->pageCond(), __METHOD__ );
 3145+ return $touched;
31493146 }
31503147
31513148 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r44365Cleanup Title::getTouched()aaron22:03, 9 December 2008

Status & tagging log