summaryrefslogtreecommitdiff
path: root/includes/api/ApiLogout.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api/ApiLogout.php')
-rw-r--r--includes/api/ApiLogout.php17
1 files changed, 6 insertions, 11 deletions
diff --git a/includes/api/ApiLogout.php b/includes/api/ApiLogout.php
index b5dd7ac9..81a054a6 100644
--- a/includes/api/ApiLogout.php
+++ b/includes/api/ApiLogout.php
@@ -24,11 +24,6 @@
* @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,9 +62,9 @@ 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',
);
}