}
private $fld_ids = false, $fld_title = false, $fld_type = false,
- $fld_action = false, $fld_user = false, $fld_userid = false,
+ $fld_user = false, $fld_userid = false,
$fld_timestamp = false, $fld_comment = false, $fld_parsedcomment = false,
$fld_details = false, $fld_tags = false;
$this->fld_ids = isset( $prop['ids'] );
$this->fld_title = isset( $prop['title'] );
$this->fld_type = isset( $prop['type'] );
- $this->fld_action = isset( $prop['action'] );
$this->fld_user = isset( $prop['user'] );
$this->fld_userid = isset( $prop['userid'] );
$this->fld_timestamp = isset( $prop['timestamp'] );
if ( !$this->getUser()->isAllowed( 'deletedhistory' ) ) {
$titleBits = LogPage::DELETED_ACTION;
$userBits = LogPage::DELETED_USER;
- } elseif ( !$this->getUser()->isAllowed( 'suppressrevision' ) ) {
+ } elseif ( !$this->getUser()->isAllowedAny( 'suppressrevision', 'viewsuppressed' ) ) {
$titleBits = LogPage::DELETED_ACTION | LogPage::DELETED_RESTRICTED;
$userBits = LogPage::DELETED_USER | LogPage::DELETED_RESTRICTED;
} else {
break;
}
$vals2 = array();
- list( $vals2['duration'], $vals2['flags'] ) = $params;
+ $vals2['duration'] = $params[0];
+ $vals2['flags'] = isset( $params[1] ) ? $params[1] : '';
// Indefinite blocks have no expiry time
if ( SpecialBlock::parseExpiryInput( $params[0] ) !== wfGetDB( DB_SLAVE )->getInfinity() ) {
$params['img_timestamp'] = wfTimestamp( TS_ISO_8601, $params['img_timestamp'] );
}
break;
+ case 'merge':
+ // replace the named parameter with numbered for backward compatibility
+ if ( isset( $params['4::dest'] ) ) {
+ $params[] = $params['4::dest'];
+ unset( $params['4::dest'] );
+ }
+ if ( isset( $params['5::mergepoint'] ) ) {
+ $params[] = $params['5::mergepoint'];
+ unset( $params['5::mergepoint'] );
+ }
+ break;
}
if ( !is_null( $params ) ) {
$logParams = array();
}
}
- if ( $this->fld_type || $this->fld_action ) {
+ if ( $this->fld_type ) {
$vals['type'] = $row->log_type;
$vals['action'] = $row->log_action;
}
$vals['user'] = $row->user_name === null ? $row->log_user_text : $row->user_name;
}
if ( $this->fld_userid ) {
- $vals['userid'] = $row->log_user;
+ $vals['userid'] = intval( $row->log_user );
}
if ( !$row->log_user ) {
public function getAllowedParams( $flags = 0 ) {
$config = $this->getConfig();
- return array(
+ $ret = array(
'prop' => array(
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_DFLT => 'ids|title|type|user|timestamp|comment|details',
ApiBase::PARAM_TYPE => array(
'newer',
'older'
- )
+ ),
+ ApiBase::PARAM_HELP_MSG => 'api-help-param-direction',
),
'user' => null,
'title' => null,
'namespace' => array(
ApiBase::PARAM_TYPE => 'namespace'
),
- 'prefix' => null,
+ 'prefix' => array(),
'tag' => null,
'limit' => array(
ApiBase::PARAM_DFLT => 10,
ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
),
- 'continue' => null,
- );
- }
-
- public function getParamDescription() {
- $p = $this->getModulePrefix();
-
- return array(
- 'prop' => array(
- 'Which properties to get',
- ' ids - Adds the ID of the log event',
- ' title - Adds the title of the page for the log event',
- ' type - Adds the type of log event',
- ' user - Adds the user responsible for the log event',
- ' userid - Adds the user ID who was responsible for the log event',
- ' timestamp - Adds the timestamp for the event',
- ' comment - Adds the comment of the event',
- ' parsedcomment - Adds the parsed comment of the event',
- ' details - Lists additional details about the event',
- ' tags - Lists tags for the event',
- ),
- 'type' => 'Filter log entries to only this type',
- 'action' => array(
- "Filter log actions to only this action. Overrides {$p}type",
- "Wildcard actions like 'action/*' allows to specify any string for the asterisk"
- ),
- 'start' => 'The timestamp to start enumerating from',
- 'end' => 'The timestamp to end enumerating',
- 'dir' => $this->getDirectionDescription( $p ),
- 'user' => 'Filter entries to those made by the given user',
- 'title' => 'Filter entries to those related to a page',
- 'namespace' => 'Filter entries to those in the given namespace',
- 'prefix' => 'Filter entries that start with this prefix. Disabled in Miser Mode',
- 'limit' => 'How many total event entries to return',
- 'tag' => 'Only list event entries tagged with this tag',
- 'continue' => 'When more results are available, use this to continue',
- );
- }
-
- public function getResultProperties() {
- return array(
- 'ids' => array(
- 'logid' => 'integer',
- 'pageid' => 'integer'
- ),
- 'title' => array(
- 'ns' => 'namespace',
- 'title' => 'string'
- ),
- 'type' => array(
- 'type' => array(
- ApiBase::PROP_TYPE => $this->getConfig()->get( 'LogTypes' )
- ),
- 'action' => 'string'
- ),
- 'details' => array(
- 'actionhidden' => 'boolean'
- ),
- 'user' => array(
- 'userhidden' => 'boolean',
- 'user' => array(
- ApiBase::PROP_TYPE => 'string',
- ApiBase::PROP_NULLABLE => true
- ),
- 'anon' => 'boolean'
- ),
- 'userid' => array(
- 'userhidden' => 'boolean',
- 'userid' => array(
- ApiBase::PROP_TYPE => 'integer',
- ApiBase::PROP_NULLABLE => true
- ),
- 'anon' => 'boolean'
- ),
- 'timestamp' => array(
- 'timestamp' => 'timestamp'
+ 'continue' => array(
+ ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
),
- 'comment' => array(
- 'commenthidden' => 'boolean',
- 'comment' => array(
- ApiBase::PROP_TYPE => 'string',
- ApiBase::PROP_NULLABLE => true
- )
- ),
- 'parsedcomment' => array(
- 'commenthidden' => 'boolean',
- 'parsedcomment' => array(
- ApiBase::PROP_TYPE => 'string',
- ApiBase::PROP_NULLABLE => true
- )
- )
);
- }
- public function getDescription() {
- return 'Get events from logs.';
- }
+ if ( $config->get( 'MiserMode' ) ) {
+ $ret['prefix'][ApiBase::PARAM_HELP_MSG] = 'api-help-param-disabled-in-miser-mode';
+ }
- public function getPossibleErrors() {
- return array_merge(
- parent::getPossibleErrors(),
- $this->getRequireMaxOneParameterErrorMessages(
- array( 'title', 'prefix', 'namespace' ) ),
- array(
- array( 'code' => 'param_user', 'info' => 'User name $user not found' ),
- array( 'code' => 'param_title', 'info' => 'Bad title value \'title\'' ),
- array( 'code' => 'param_prefix', 'info' => 'Bad title value \'prefix\'' ),
- array( 'code' => 'prefixsearchdisabled',
- 'info' => 'Prefix search disabled in Miser Mode' ),
- )
- );
+ return $ret;
}
- public function getExamples() {
+ protected function getExamplesMessages() {
return array(
- 'api.php?action=query&list=logevents'
+ 'action=query&list=logevents'
+ => 'apihelp-query+logevents-example-simple',
);
}