Revision: 46086
Author: aaron
Date: 2009-01-23 18:47:34 +0000 (Fri, 23 Jan 2009)
Log Message:
-----------
(bug 17120) Watchlist data should be filtered by activity
Modified Paths:
--------------
trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php
trunk/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php
Modified: trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php
===================================================================
--- trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php
2009-01-23 18:26:39 UTC (rev 46085)
+++ trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php
2009-01-23 18:47:34 UTC (rev 46086)
@@ -261,6 +261,8 @@
$this->size = $size ? $size : NULL;
$this->watched = (bool)$watched;
parent::__construct();
+ // Don't get to expensive
+ $this->mLimit = min( $this->mLimit, 500 );
}
function formatRow( $row ) {
Modified: trunk/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php
===================================================================
--- trunk/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php
2009-01-23 18:26:39 UTC (rev 46085)
+++ trunk/extensions/FlaggedRevs/specialpages/UnreviewedPages_body.php
2009-01-23 18:47:34 UTC (rev 46086)
@@ -109,22 +109,29 @@
public static function usersWatching( $title ) {
global $wgMiserMode;
$dbr = wfGetDB( DB_SLAVE );
+ $count = -1;
if( $wgMiserMode ) {
# Get a rough idea of size
$count = $dbr->estimateRowCount( 'watchlist', '*',
array( 'wl_namespace' =>
$title->getNamespace(), 'wl_title' => $title->getDBKey() ),
__METHOD__ );
- # If it is small, just COUNT() it, otherwise, stick
with estimate...
- if( $count <= 10 ) {
- $count = $dbr->selectField( 'watchlist',
'COUNT(*)',
- array( 'wl_namespace' =>
$title->getNamespace(), 'wl_title' => $title->getDBKey() ),
- __METHOD__ );
- }
- } else {
- $count = $dbr->selectField( 'watchlist', 'COUNT(*)',
- array( 'wl_namespace' =>
$title->getNamespace(), 'wl_title' => $title->getDBKey() ),
- __METHOD__ );
}
+ # If it is small, just COUNT() it, otherwise, stick with
estimate...
+ if( $count == -1 || $count <= 10 ) {
+ global $wgCookieExpiration;
+ # Get number of active editors watchling this
+ $cutoff = $dbr->timestamp( wfTimestamp( TS_UNIX ) -
3*$wgCookieExpiration );
+ $res = $dbr->select( array('watchlist','user'), '1',
+ array( 'wl_namespace' =>
$title->getNamespace(),
+ 'wl_title' => $title->getDBKey(),
+ 'wl_user = user_id',
+ // logged in or out
+ 'user_touched > '.$dbr->addQuotes(
$cutoff ) ),
+ __METHOD__,
+ array( 'USE INDEX' => array('watchlist' =>
'namespace_title') )
+ );
+ $count = $dbr->numRows($res);
+ }
return $count;
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs