http://www.mediawiki.org/wiki/Special:Code/MediaWiki/72956
Revision: 72956
Author: nikerabbit
Date: 2010-09-14 07:32:08 +0000 (Tue, 14 Sep 2010)
Log Message:
-----------
Use only single query for determinging highest page_touched, which is not
loaded by link batch.
Every query is still executed twice, apparently for different modules, but why?
Modified Paths:
--------------
trunk/phase3/includes/ResourceLoaderModule.php
Modified: trunk/phase3/includes/ResourceLoaderModule.php
===================================================================
--- trunk/phase3/includes/ResourceLoaderModule.php 2010-09-14 07:26:48 UTC
(rev 72955)
+++ trunk/phase3/includes/ResourceLoaderModule.php 2010-09-14 07:32:08 UTC
(rev 72956)
@@ -747,14 +747,21 @@
// Do batch existence check
// TODO: This would work better if page_touched were loaded by
this as well
$lb = new LinkBatch( $titles );
+ $lb->setCaller( __METHOD__ );
$lb->execute();
$modifiedTime = 1; // wfTimestamp() interprets 0 as "now"
+
+ $ids = array();
foreach ( $titles as $title ) {
if ( $title->exists() ) {
- $modifiedTime = max( $modifiedTime,
wfTimestamp( TS_UNIX, $title->getTouched() ) );
+ $ids[] = $title->getArticleId();
}
}
- return $this->modifiedTime[$hash] = $modifiedTime;
+
+ $dbr = wfGetDB( DB_SLAVE );
+ $modifiedTime = $dbr->selectField( 'page', 'MAX(page_touched)',
array( 'page_id' => $ids ), __METHOD__ );
+
+ return $this->modifiedTime[$hash] = wfTimestamp( TS_UNIX,
$modifiedTime );
}
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs