$prefix = $params['prefix'];
if ( !is_null( $prefix ) ) {
- global $wgMiserMode;
- if ( $wgMiserMode ) {
+ if ( $this->getConfig()->get( 'MiserMode' ) ) {
$this->dieUsage( 'Prefix search disabled in Miser Mode', 'prefixsearchdisabled' );
}
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 {
$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 ) {
return $vals;
}
+ /**
+ * @return array
+ */
private function getAllowedLogActions() {
- global $wgLogActions, $wgLogActionsHandlers;
-
- return array_keys( array_merge( $wgLogActions, $wgLogActionsHandlers ) );
+ $config = $this->getConfig();
+ return array_keys( array_merge( $config->get( 'LogActions' ), $config->get( 'LogActionsHandlers' ) ) );
}
public function getCacheMode( $params ) {
}
public function getAllowedParams( $flags = 0 ) {
- global $wgLogTypes;
-
+ $config = $this->getConfig();
return array(
'prop' => array(
ApiBase::PARAM_ISMULTI => true,
)
),
'type' => array(
- ApiBase::PARAM_TYPE => $wgLogTypes
+ ApiBase::PARAM_TYPE => $config->get( 'LogTypes' )
),
'action' => array(
// validation on request is done in execute()
}
public function getResultProperties() {
- global $wgLogTypes;
-
return array(
'ids' => array(
'logid' => 'integer',
),
'type' => array(
'type' => array(
- ApiBase::PROP_TYPE => $wgLogTypes
+ ApiBase::PROP_TYPE => $this->getConfig()->get( 'LogTypes' )
),
'action' => 'string'
),
}
public function getPossibleErrors() {
- return array_merge( parent::getPossibleErrors(), 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 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' ),
+ )
+ );
}
public function getExamples() {