r44716 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44715‎ | r44716 | r44717 >
Date:14:50, 17 December 2008
Author:catrope
Status:reverted (Comments)
Tags:
Comment:
API: (bug 16527) Added user and excludeuser parameters to list=watchlist,recentchanges
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryRecentChanges.php (modified) (history)
  • /trunk/phase3/includes/api/ApiQueryWatchlist.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryRecentChanges.php
@@ -84,7 +84,7 @@
8585 */
8686 public function execute() {
8787 /* Initialize vars */
88 - $limit = $prop = $namespace = $titles = $show = $type = $dir = $start = $end = $token = null;
 88+ $limit = $prop = $namespace = $titles = $user = $excludeuser = $show = $type = $dir = $start = $end = $token = null;
8989
9090 /* Get the parameters of the request. */
9191 extract($this->extractRequestParams());
@@ -154,8 +154,15 @@
155155 // Don't throw log entries out the window here
156156 $this->addWhereIf('page_is_redirect = 0 OR page_is_redirect IS NULL', isset ($show['!redirect']));
157157 }
 158+
 159+ if(!is_null($user) && !is_null($excludeuser))
 160+ $this->dieUsage('user and excludeuser cannot be used together', 'badparams');
 161+ if(!is_null($user))
 162+ $this->addWhereFld('rc_user_text', $user);
 163+ if(!is_null($excludeuser))
 164+ $this->addWhere('rc_user_text != ' . $this->getDB()->addQuotes($excludeuser));
158165
159 - /* Add the fields we're concerned with to out query. */
 166+ /* Add the fields we're concerned with to our query. */
160167 $this->addFields(array (
161168 'rc_timestamp',
162169 'rc_namespace',
@@ -397,6 +404,12 @@
398405 'titles' => array(
399406 ApiBase :: PARAM_ISMULTI => true
400407 ),
 408+ 'user' => array(
 409+ ApiBase :: PARAM_TYPE => 'user'
 410+ ),
 411+ 'excludeuser' => array(
 412+ ApiBase :: PARAM_TYPE => 'user'
 413+ ),
401414 'prop' => array (
402415 ApiBase :: PARAM_ISMULTI => true,
403416 ApiBase :: PARAM_DFLT => 'title|timestamp|ids',
@@ -457,6 +470,8 @@
458471 'dir' => 'In which direction to enumerate.',
459472 'namespace' => 'Filter log entries to only this namespace(s)',
460473 'titles' => 'Filter log entries to only these page titles',
 474+ 'user' => 'Only list changes by this user',
 475+ 'excludeuser' => 'Don\'t list changes by this user',
461476 'prop' => 'Include additional pieces of information',
462477 'token' => 'Which tokens to obtain for each change',
463478 'show' => array (
Index: trunk/phase3/includes/api/ApiQueryWatchlist.php
@@ -59,7 +59,7 @@
6060 if (!$wgUser->isLoggedIn())
6161 $this->dieUsage('You must be logged-in to have a watchlist', 'notloggedin');
6262
63 - $allrev = $start = $end = $namespace = $dir = $limit = $prop = $show = null;
 63+ $allrev = $start = $end = $namespace = $user = $excludeuser = $dir = $limit = $prop = $show = null;
6464 extract($this->extractRequestParams());
6565
6666 if (!is_null($prop) && is_null($resultPageSet)) {
@@ -162,6 +162,13 @@
163163 $this->addWhereIf('rc_patrolled = 0', isset($show['!patrolled']));
164164 $this->addWhereIf('rc_patrolled != 0', isset($show['patrolled']));
165165 }
 166+
 167+ if(!is_null($user) && !is_null($excludeuser))
 168+ $this->dieUsage('user and excludeuser cannot be used together', 'badparams');
 169+ if(!is_null($user))
 170+ $this->addWhereFld('rc_user_text', $user);
 171+ if(!is_null($excludeuser))
 172+ $this->addWhere('rc_user_text != ' . $this->getDB()->addQuotes($excludeuser));
166173
167174
168175 # This is an index optimization for mysql, as done in the Special:Watchlist page
@@ -264,6 +271,12 @@
265272 ApiBase :: PARAM_ISMULTI => true,
266273 ApiBase :: PARAM_TYPE => 'namespace'
267274 ),
 275+ 'user' => array(
 276+ ApiBase :: PARAM_TYPE => 'user',
 277+ ),
 278+ 'excludeuser' => array(
 279+ ApiBase :: PARAM_TYPE => 'user',
 280+ ),
268281 'dir' => array (
269282 ApiBase :: PARAM_DFLT => 'older',
270283 ApiBase :: PARAM_TYPE => array (
@@ -314,6 +327,8 @@
315328 'start' => 'The timestamp to start enumerating from.',
316329 'end' => 'The timestamp to end enumerating.',
317330 'namespace' => 'Filter changes to only the given namespace(s).',
 331+ 'user' => 'Only list changes by this user',
 332+ 'excludeuser' => 'Don\'t list changes by this user',
318333 'dir' => 'In which direction to enumerate pages.',
319334 'limit' => 'How many total results to return per request.',
320335 'prop' => 'Which additional items to get (non-generator mode only).',
Index: trunk/phase3/RELEASE-NOTES
@@ -530,7 +530,10 @@
531531 * (bug 16647) list=allcategories, prop=categories don't return "hidden"
532532 property for hidden categories
533533 * New siprop parameter of 'extensions' to list all installed extensions
534 -* (bug 16672) Include canonical namespace name in meta=siteinfo&siprop=namespaces.
 534+* (bug 16672) Include canonical namespace name in
 535+ meta=siteinfo&siprop=namespaces.
 536+* (bug 16527) Added user and excludeuser parameters to list=watchlist and
 537+ list=recentchanges
535538
536539 === Languages updated in 1.14 ===
537540

Follow-up revisions

RevisionCommit summaryAuthorDate
r44718Revert r44716 (added user,excludeuser to watchlist,recentchanges): can't comm...catrope15:35, 17 December 2008

Comments

#Comment by Brion VIBBER (talk | contribs)   18:20, 23 December 2008

Reverted in r44718, pending index update on Wikimedia servers (bug 14200).

Status & tagging log