$this->addOption( 'ORDER BY', array(
'll_title' . $sort,
'll_from' . $sort
- ));
+ ) );
}
} else {
$this->addOption( 'ORDER BY', array(
'll_lang' . $sort,
'll_title' . $sort,
'll_from' . $sort
- ));
+ ) );
}
$this->addOption( 'LIMIT', $params['limit'] + 1 );
$count = 0;
$result = $this->getResult();
foreach ( $res as $row ) {
- if ( ++ $count > $params['limit'] ) {
+ if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here...
// Continue string preserved in case the redirect query doesn't pass the limit
$this->setContinueEnumParameter( 'continue', "{$row->ll_lang}|{$row->ll_title}|{$row->ll_from}" );
$this->addOption( 'ORDER BY', 'll_lang' . $sort );
} else {
$this->addOption( 'ORDER BY', array(
- 'll_from' . $sort,
- 'll_lang' . $sort
- ));
+ 'll_from' . $sort,
+ 'll_lang' . $sort
+ ) );
}
}
public function getParamDescription() {
$desc = $this->description;
+
return array(
'namespace' => "Show {$desc}s in this namespace(s) only",
'limit' => "How many {$desc}s to return",
public function getExamples() {
$desc = $this->description;
$name = $this->getModuleName();
+
return array(
"api.php?action=query&prop={$name}&titles=Main%20Page" => "Get {$desc}s from the [[Main Page]]",
"api.php?action=query&generator={$name}&titles=Main%20Page&prop=info" => "Get information about the {$desc} pages in the [[Main Page]]",
$res = $this->select( __METHOD__ );
$result = $this->getResult();
foreach ( $res as $row ) {
- if ( ++ $count > $limit ) {
+ if ( ++$count > $limit ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here...
$this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->log_timestamp ) );
break;
$result->setIndexedTagName_recursive( $logParams, 'param' );
$vals = array_merge( $vals, $logParams );
}
+
return $vals;
}
public function getAllowedParams() {
global $wgLogTypes, $wgLogActions, $wgLogActionsHandlers;
+
return array(
'prop' => array(
ApiBase::PARAM_ISMULTI => true,
public function getParamDescription() {
$p = $this->getModulePrefix();
+
return array(
'prop' => array(
'Which properties to get',
public function getResultProperties() {
global $wgLogTypes;
+
return array(
'ids' => array(
'logid' => 'integer',
protected function getParams() {
return array_filter(
$this->extractRequestParams(),
- function( $prop ) {
+ function ( $prop ) {
return isset( $prop );
}
);
return array_merge( $this->getTable()->getFieldDescriptions(), $descriptions );
}
-
}
if ( !$fit ) {
$this->setContinueEnumParameter( 'continue', $page );
}
+
return $fit;
}
$titles = array();
foreach ( $res as $row ) {
- if ( ++ $count > $params['limit'] ) {
+ if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here...
$this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->pt_timestamp ) );
break;
public function getAllowedParams() {
global $wgRestrictionLevels;
+
return array(
'namespace' => array(
ApiBase::PARAM_ISMULTI => true,
public function getResultProperties() {
global $wgRestrictionLevels;
+
return array(
'' => array(
'ns' => 'namespace',
if ( $qp->getRestriction() != '' ) {
return 'private';
}
+
return 'public';
}
// Prevent duplicates
if ( !in_array( $row->page_id, $this->pageIDs ) ) {
$fit = $this->getResult()->addValue(
- array( 'query', $this->getModuleName() ),
- null, $this->extractRowInfo( $row ) );
+ array( 'query', $this->getModuleName() ),
+ null, $this->extractRowInfo( $row ) );
if ( !$fit ) {
// We can't really query-continue a random list.
// Return an insanely high value so
$vals = array();
$vals['id'] = intval( $row->page_id );
ApiQueryBase::addTitleInfo( $vals, $title );
+
return $vals;
}
}
private $fld_comment = false, $fld_parsedcomment = false, $fld_user = false, $fld_userid = false,
- $fld_flags = false, $fld_timestamp = false, $fld_title = false, $fld_ids = false,
- $fld_sizes = false, $fld_redirect = false, $fld_patrolled = false, $fld_loginfo = false,
- $fld_tags = false, $fld_sha1 = false, $token = array();
+ $fld_flags = false, $fld_timestamp = false, $fld_title = false, $fld_ids = false,
+ $fld_sizes = false, $fld_redirect = false, $fld_patrolled = false, $fld_loginfo = false,
+ $fld_tags = false, $fld_sha1 = false, $token = array();
private $tokenFunctions;
'patrol' => array( 'ApiQueryRecentChanges', 'getPatrolToken' )
);
wfRunHooks( 'APIQueryRecentChangesTokens', array( &$this->tokenFunctions ) );
+
return $this->tokenFunctions;
}
if ( $rc ) {
if ( ( $wgUser->useRCPatrol() && $rc->getAttribute( 'rc_type' ) == RC_EDIT ) ||
- ( $wgUser->useNPPatrol() && $rc->getAttribute( 'rc_type' ) == RC_NEW ) )
- {
+ ( $wgUser->useNPPatrol() && $rc->getAttribute( 'rc_type' ) == RC_NEW )
+ ) {
$validTokenUser = true;
}
} else {
if ( is_null( $cachedPatrolToken ) ) {
$cachedPatrolToken = $wgUser->getEditToken( 'patrol' );
}
+
return $cachedPatrolToken;
} else {
return false;
}
-
}
/**
$cont = explode( '|', $params['continue'] );
if ( count( $cont ) != 2 ) {
$this->dieUsage( 'Invalid continue param. You should pass the ' .
- 'original value returned by the previous query', '_badcontinue' );
+ 'original value returned by the previous query', '_badcontinue' );
}
$timestamp = $this->getDB()->addQuotes( wfTimestamp( TS_MW, $cont[0] ) );
/* Check for conflicting parameters. */
if ( ( isset( $show['minor'] ) && isset( $show['!minor'] ) )
- || ( isset( $show['bot'] ) && isset( $show['!bot'] ) )
- || ( isset( $show['anon'] ) && isset( $show['!anon'] ) )
- || ( isset( $show['redirect'] ) && isset( $show['!redirect'] ) )
- || ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) )
+ || ( isset( $show['bot'] ) && isset( $show['!bot'] ) )
+ || ( isset( $show['anon'] ) && isset( $show['!anon'] ) )
+ || ( isset( $show['redirect'] ) && isset( $show['!redirect'] ) )
+ || ( isset( $show['patrolled'] ) && isset( $show['!patrolled'] ) )
) {
$this->dieUsageMsg( 'show' );
}
/* Iterate through the rows, adding data extracted from them to our query result. */
foreach ( $res as $row ) {
- if ( ++ $count > $params['limit'] ) {
+ if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here...
$this->setContinueEnumParameter( 'continue', wfTimestamp( TS_ISO_8601, $row->rc_timestamp ) . '|' . $row->rc_id );
break;
foreach ( $type as $t ) {
$retval[] = $this->parseRCType( $t );
}
+
return $retval;
}
switch ( $type ) {
// formatComment() calls wfMessage() among other things
return 'anon-public-user-private';
}
+
return 'public';
}
public function getParamDescription() {
$p = $this->getModulePrefix();
+
return array(
'start' => 'The timestamp to start enumerating from',
'end' => 'The timestamp to end enumerating',