r97365 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97364‎ | r97365 | r97366 >
Date:02:42, 17 September 2011
Author:krinkle
Status:ok
Tags:
Comment:
(bug 30940) Add a hook in User:getDefaultOptions.

Needs back porting to 1.18 in order to fix Gadgets in REL1_18
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.18 (modified) (history)
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -2006,6 +2006,10 @@
20072007 'UserGetAllRights': after calculating a list of all available rights
20082008 &$rights: Array of rights, which may be added to.
20092009
 2010+'UserGetDefaultOptions': after fetching the core default, this hook is ran
 2011+right before returning the options to the caller.
 2012+&$defaultOptions: Array of preference keys and their default values.
 2013+
20102014 'UserGetEmail': called when getting an user email address
20112015 $user: User object
20122016 &$email: email, change this to override local email
Index: trunk/phase3/RELEASE-NOTES-1.18
@@ -211,6 +211,13 @@
212212 * New maintenance script to refresh image metadata (maintenance/refreshImageMetadata.php)
213213 * (bug 30722) Add an identity collation that sorts things based on what the
214214 unicode code point is (aka pre-1.17 behaviour)
 215+* (bug 30940) Add a hook in User:getDefaultOptions.
 216+ To give extensions a better and more flexible way of providing default
 217+ values for preferences a hook has been introdiced in User:getDefaultOptions().
 218+ Setting preferences in $wgDefaultUserOptions still work fine, but when reading
 219+ them (i.e. with array_keys) to get a list of all preferences, then
 220+ $wgDefaultUserOptions should no longer be used as it will contain those set via
 221+ User:getDefaultOptions().
215222
216223 === Bug fixes in 1.18 ===
217224 * mw.util.getScript has been implemented (like wfScript in GlobalFunctions.php)
Index: trunk/phase3/includes/User.php
@@ -1214,6 +1214,8 @@
12151215 }
12161216 $defOpt['skin'] = $wgDefaultSkin;
12171217
 1218+ wfRunHooks( 'UserGetDefaultOptions', array( &$defOpt ) );
 1219+
12181220 return $defOpt;
12191221 }
12201222

Follow-up revisions

RevisionCommit summaryAuthorDate
r97366[ResourceLoader2] Set default options for gadgets that are enabled by default...krinkle02:46, 17 September 2011
r97367[ResourceLoader] Set default options for gadgets that are enabled by default,...krinkle03:03, 17 September 2011
r974141.18: MFT r96775, r97362, r97365, r97381catrope11:36, 18 September 2011
r101488Cache the result of User::getDefaultOptions(), so the UserGetDefaultOptions h...catrope15:55, 1 November 2011

Status & tagging log