MediaWiki REL1_33
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
55 public static function getPreferences( $user, IContextSource $context ) {
56 wfDeprecated( __METHOD__, '1.31' );
57 $preferencesFactory = self::getDefaultPreferencesFactory();
58 return $preferencesFactory->getFormDescriptor( $user, $context );
59 }
60
69 public static function loadPreferenceValues( $user, $context, &$defaultPreferences ) {
70 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
71 }
72
81 public static function getOptionFromUser( $name, $info, $user ) {
82 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
83 }
84
91 public static function profilePreferences(
92 $user, IContextSource $context, &$defaultPreferences
93 ) {
94 wfDeprecated( __METHOD__, '1.31' );
95 $defaultPreferences = self::getPreferences( $user, $context );
96 }
97
104 public static function skinPreferences( $user, IContextSource $context, &$defaultPreferences ) {
105 wfDeprecated( __METHOD__, '1.31' );
106 $defaultPreferences = self::getPreferences( $user, $context );
107 }
108
114 public static function filesPreferences(
115 $user, IContextSource $context, &$defaultPreferences
116 ) {
117 wfDeprecated( __METHOD__, '1.31' );
118 $defaultPreferences = self::getPreferences( $user, $context );
119 }
120
127 public static function datetimePreferences(
128 $user, IContextSource $context, &$defaultPreferences
129 ) {
130 wfDeprecated( __METHOD__, '1.31' );
131 $defaultPreferences = self::getPreferences( $user, $context );
132 }
133
139 public static function renderingPreferences(
140 $user, IContextSource $context, &$defaultPreferences
141 ) {
142 wfDeprecated( __METHOD__, '1.31' );
143 $defaultPreferences = self::getPreferences( $user, $context );
144 }
145
151 public static function editingPreferences(
152 $user, IContextSource $context, &$defaultPreferences
153 ) {
154 wfDeprecated( __METHOD__, '1.31' );
155 $defaultPreferences = self::getPreferences( $user, $context );
156 }
157
163 public static function rcPreferences( $user, IContextSource $context, &$defaultPreferences ) {
164 wfDeprecated( __METHOD__, '1.31' );
165 $defaultPreferences = self::getPreferences( $user, $context );
166 }
167
173 public static function watchlistPreferences(
174 $user, IContextSource $context, &$defaultPreferences
175 ) {
176 wfDeprecated( __METHOD__, '1.31' );
177 $defaultPreferences = self::getPreferences( $user, $context );
178 }
179
185 public static function searchPreferences(
186 $user, IContextSource $context, &$defaultPreferences
187 ) {
188 wfDeprecated( __METHOD__, '1.31' );
189 $defaultPreferences = self::getPreferences( $user, $context );
190 }
191
198 public static function miscPreferences( $user, IContextSource $context, &$defaultPreferences ) {
199 wfDeprecated( __METHOD__, '1.31' );
200 }
201
207 public static function generateSkinOptions( $user, IContextSource $context ) {
208 wfDeprecated( __METHOD__, '1.31' );
210 }
211
217 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
218 }
219
224 public static function getImageSizes( IContextSource $context ) {
225 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
226 }
227
232 public static function getThumbSizes( IContextSource $context ) {
233 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
234 }
235
242 public static function validateSignature( $signature, $alldata, $form ) {
243 throw new Exception( __METHOD__ . '() is deprecated and does nothing' );
244 }
245
252 public static function cleanSignature( $signature, $alldata, $form ) {
253 throw new Exception( __METHOD__ . '() is deprecated and does nothing now' );
254 }
255
263 public static function getFormObject(
264 $user,
266 $formClass = PreferencesFormLegacy::class,
267 array $remove = []
268 ) {
269 wfDeprecated( __METHOD__, '1.31' );
270 $preferencesFactory = self::getDefaultPreferencesFactory();
271 return $preferencesFactory->getForm( $user, $context, $formClass, $remove );
272 }
273}
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.
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 generateSkinOptions( $user, IContextSource $context)
static loadPreferenceValues( $user, $context, &$defaultPreferences)
Loads existing values for a given array of preferences.
static filesPreferences( $user, IContextSource $context, &$defaultPreferences)
static getImageSizes(IContextSource $context)
static getPreferences( $user, IContextSource $context)
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 skinPreferences( $user, IContextSource $context, &$defaultPreferences)
static getThumbSizes(IContextSource $context)
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:2848
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:2290
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:2054
return true to allow those checks to and false if checking is done & $user
Definition hooks.txt:1510
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))