Call Linker methods statically
[lhc/web/wiklou.git] / includes / api / ApiQueryCategoryMembers.php
index 93918f7..c1871a5 100644 (file)
@@ -129,11 +129,11 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                                                'by the previous query', '_badcontinue'
                                        );
                                }
-                               
+
                                // Remove the types to skip from $queryTypes
                                $contTypeIndex = array_search( $cont[0], $queryTypes );
                                $queryTypes = array_slice( $queryTypes, $contTypeIndex );
-                               
+
                                // Add a WHERE clause for sortkey and from
                                // pack( "H*", $foo ) is used to convert hex back to binary
                                $escSortkey = $this->getDB()->addQuotes( pack( "H*", $cont[1] ) );
@@ -143,7 +143,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                                $contWhere = "cl_sortkey $op $escSortkey OR " .
                                        "(cl_sortkey = $escSortkey AND " .
                                        "cl_from $op= $from)";
-                               
+
                        } else {
                                // The below produces ORDER BY cl_sortkey, cl_from, possibly with DESC added to each of them
                                $this->addWhereRange( 'cl_sortkey',
@@ -189,6 +189,8 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                        $res = $this->select( __METHOD__ );
                        $rows = iterator_to_array( $res );
                }
+
+               $result = $this->getResult();
                $count = 0;
                foreach ( $rows as $row ) {
                        if ( ++ $count > $limit ) {
@@ -234,7 +236,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                                if ( $fld_timestamp ) {
                                        $vals['timestamp'] = wfTimestamp( TS_ISO_8601, $row->cl_timestamp );
                                }
-                               $fit = $this->getResult()->addValue( array( 'query', $this->getModuleName() ),
+                               $fit = $result->addValue( array( 'query', $this->getModuleName() ),
                                                null, $vals );
                                if ( !$fit ) {
                                        if ( $params['sort'] == 'timestamp' ) {
@@ -253,7 +255,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                }
 
                if ( is_null( $resultPageSet ) ) {
-                       $this->getResult()->setIndexedTagName_internal(
+                       $result->setIndexedTagName_internal(
                                         array( 'query', $this->getModuleName() ), 'cm' );
                }
        }
@@ -345,8 +347,8 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                        'dir' => 'In which direction to sort',
                        'start' => "Timestamp to start listing from. Can only be used with {$p}sort=timestamp",
                        'end' => "Timestamp to end listing at. Can only be used with {$p}sort=timestamp",
-                       'startsortkey' => "Sortkey to start listing from. Can only be used with {$p}sort=sortkey",
-                       'endsortkey' => "Sortkey to end listing at. Can only be used with {$p}sort=sortkey",
+                       'startsortkey' => "Sortkey to start listing from. Must be given in binary format. Can only be used with {$p}sort=sortkey",
+                       'endsortkey' => "Sortkey to end listing at. Must be given in binary format. Can only be used with {$p}sort=sortkey",
                        'continue' => 'For large categories, give the value retured from previous query',
                        'limit' => 'The maximum number of pages to return.',
                );
@@ -377,7 +379,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                );
        }
 
-       protected function getExamples() {
+       public function getExamples() {
                return array(
                        'Get first 10 pages in [[Category:Physics]]:',
                        '  api.php?action=query&list=categorymembers&cmtitle=Category:Physics',
@@ -386,6 +388,10 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getHelpUrls() {
+               return 'http://www.mediawiki.org/wiki/API:Categorymembers';
+       }
+
        public function getVersion() {
                return __CLASS__ . ': $Id$';
        }