<?php
/**
- * Created on Monday, January 28, 2008
*
- * API for MediaWiki 1.8+
+ *
+ * Created on Monday, January 28, 2008
*
* Copyright © 2008 Brent Garber
*
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
*/
if ( !defined( 'MEDIAWIKI' ) ) {
* @ingroup API
*/
- class ApiQueryRandom extends ApiQueryGeneratorBase {
+class ApiQueryRandom extends ApiQueryGeneratorBase {
public function __construct( $query, $moduleName ) {
parent::__construct( $query, $moduleName, 'rn' );
$this->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' );
}
}
- 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 ) {
return $count;
}
+ /**
+ * @param $resultPageSet ApiPageSet
+ * @return void
+ */
public function run( $resultPageSet = null ) {
$params = $this->extractRequestParams();
$result = $this->getResult();
return $vals;
}
+ public function getCacheMode( $params ) {
+ return 'public';
+ }
+
public function getAllowedParams() {
return array(
'namespace' => array(
public function getVersion() {
return __CLASS__ . ': $Id: ApiQueryRandom.php overlordq$';
}
-}
\ No newline at end of file
+}