MediaWiki REL1_32
Preferences.php
Go to the documentation of this file.
1<?php
24
31
37 protected static function getDefaultPreferencesFactory() {
38 $services = MediaWikiServices::getInstance();
39 $authManager = AuthManager::singleton();
40 $linkRenderer = $services->getLinkRenderer();
41 $config = $services->getMainConfig();
42 $preferencesFactory = new DefaultPreferencesFactory(
43 $config, $services->getContentLanguage(), $authManager,
45 );
46 return $preferencesFactory;
47 }
48
52 public static function getSaveBlacklist() {
53 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
54 }
55
62 public static function getPreferences( $user, IContextSource $context ) {
63 $preferencesFactory = self::getDefaultPreferencesFactory();
64 return $preferencesFactory->getFormDescriptor( $user, $context );
65 }
66
75 public static function loadPreferenceValues( $user, $context, &$defaultPreferences ) {
76 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
77 }
78
87 public static function getOptionFromUser( $name, $info, $user ) {
88 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
89 }
90
97 public static function profilePreferences(
98 $user, IContextSource $context, &$defaultPreferences
99 ) {
100 wfDeprecated( __METHOD__, '1.31' );
101 $defaultPreferences = self::getPreferences( $user, $context );
102 }
103
110 public static function skinPreferences( $user, IContextSource $context, &$defaultPreferences ) {
111 wfDeprecated( __METHOD__, '1.31' );
112 $defaultPreferences = self::getPreferences( $user, $context );
113 }
114
120 public static function filesPreferences(
121 $user, IContextSource $context, &$defaultPreferences
122 ) {
123 wfDeprecated( __METHOD__, '1.31' );
124 $defaultPreferences = self::getPreferences( $user, $context );
125 }
126
133 public static function datetimePreferences(
134 $user, IContextSource $context, &$defaultPreferences
135 ) {
136 wfDeprecated( __METHOD__, '1.31' );
137 $defaultPreferences = self::getPreferences( $user, $context );
138 }
139
145 public static function renderingPreferences(
146 $user, IContextSource $context, &$defaultPreferences
147 ) {
148 wfDeprecated( __METHOD__, '1.31' );
149 $defaultPreferences = self::getPreferences( $user, $context );
150 }
151
157 public static function editingPreferences(
158 $user, IContextSource $context, &$defaultPreferences
159 ) {
160 wfDeprecated( __METHOD__, '1.31' );
161 $defaultPreferences = self::getPreferences( $user, $context );
162 }
163
169 public static function rcPreferences( $user, IContextSource $context, &$defaultPreferences ) {
170 wfDeprecated( __METHOD__, '1.31' );
171 $defaultPreferences = self::getPreferences( $user, $context );
172 }
173
179 public static function watchlistPreferences(
180 $user, IContextSource $context, &$defaultPreferences
181 ) {
182 wfDeprecated( __METHOD__, '1.31' );
183 $defaultPreferences = self::getPreferences( $user, $context );
184 }
185
191 public static function searchPreferences(
192 $user, IContextSource $context, &$defaultPreferences
193 ) {
194 wfDeprecated( __METHOD__, '1.31' );
195 $defaultPreferences = self::getPreferences( $user, $context );
196 }
197
204 public static function miscPreferences( $user, IContextSource $context, &$defaultPreferences ) {
205 wfDeprecated( __METHOD__, '1.31' );
206 }
207
213 public static function generateSkinOptions( $user, IContextSource $context ) {
214 wfDeprecated( __METHOD__, '1.31' );
216 }
217
223 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
224 }
225
230 public static function getImageSizes( IContextSource $context ) {
231 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
232 }
233
238 public static function getThumbSizes( IContextSource $context ) {
239 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
240 }
241
248 public static function validateSignature( $signature, $alldata, $form ) {
249 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
250 }
251
258 public static function cleanSignature( $signature, $alldata, $form ) {
259 throw new Exception( __METHOD__ . '() is deprecated and does nothing now' );
260 }
261
269 public static function getFormObject(
270 $user,
272 $formClass = PreferencesFormLegacy::class,
273 array $remove = []
274 ) {
275 $preferencesFactory = self::getDefaultPreferencesFactory();
276 return $preferencesFactory->getForm( $user, $context, $formClass, $remove );
277 }
278
283 public static function getTimezoneOptions( IContextSource $context ) {
284 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
285 }
286
292 public static function filterIntval( $value, $alldata ) {
293 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
294 }
295
301 public static function filterTimezoneInput( $tz, $alldata ) {
302 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
303 }
304
313 public static function getTimeZoneList( Language $language ) {
314 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
315 }
316}
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Internationalisation code.
Definition Language.php:35
This serves as the entry point to the authentication system.
MediaWikiServices is the service locator for the application scope of MediaWiki.
This is the default implementation of PreferencesFactory.
This class has been replaced by the PreferencesFactory service.
static getDefaultPreferencesFactory()
A shim to maintain backwards-compatibility of this class, basically replicating the default behaviour...
static getOptionFromUser( $name, $info, $user)
Pull option from a user account.
static searchPreferences( $user, IContextSource $context, &$defaultPreferences)
static rcPreferences( $user, IContextSource $context, &$defaultPreferences)
static filterIntval( $value, $alldata)
static generateSkinOptions( $user, IContextSource $context)
static loadPreferenceValues( $user, $context, &$defaultPreferences)
Loads existing values for a given array of preferences.
static getSaveBlacklist()
static filesPreferences( $user, IContextSource $context, &$defaultPreferences)
static getImageSizes(IContextSource $context)
static getPreferences( $user, IContextSource $context)
static getTimeZoneList(Language $language)
Get a list of all time zones.
static watchlistPreferences( $user, IContextSource $context, &$defaultPreferences)
static datetimePreferences( $user, IContextSource $context, &$defaultPreferences)
static getDateOptions(IContextSource $context)
static miscPreferences( $user, IContextSource $context, &$defaultPreferences)
Dummy, kept for backwards-compatibility.
static profilePreferences( $user, IContextSource $context, &$defaultPreferences)
static cleanSignature( $signature, $alldata, $form)
static getFormObject( $user, IContextSource $context, $formClass=PreferencesFormLegacy::class, array $remove=[])
static renderingPreferences( $user, IContextSource $context, &$defaultPreferences)
static getTimezoneOptions(IContextSource $context)
static skinPreferences( $user, IContextSource $context, &$defaultPreferences)
static getThumbSizes(IContextSource $context)
static filterTimezoneInput( $tz, $alldata)
static validateSignature( $signature, $alldata, $form)
static editingPreferences( $user, IContextSource $context, &$defaultPreferences)
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
Definition hooks.txt:2885
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place or wrap services the preferred way to define a new service is the $wgServiceWiringFiles array $services
Definition hooks.txt:2335
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form before processing starts Return false to skip default processing and return $ret $linkRenderer
Definition hooks.txt:2105
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
Definition hooks.txt:247
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition injection.txt:37
Interface for objects which can provide a MediaWiki context on request.
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))