Patch from MaxSem re bug 15162 - handle throttling in the login API
[lhc/web/wiklou.git] / includes / api / ApiQueryWatchlist.php
index 12ac7a1..17467e0 100644 (file)
@@ -31,8 +31,8 @@ if (!defined('MEDIAWIKI')) {
 /**
  * This query action allows clients to retrieve a list of recently modified pages
  * that are part of the logged-in user's watchlist.
- * 
- * @addtogroup API
+ *
+ * @ingroup API
  */
 class ApiQueryWatchlist extends ApiQueryGeneratorBase {
 
@@ -50,7 +50,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
 
        private $fld_ids = false, $fld_title = false, $fld_patrol = false, $fld_flags = false,
                        $fld_timestamp = false, $fld_user = false, $fld_comment = false, $fld_sizes = false;
-       
+
        private function run($resultPageSet = null) {
                global $wgUser, $wgDBtype;
 
@@ -122,7 +122,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                        'recentchanges'
                ));
 
-               $userId = $wgUser->getID();
+               $userId = $wgUser->getId();
                $this->addWhere(array (
                        'wl_namespace = rc_namespace',
                        'wl_title = rc_title',
@@ -134,15 +134,15 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                $this->addWhereRange('rc_timestamp', $dir, $start, $end);
                $this->addWhereFld('wl_namespace', $namespace);
                $this->addWhereIf('rc_this_oldid=page_latest', !$allrev);
-               
+
                if (!is_null($show)) {
                        $show = array_flip($show);
 
                        /* Check for conflicting parameters. */
-                       if ((isset ($show['minor']) && isset ($show['!minor'])) 
-                                       || (isset ($show['bot']) && isset ($show['!bot'])) 
+                       if ((isset ($show['minor']) && isset ($show['!minor']))
+                                       || (isset ($show['bot']) && isset ($show['!bot']))
                                        || (isset ($show['anon']) && isset ($show['!anon']))) {
-                                               
+
                                $this->dieUsage("Incorrect parameter - mutually exclusive values may not be supplied", 'show');
                        }
 
@@ -155,7 +155,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                        $this->addWhereIf('rc_user != 0', isset ($show['!anon']));
                }
 
-               
+
                # This is an index optimization for mysql, as done in the Special:Watchlist page
                $this->addWhereIf("rc_timestamp > ''", !isset ($start) && !isset ($end) && $wgDBtype == 'mysql');
 
@@ -205,9 +205,9 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
 
                if ($this->fld_ids) {
                        $vals['pageid'] = intval($row->rc_cur_id);
-                       $vals['revid'] = intval($row->rc_this_oldid); 
+                       $vals['revid'] = intval($row->rc_this_oldid);
                }
-               
+
                if ($this->fld_title)
                        ApiQueryBase :: addTitleInfo($vals, Title :: makeTitle($row->rc_namespace, $row->rc_title));
 
@@ -243,7 +243,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                return $vals;
        }
 
-       protected function getAllowedParams() {
+       public function getAllowedParams() {
                return array (
                        'allrev' => false,
                        'start' => array (
@@ -298,14 +298,14 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                );
        }
 
-       protected function getParamDescription() {
+       public function getParamDescription() {
                return array (
                        'allrev' => 'Include multiple revisions of the same page within given timeframe.',
                        'start' => 'The timestamp to start enumerating from.',
                        'end' => 'The timestamp to end enumerating.',
                        'namespace' => 'Filter changes to only the given namespace(s).',
                        'dir' => 'In which direction to enumerate pages.',
-                       'limit' => 'How many total pages to return per request.',
+                       'limit' => 'How many total results to return per request.',
                        'prop' => 'Which additional items to get (non-generator mode only).',
                        'show' => array (
                                'Show only items that meet this criteria.',
@@ -314,8 +314,8 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                );
        }
 
-       protected function getDescription() {
-               return '';
+       public function getDescription() {
+               return "Get all recent changes to pages in the logged in user's watchlist";
        }
 
        protected function getExamples() {
@@ -332,4 +332,3 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                return __CLASS__ . ': $Id$';
        }
 }
-