r97004 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97003‎ | r97004 | r97005 >
Date:21:24, 13 September 2011
Author:krinkle
Status:ok
Tags:
Comment:
[ResourceLoader 2]: Use context instead of global in beforePageDisplay hook
* Follows-up r96949
Modified paths:
  • /branches/RL2/extensions/Gadgets/GadgetHooks.php (modified) (history)

Diff [purge]

Index: branches/RL2/extensions/Gadgets/GadgetHooks.php
@@ -273,13 +273,12 @@
274274 * @param $out OutputPage
275275 */
276276 public static function beforePageDisplay( $out ) {
277 - global $wgUser;
278 -
279277 wfProfileIn( __METHOD__ );
280 -
 278+
 279+ $user = $out->getUser();
281280 $gadgets = GadgetRepo::getAllGadgets();
282281 foreach ( $gadgets as $gadget ) {
283 - if ( $gadget->isEnabledForUser( $wgUser ) && $gadget->isAllowed( $wgUser ) ) {
 282+ if ( $gadget->isEnabledForUser( $user ) && $gadget->isAllowed( $user ) ) {
284283 $out->addModules( $gadget->getModuleName() );
285284 }
286285 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r96949RL2: Factor out $wgGadgetRepositories loop to GadgetRepo::getAllRepos() and i...catrope10:17, 13 September 2011

Status & tagging log