X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryRandom.php;h=ddf5841b71667c829fb6192a1f33e1a81079c378;hb=0220b4375c25775c4b0611becd53b78be158cfb9;hp=bcef77a57823510691ac2da9567612ef430bb52a;hpb=921619b1199aa45faffe41fe6030ad89bfdd14a8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryRandom.php b/includes/api/ApiQueryRandom.php index bcef77a578..ddf5841b71 100644 --- a/includes/api/ApiQueryRandom.php +++ b/includes/api/ApiQueryRandom.php @@ -1,9 +1,9 @@ run( $resultPageSet ); } + /** + * @param $randstr + * @param $limit + * @param $namespace + * @param $resultPageSet ApiPageSet + * @param $redirect + * @return void + */ protected function prepareQuery( $randstr, $limit, $namespace, &$resultPageSet, $redirect ) { $this->resetQueryParams(); $this->addTables( 'page' ); @@ -63,8 +68,11 @@ if ( !defined( 'MEDIAWIKI' ) ) { } } - protected function runQuery( &$resultPageSet ) { - $db = $this->getDB(); + /** + * @param $resultPageSet ApiPageSet + * @return int + */ + protected function runQuery( $resultPageSet = null ) { $res = $this->select( __METHOD__ ); $count = 0; foreach ( $res as $row ) { @@ -91,6 +99,10 @@ if ( !defined( 'MEDIAWIKI' ) ) { return $count; } + /** + * @param $resultPageSet ApiPageSet + * @return void + */ public function run( $resultPageSet = null ) { $params = $this->extractRequestParams(); $result = $this->getResult(); @@ -120,6 +132,10 @@ if ( !defined( 'MEDIAWIKI' ) ) { return $vals; } + public function getCacheMode( $params ) { + return 'public'; + } + public function getAllowedParams() { return array( 'namespace' => array( @@ -145,6 +161,16 @@ if ( !defined( 'MEDIAWIKI' ) ) { ); } + public function getResultProperties() { + return array( + '' => array( + 'id' => 'integer', + 'ns' => 'namespace', + 'title' => 'string' + ) + ); + } + public function getDescription() { return array( 'Get a set of random pages', @@ -154,11 +180,11 @@ if ( !defined( 'MEDIAWIKI' ) ) { ); } - protected function getExamples() { + public function getExamples() { return 'api.php?action=query&list=random&rnnamespace=0&rnlimit=2'; } public function getVersion() { return __CLASS__ . ': $Id: ApiQueryRandom.php overlordq$'; } -} \ No newline at end of file +}