17use OOUI\MessageWidget;
34 parent::__construct(
'Userlogout' );
65 if ( $user->isAnon() ) {
70 $this->oldUserName = $user->getName();
72 parent::execute(
$par );
78 if ( $this->
getUser()->isTemp() ) {
81 Html::rawElement(
'p', [], $this->
msg(
'userlogout-temp' )->parse() ) .
82 Html::rawElement(
'p', [], $this->
msg(
'userlogout-temp-moreinfo' )->parse() ) .
83 (
new MessageWidget( [
85 'label' =>
new HtmlSnippet(
89 $this->
msg(
'userlogout-temp-messagebox-title' )->text()
92 $this->
msg(
'userlogout-temp-messagebox-body' )->parse()
115 if ( !$session->canSetUser() ) {
117 'cannotlogoutnow-title',
118 'cannotlogoutnow-text',
120 $session->getProvider()->describe( $this->getLanguage() )
132 $this->showSuccess();
137 $this->
getHookRunner()->onUserLogoutComplete( $this->
getUser(), $injected_html, $this->oldUserName );
138 $out->addHTML( $injected_html );
141 private function showSuccess() {
143 $this->
getRequest()->getValues(
'returnto',
'returntoquery' ) );
147 $messageKey =
'logouttext';
149 ( $this->oldUserName !==
null && $this->tempUserConfig->isTempName( $this->oldUserName ) ) ||
150 $this->getRequest()->getCheck(
'wasTempUser' )
154 $messageKey .=
'-for-temporary-account';
156 $out->addWikiMsg( $messageKey, $loginURL );
158 $out->returnToMain();
174 ( $this->oldUserName !==
null && $this->tempUserConfig->isTempName( $this->oldUserName ) ) ||
175 $this->getRequest()->getCheck(
'wasTempUser' )
177 return $this->
msg(
'templogout' );
179 return parent::getDescription();
187class_alias( SpecialUserLogout::class,
'SpecialUserLogout' );
An error page which can definitely be safely rendered using the OutputPage.
Special page which uses an HTMLForm to handle processing.
string null $par
The subpage of the special page.
Parent class for all special pages.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
getUser()
Shortcut to get the User executing this instance.
getRequest()
Get the WebRequest being used for this instance.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.