Merge "Revert "(bug 30625) Add, to every API upload response, the warnings raised.""
[lhc/web/wiklou.git] / includes / api / ApiLogout.php
index 244c976..81a054a 100644 (file)
  * @file
  */
 
-if ( !defined( 'MEDIAWIKI' ) ) {
-       // Eclipse helper - will be ignored in production
-       require_once( 'ApiBase.php' );
-}
-
 /**
  * API module to allow users to log out of the wiki. API equivalent of
  * Special:Userlogout.
@@ -42,13 +37,13 @@ class ApiLogout extends ApiBase {
        }
 
        public function execute() {
-               global $wgUser;
-               $oldName = $wgUser->getName();
-               $wgUser->logout();
+               $user = $this->getUser();
+               $oldName = $user->getName();
+               $user->logout();
 
                // Give extensions to do something after user logout
                $injected_html = '';
-               wfRunHooks( 'UserLogoutComplete', array( &$wgUser, &$injected_html, $oldName ) );
+               wfRunHooks( 'UserLogoutComplete', array( &$user, &$injected_html, $oldName ) );
        }
 
        public function isReadMode() {
@@ -67,12 +62,16 @@ class ApiLogout extends ApiBase {
                return 'Log out and clear session data';
        }
 
-       protected function getExamples() {
+       public function getExamples() {
                return array(
-                       'api.php?action=logout'
+                       'api.php?action=logout' => 'Log the current user out',
                );
        }
 
+       public function getHelpUrls() {
+               return 'https://www.mediawiki.org/wiki/API:Logout';
+       }
+
        public function getVersion() {
                return __CLASS__ . ': $Id$';
        }