X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryRandom.php;h=282f49865605ffde1f25238450f15727eb01df35;hb=239b0c772a3cf4dc2160e2c36c2813cd705adb50;hp=ad26ccef0efaac3c14ec23f93d3d64767176a1ac;hpb=a8319cfc5ee13c3d86deb34f19f660fa83e32292;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryRandom.php b/includes/api/ApiQueryRandom.php index ad26ccef0e..282f498656 100644 --- a/includes/api/ApiQueryRandom.php +++ b/includes/api/ApiQueryRandom.php @@ -33,7 +33,7 @@ class ApiQueryRandom extends ApiQueryGeneratorBase { private $pageIDs; - public function __construct( $query, $moduleName ) { + public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'rn' ); } @@ -46,11 +46,11 @@ class ApiQueryRandom extends ApiQueryGeneratorBase { } /** - * @param $randstr - * @param $limit - * @param $namespace - * @param $resultPageSet ApiPageSet - * @param $redirect + * @param string $randstr + * @param int $limit + * @param int $namespace + * @param ApiPageSet $resultPageSet + * @param bool $redirect * @return void */ protected function prepareQuery( $randstr, $limit, $namespace, &$resultPageSet, $redirect ) { @@ -68,7 +68,7 @@ class ApiQueryRandom extends ApiQueryGeneratorBase { } /** - * @param $resultPageSet ApiPageSet + * @param ApiPageSet $resultPageSet * @return int */ protected function runQuery( $resultPageSet = null ) { @@ -99,7 +99,7 @@ class ApiQueryRandom extends ApiQueryGeneratorBase { } /** - * @param $resultPageSet ApiPageSet + * @param ApiPageSet $resultPageSet * @return void */ public function run( $resultPageSet = null ) { @@ -165,40 +165,15 @@ class ApiQueryRandom extends ApiQueryGeneratorBase { ); } - public function getParamDescription() { + protected function getExamplesMessages() { return array( - 'namespace' => 'Return pages in these namespaces only', - 'limit' => 'Limit how many random pages will be returned', - 'redirect' => 'Load a random redirect instead of a random page' + 'action=query&list=random&rnnamespace=0&rnlimit=2' + => 'apihelp-query+random-example-simple', + 'action=query&generator=random&grnnamespace=0&grnlimit=2&prop=info' + => 'apihelp-query+random-example-generator', ); } - public function getResultProperties() { - return array( - '' => array( - 'id' => 'integer', - 'ns' => 'namespace', - 'title' => 'string' - ) - ); - } - - public function getDescription() { - return array( - 'Get a set of random pages.', - 'NOTE: Pages are listed in a fixed sequence, only the starting point is random.', - ' This means that if, for example, "Main Page" is the first random page on', - ' your list, "List of fictional monkeys" will *always* be second, "List of', - ' people on stamps of Vanuatu" third, etc.', - 'NOTE: If the number of pages in the namespace is lower than rnlimit, you will', - ' get fewer pages. You will not get the same page twice.' - ); - } - - public function getExamples() { - return 'api.php?action=query&list=random&rnnamespace=0&rnlimit=2'; - } - public function getHelpUrls() { return 'https://www.mediawiki.org/wiki/API:Random'; }