MediaWiki  REL1_19
ApiLogout.php
Go to the documentation of this file.
00001 <?php
00033 class ApiLogout extends ApiBase {
00034 
00035         public function __construct( $main, $action ) {
00036                 parent::__construct( $main, $action );
00037         }
00038 
00039         public function execute() {
00040                 $user = $this->getUser();
00041                 $oldName = $user->getName();
00042                 $user->logout();
00043 
00044                 // Give extensions to do something after user logout
00045                 $injected_html = '';
00046                 wfRunHooks( 'UserLogoutComplete', array( &$user, &$injected_html, $oldName ) );
00047         }
00048 
00049         public function isReadMode() {
00050                 return false;
00051         }
00052 
00053         public function getAllowedParams() {
00054                 return array();
00055         }
00056 
00057         public function getParamDescription() {
00058                 return array();
00059         }
00060 
00061         public function getDescription() {
00062                 return 'Log out and clear session data';
00063         }
00064 
00065         public function getExamples() {
00066                 return array(
00067                         'api.php?action=logout' => 'Log the current user out',
00068                 );
00069         }
00070 
00071         public function getHelpUrls() {
00072                 return 'https://www.mediawiki.org/wiki/API:Logout';
00073         }
00074 
00075         public function getVersion() {
00076                 return __CLASS__ . ': $Id$';
00077         }
00078 }