17use OOUI\MessageWidget;
34 parent::__construct(
'Userlogout' );
35 $this->tempUserConfig = $tempUserConfig;
66 if ( $user->isAnon() ) {
71 $this->oldUserName = $user->getName();
73 parent::execute(
$par );
79 if ( $this->
getUser()->isTemp() ) {
82 Html::rawElement(
'p', [], $this->
msg(
'userlogout-temp' )->parse() ) .
83 Html::rawElement(
'p', [], $this->
msg(
'userlogout-temp-moreinfo' )->parse() ) .
84 (
new MessageWidget( [
86 'label' =>
new HtmlSnippet(
90 $this->
msg(
'userlogout-temp-messagebox-title' )->text()
93 $this->
msg(
'userlogout-temp-messagebox-body' )->parse()
116 if ( !$session->canSetUser() ) {
118 'cannotlogoutnow-title',
119 'cannotlogoutnow-text',
121 $session->getProvider()->describe( $this->getLanguage() )
133 $this->showSuccess();
138 $this->
getHookRunner()->onUserLogoutComplete( $this->
getUser(), $injected_html, $this->oldUserName );
139 $out->addHTML( $injected_html );
142 private function showSuccess() {
144 $this->
getRequest()->getValues(
'returnto',
'returntoquery' ) );
148 $messageKey =
'logouttext';
150 ( $this->oldUserName !==
null && $this->tempUserConfig->isTempName( $this->oldUserName ) ) ||
151 $this->getRequest()->getCheck(
'wasTempUser' )
155 $messageKey .=
'-for-temporary-account';
157 $out->addWikiMsg( $messageKey, $loginURL );
159 $out->returnToMain();
175 ( $this->oldUserName !==
null && $this->tempUserConfig->isTempName( $this->oldUserName ) ) ||
176 $this->getRequest()->getCheck(
'wasTempUser' )
178 return $this->
msg(
'templogout' );
180 return parent::getDescription();
188class_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.