34 parent::__construct(
'ResetTokens' );
48 if ( !isset( $this->tokensList ) ) {
50 [
'preference' =>
'watchlisttoken',
'label-message' =>
'resettokens-watchlist-token' ],
52 Hooks::run(
'SpecialResetTokensTokens', [ &
$tokens ] );
54 $hiddenPrefs = $this->
getConfig()->get(
'HiddenPrefs' );
55 $tokens = array_filter(
$tokens,
function ( $tok ) use ( $hiddenPrefs ) {
56 return !in_array( $tok[
'preference'], $hiddenPrefs );
70 parent::execute(
$par );
77 Html::successBox(
'$1' ),
94 $label = $this->
msg(
'resettokens-token-label' )
95 ->rawParams( $this->
msg( $tok[
'label-message'] )->parse() )
96 ->params( $user->getTokenFromOption( $tok[
'preference'] ) )
98 $tokensForForm[$label] = $tok[
'preference'];
102 'label-message' =>
'resettokens-tokens',
103 'type' =>
'multiselect',
104 'options' => $tokensForForm,
108 'label-message' =>
'resettokens-no-tokens',
124 $form->setSubmitDestructive();
128 $form->suppressDefaultSubmit();
137 if ( $formData[
'tokens'] ) {
139 foreach ( $formData[
'tokens'] as $tokenPref ) {
140 $user->resetTokenFromOption( $tokenPref );
142 $user->saveSettings();
Special page which uses an HTMLForm to handle processing.
string $par
The sub-page of the special page.
getOutput()
Get the OutputPage being used for this instance.
requireLogin( $reasonMsg='exception-nologin-text', $titleMsg='exception-nologin')
If the user is not logged in, throws UserNotLoggedIn error.
getUser()
Shortcut to get the User executing this instance.
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,...
msg( $key)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
Let users reset tokens like the watchlist token.
onSuccess()
Do something exciting on successful processing of the form, most likely to show a confirmation messag...
doesWrites()
Indicates whether this special page may perform database writes.
getDisplayFormat()
Get display format for the form.
onSubmit(array $formData)
Process the form on POST submission.
alterForm(HTMLForm $form)
Suppress the submit button if there's nothing to do; provide additional message on it otherwise.
getTokensList()
Returns the token information list for this page after running the hook and filtering out disabled pr...
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getFormFields()
Display appropriate message if there's nothing to do.
execute( $par)
Basic SpecialPage workflow: get a form, send it to the user; get some data back,.
isListed()
Whether this special page is listed in Special:SpecialPages.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))