r97413 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97412‎ | r97413 | r97414 >
Date:11:21, 18 September 2011
Author:catrope
Status:ok
Tags:
Comment:
1.18: MFT r97367, r97380
Modified paths:
  • /branches/REL1_18/extensions/Gadgets/Gadgets.php (modified) (history)
  • /branches/REL1_18/extensions/Gadgets/Gadgets_body.php (modified) (history)

Diff [purge]

Index: branches/REL1_18/extensions/Gadgets/Gadgets_body.php
@@ -31,6 +31,24 @@
3232 }
3333
3434 /**
 35+ * UserGetDefaultOptions hook handler
 36+ * @param $defaultOptions Array of default preference keys and values
 37+ */
 38+ public static function userGetDefaultOptions( &$defaultOptions ) {
 39+ $gadgets = Gadget::loadStructuredList();
 40+ if (!$gadgets) return true;
 41+
 42+ foreach( $gadgets as $section => $thisSection ) {
 43+ foreach( $thisSection as $gadgetId => $gadget ) {
 44+ if ( $gadget->isOnByDefault() ) {
 45+ $defaultOptions['gadget-' . $gadgetId] = 1;
 46+ }
 47+ }
 48+ }
 49+ return true;
 50+ }
 51+
 52+ /**
3553 * GetPreferences hook handler.
3654 * @param $user User
3755 * @param $preferences Array: Preference descriptions
Property changes on: branches/REL1_18/extensions/Gadgets/Gadgets_body.php
___________________________________________________________________
Modified: svn:mergeinfo
3856 Merged /trunk/extensions/Gadgets/Gadgets_body.php:r97034,97367,97380
Index: branches/REL1_18/extensions/Gadgets/Gadgets.php
@@ -17,8 +17,8 @@
1818 die( 1 );
1919 }
2020
21 -if ( version_compare( $wgVersion, '1.17alpha', '<' ) ) {
22 - die( "This version of Extension:Gadgets requires MediaWiki 1.17+\n" );
 21+if ( version_compare( $wgVersion, '1.18alpha', '<' ) ) {
 22+ die( "This version of Extension:Gadgets requires MediaWiki 1.18+\n" );
2323 }
2424
2525 $wgExtensionCredits['other'][] = array(
@@ -31,6 +31,7 @@
3232
3333 $wgHooks['ArticleSaveComplete'][] = 'GadgetHooks::articleSaveComplete';
3434 $wgHooks['BeforePageDisplay'][] = 'GadgetHooks::beforePageDisplay';
 35+$wgHooks['UserGetDefaultOptions'][] = 'GadgetHooks::userGetDefaultOptions';
3536 $wgHooks['GetPreferences'][] = 'GadgetHooks::getPreferences';
3637 $wgHooks['ResourceLoaderRegisterModules'][] = 'GadgetHooks::registerModules';
3738 $wgHooks['UnitTestsList'][] = 'GadgetHooks::unitTestsList';

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r97367[ResourceLoader] Set default options for gadgets that are enabled by default,...krinkle03:03, 17 September 2011
r97380Per r97367 CR. Add 'alpha'. 1.18alpha is less than 1.18, and it works in that...krinkle16:34, 17 September 2011

Status & tagging log