33 parent::__construct(
'Preferences' );
44 $out->disallowUserJs(); # Prevent hijacked user
scripts from sniffing passwords etc.
49 if ( $par ==
'reset' ) {
55 $out->addModules(
'mediawiki.special.preferences.ooui' );
56 $out->addModuleStyles(
'mediawiki.special.preferences.styles.ooui' );
57 $out->addModuleStyles(
'oojs-ui-widgets.styles' );
60 if ( $session->get(
'specialPreferencesSaveSuccess' ) ) {
62 $session->remove(
'specialPreferencesSaveSuccess' );
63 $out->addModuleStyles(
'mediawiki.notification.convertmessagebox.styles' );
69 'class' =>
'mw-preferences-messagebox mw-notify-success successbox',
70 'id' =>
'mw-preferences-success',
71 'data-mw-autohide' =>
'false',
73 Html::element(
'p', [], $this->
msg(
'savedprefs' )->
text() )
82 $user = $this->
getUser()->getInstanceForUpdate() ?: $this->
getUser();
88 $sectionTitles = $htmlForm->getPreferenceSections();
91 foreach ( $sectionTitles as $key ) {
94 'label' => $htmlForm->getLegend( $key ),
97 $out->addJsConfigVars(
'wgPreferencesTabs', $prefTabs );
109 $preferencesFactory = MediaWikiServices::getInstance()->getPreferencesFactory();
110 $form = $preferencesFactory->getForm( $user,
$context, PreferencesFormOOUI::class );
115 if ( !$this->
getUser()->isAllowed(
'editmyoptions' ) ) {
119 $this->
getOutput()->addWikiMsg(
'prefs-reset-intro' );
123 $htmlForm = HTMLForm::factory(
'ooui', [],
$context,
'prefs-restore' );
125 $htmlForm->setSubmitTextMsg(
'restoreprefs' );
126 $htmlForm->setSubmitDestructive();
127 $htmlForm->setSubmitCallback( [ $this,
'submitReset' ] );
128 $htmlForm->suppressReset();
134 if ( !$this->
getUser()->isAllowed(
'editmyoptions' ) ) {
138 $user = $this->
getUser()->getInstanceForUpdate();
139 $user->resetOptions(
'all', $this->
getContext() );
140 $user->saveSettings();
143 $this->
getRequest()->getSession()->set(
'specialPreferencesSaveSuccess', 1 );
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
An IContextSource implementation which will inherit context from another source but allow individual ...
Show an error when a user tries to do something they do not have the necessary permissions for.
Parent class for all special pages.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
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.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key)
Wrapper around wfMessage that sets the current context.
getRequest()
Get the WebRequest being used for this instance.
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
getPageTitle( $subpage=false)
Get a self-referential title object.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
A special page that allows users to change their preferences.
execute( $par)
Default execute method Checks user permissions.
doesWrites()
Indicates whether this special page may perform database writes.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getFormObject( $user, IContextSource $context)
Get the preferences form to use.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
Interface for objects which can provide a MediaWiki context on request.