wiki.techinc.nl/includes/api/ApiLogout.php

71 lines
1.7 KiB
PHP
Raw Normal View History

2008-01-08 18:10:58 +00:00
<?php
/**
*
2008-01-08 18:10:58 +00:00
*
* Created on Jan 4, 2008
*
* Copyright © 2008 Yuri Astrakhan "<Firstname><Lastname>@gmail.com",
2008-01-08 18:10:58 +00:00
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2008-01-08 18:10:58 +00:00
* http://www.gnu.org/copyleft/gpl.html
*
* @file
2008-01-08 18:10:58 +00:00
*/
2008-01-12 07:08:17 +00:00
/**
* API module to allow users to log out of the wiki. API equivalent of
2008-01-12 07:08:17 +00:00
* Special:Userlogout.
*
* @ingroup API
2008-01-12 07:08:17 +00:00
*/
2008-01-08 18:10:58 +00:00
class ApiLogout extends ApiBase {
public function execute() {
$user = $this->getUser();
$oldName = $user->getName();
$user->logout();
// Give extensions to do something after user logout
$injected_html = '';
wfRunHooks( 'UserLogoutComplete', array( &$user, &$injected_html, $oldName ) );
2008-01-08 18:10:58 +00:00
}
public function isReadMode() {
return false;
}
public function getAllowedParams() {
return array();
2008-01-08 18:10:58 +00:00
}
public function getParamDescription() {
return array();
2008-01-08 18:10:58 +00:00
}
public function getDescription() {
return 'Log out and clear session data.';
2008-01-08 18:10:58 +00:00
}
public function getExamples() {
2008-01-08 18:10:58 +00:00
return array(
'api.php?action=logout' => 'Log the current user out',
2008-01-08 18:10:58 +00:00
);
}
public function getHelpUrls() {
2011-11-28 15:43:11 +00:00
return 'https://www.mediawiki.org/wiki/API:Logout';
}
2008-01-12 07:08:17 +00:00
}