Merge "make list of 'Languages that support variant conversion' dynamic"
[lhc/web/wiklou.git] / includes / api / ApiPatrol.php
index c3dc582..cb5e081 100644 (file)
  * @file
  */
 
-if ( !defined( 'MEDIAWIKI' ) ) {
-       require_once ( 'ApiBase.php' );
-}
-
 /**
  * Allows user to patrol pages
  * @ingroup API
@@ -42,15 +38,13 @@ class ApiPatrol extends ApiBase {
         * Patrols the article or provides the reason the patrol failed.
         */
        public function execute() {
-               global $wgUser;
-
                $params = $this->extractRequestParams();
 
                $rc = RecentChange::newFromID( $params['rcid'] );
                if ( !$rc instanceof RecentChange ) {
                        $this->dieUsageMsg( array( 'nosuchrcid', $params['rcid'] ) );
                }
-               $retval = $rc->doMarkPatrolled( $wgUser );
+               $retval = $rc->doMarkPatrolled( $this->getUser() );
 
                if ( $retval ) {
                        $this->dieUsageMsg( reset( $retval ) );
@@ -71,7 +65,10 @@ class ApiPatrol extends ApiBase {
 
        public function getAllowedParams() {
                return array(
-                       'token' => null,
+                       'token' => array(
+                               ApiBase::PARAM_TYPE => 'string',
+                               ApiBase::PARAM_REQUIRED => true
+                       ),
                        'rcid' => array(
                                ApiBase::PARAM_TYPE => 'integer',
                                ApiBase::PARAM_REQUIRED => true
@@ -86,6 +83,16 @@ class ApiPatrol extends ApiBase {
                );
        }
 
+       public function getResultProperties() {
+               return array(
+                       '' => array(
+                               'rcid' => 'integer',
+                               'ns' => 'namespace',
+                               'title' => 'string'
+                       )
+               );
+       }
+
        public function getDescription() {
                return 'Patrol a page or revision';
        }
@@ -104,14 +111,14 @@ class ApiPatrol extends ApiBase {
                return 'patrol';
        }
 
-       protected function getExamples() {
+       public function getExamples() {
                return array(
                        'api.php?action=patrol&token=123abc&rcid=230672766'
                );
        }
 
        public function getHelpUrls() {
-               return '';
+               return 'https://www.mediawiki.org/wiki/API:Patrol';
        }
 
        public function getVersion() {