APIQueryInfo: Allow fetching the canonical url of a page
[lhc/web/wiklou.git] / includes / api / ApiQueryLogEvents.php
index 3aad785..d3607e1 100644 (file)
@@ -204,7 +204,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
                        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 {
@@ -403,7 +403,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
                                        $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 ) {
@@ -566,80 +566,10 @@ class ApiQueryLogEvents extends ApiQueryBase {
                );
        }
 
-       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'
-                       ),
-                       '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.';
        }
 
-       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' ),
-                       )
-               );
-       }
-
        public function getExamples() {
                return array(
                        'api.php?action=query&list=logevents'