Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F4796
14200.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Authored By
•
bzimport
Nov 21 2014, 10:08 PM
2014-11-21 22:08:06 (UTC+0)
Size
4 KB
Referenced Files
None
Subscribers
None
14200.patch
View Options
Index: includes/api/ApiQueryRecentChanges.php
===================================================================
--- includes/api/ApiQueryRecentChanges.php (revision 44781)
+++ includes/api/ApiQueryRecentChanges.php (working copy)
@@ -93,7 +93,7 @@
*/
$db = $this->getDB();
$this->addTables('recentchanges');
- $this->addOption('USE INDEX', array('recentchanges' => 'rc_timestamp'));
+ $index = 'rc_timestamp'; // May change
$this->addWhereRange('rc_timestamp', $params['dir'], $params['start'], $params['end']);
$this->addWhereFld('rc_namespace', $params['namespace']);
$this->addWhereFld('rc_deleted', 0);
@@ -151,8 +151,21 @@
// Don't throw log entries out the window here
$this->addWhereIf('page_is_redirect = 0 OR page_is_redirect IS NULL', isset ($show['!redirect']));
}
+
+ if(!is_null($params['user']) && !is_null($param['excludeuser']))
+ $this->dieUsage('user and excludeuser cannot be used together', 'user-excludeuser');
+ if(!is_null($params['user']))
+ {
+ $this->addWhereFld('rc_user_text', $params['user']);
+ $index = 'rc_user_text';
+ }
+ if(!is_null($params['excludeuser']))
+ // We don't use the rc_user_text index here because
+ // * it would require us to sort by rc_user_text before rc_timestamp
+ // * the != condition doesn't throw out too many rows anyway
+ $this->addWhere('rc_user_text != ' . $this->getDB()->addQuotes($params['excludeuser']));
- /* Add the fields we're concerned with to out query. */
+ /* Add the fields we're concerned with to our query. */
$this->addFields(array (
'rc_timestamp',
'rc_namespace',
@@ -209,6 +222,7 @@
}
$this->token = $params['token'];
$this->addOption('LIMIT', $params['limit'] +1);
+ $this->addOption('USE INDEX', array('recentchanges' => $index));
$data = array ();
$count = 0;
@@ -392,6 +406,12 @@
'titles' => array(
ApiBase :: PARAM_ISMULTI => true
),
+ 'user' => array(
+ ApiBase :: PARAM_TYPE => 'user'
+ ),
+ 'excludeuser' => array(
+ ApiBase :: PARAM_TYPE => 'user'
+ ),
'prop' => array (
ApiBase :: PARAM_ISMULTI => true,
ApiBase :: PARAM_DFLT => 'title|timestamp|ids',
@@ -452,6 +472,8 @@
'dir' => 'In which direction to enumerate.',
'namespace' => 'Filter log entries to only this namespace(s)',
'titles' => 'Filter log entries to only these page titles',
+ 'user' => 'Only list changes by this user',
+ 'excludeuser' => 'Don\'t list changes by this user',
'prop' => 'Include additional pieces of information',
'token' => 'Which tokens to obtain for each change',
'show' => array (
Index: includes/api/ApiQueryWatchlist.php
===================================================================
--- includes/api/ApiQueryWatchlist.php (revision 44781)
+++ includes/api/ApiQueryWatchlist.php (working copy)
@@ -161,6 +161,13 @@
$this->addWhereIf('rc_patrolled = 0', isset($show['!patrolled']));
$this->addWhereIf('rc_patrolled != 0', isset($show['patrolled']));
}
+
+ if(!is_null($params['user']) && !is_null($params['excludeuser']))
+ $this->dieUsage('user and excludeuser cannot be used together', 'user-excludeuser');
+ if(!is_null($params['user']))
+ $this->addWhereFld('rc_user_text', $params['user']);
+ if(!is_null($params['excludeuser']))
+ $this->addWhere('rc_user_text != ' . $this->getDB()->addQuotes($params['excludeuser']));
# This is an index optimization for mysql, as done in the Special:Watchlist page
@@ -263,6 +270,12 @@
ApiBase :: PARAM_ISMULTI => true,
ApiBase :: PARAM_TYPE => 'namespace'
),
+ 'user' => array(
+ ApiBase :: PARAM_TYPE => 'user',
+ ),
+ 'excludeuser' => array(
+ ApiBase :: PARAM_TYPE => 'user',
+ ),
'dir' => array (
ApiBase :: PARAM_DFLT => 'older',
ApiBase :: PARAM_TYPE => array (
@@ -313,6 +326,8 @@
'start' => 'The timestamp to start enumerating from.',
'end' => 'The timestamp to end enumerating.',
'namespace' => 'Filter changes to only the given namespace(s).',
+ 'user' => 'Only list changes by this user',
+ 'excludeuser' => 'Don\'t list changes by this user',
'dir' => 'In which direction to enumerate pages.',
'limit' => 'How many total results to return per request.',
'prop' => 'Which additional items to get (non-generator mode only).',
Index: RELEASE-NOTES
===================================================================
--- RELEASE-NOTES (revision 44783)
+++ RELEASE-NOTES (working copy)
@@ -534,6 +534,8 @@
* New siprop parameter of 'extensions' to list all installed extensions
* (bug 16672) Include canonical namespace name in
meta=siteinfo&siprop=namespaces.
+* (bug 16527) Added user and excludeuser parameters to list=watchlist and
+ list=recentchanges
=== Languages updated in 1.14 ===
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4361
Default Alt Text
14200.patch (4 KB)
Attached To
Mode
T16200: Add rcuser= and rcexcludeuser= à la prop=revisions
Attached
Detach File
Event Timeline
Log In to Comment