29 parent::__construct( $main, $action );
33 if ( $this->
getUser()->isAnon() ) {
35 $this->
addWarning(
'apierror-mustbeloggedin-generic',
'notloggedin' );
50 $this->
getRequest()->getSession()->unpersist();
51 $this->sessionManager->invalidateSessionsForUser( $user );
57 $oldUserName = $user->getName();
62 $session->unpersist();
67 if ( !$session->canSetUser() ) {
70 'cannotlogoutnow-text',
71 $session->getProvider()->describe( $this->getErrorFormatter()->getLanguage() )
78 $this->callUserLogoutComplete( $user, $oldUserName );
84 $this->getHookRunner()->onUserLogoutComplete( $user, $injected_html, $oldUserName );
91 ParamValidator::PARAM_TYPE =>
'boolean',
92 ParamValidator::PARAM_DEFAULT =>
false,
117 return 'logoutToken';
128 'action=logout&token=123ABC'
129 =>
'apihelp-logout-example-logout',
135 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Logout';
140class_alias( ApiLogout::class,
'ApiLogout' );
This is the main API class, used for both external and internal processing.