jenkins-bot has submitted this change and it was merged.

Change subject: Improved BSCoreConfigGet Hook
......................................................................


Improved BSCoreConfigGet Hook

* Added doc

Change-Id: Ifaa14b435bf0d5a75037ec372767d8f2482b5a8e
---
M doc/hooks.txt
M includes/Config.class.php
2 files changed, 15 insertions(+), 13 deletions(-)

Approvals:
  Tweichart: Looks good to me, but someone else must approve
  Pwirth: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/doc/hooks.txt b/doc/hooks.txt
index ae488f4..a3920f9 100644
--- a/doc/hooks.txt
+++ b/doc/hooks.txt
@@ -13,4 +13,9 @@
 'BsFoundationBeforeMakeGlobalVariablesScript': Allows last minute manipulation 
 of the RENDER_AS_JAVASCRIPT config vars
 $oUser: The current MediaWiki User object
-&$aScriptSettings: Array of script settings (BsConfig::getScriptSettings())
\ No newline at end of file
+&$aScriptSettings: Array of script settings (BsConfig::getScriptSettings())
+
+'BSCoreConfigGet': Allows override of the config return value before the 
setting
+is loaded - return false to use own value
+$sPath: Key of the Config (Like 'MW::SomeExttension::SomePreference')
+&$mReturn: Value to return, when hook handler returns false
\ No newline at end of file
diff --git a/includes/Config.class.php b/includes/Config.class.php
index da5a355..904763b 100644
--- a/includes/Config.class.php
+++ b/includes/Config.class.php
@@ -175,23 +175,20 @@
        }
 
        /**
-        * gets the value of the variable, which is specified by the path
-        *
-        * @param string $path
-        *              The unique identifier the variable should be accessibly 
by. I.e. 'Adapter::Extension::MyVar'.
+        * Gets the value of the variable, which is specified by the path
+        * @param string $sPath The unique identifier the variable should be 
accessibly by. I.e. 'Adapter::Extension::MyVar'.
         * @return mixed the value
         */
-       public static function get( $path ) {
+       public static function get( $sPath ) {
                wfProfileIn ( 'BS::Core::ConfigGet' );
 
-               if ( function_exists ( 'wfRunHooks' ) ) {
-                       $bChanged = false;
-                       wfRunHooks ( "BSCoreConfigGet", array ( &$path, 
&$bChanged ) );
-                       if ( $bChanged === true ) {
-                               return $path;
-                       }
+               $mReturn = null;
+               if( !wfRunHooks ( "BSCoreConfigGet", array ( $sPath, &$mReturn 
) ) ) {
+                       wfProfileOut ( 'BS::Core::ConfigGet' );
+                       return $mReturn;
                }
-               $oSetting = self::getSettingObject ( $path );
+
+               $oSetting = self::getSettingObject ( $sPath );
 
                wfProfileOut ( 'BS::Core::ConfigGet' );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/224755
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifaa14b435bf0d5a75037ec372767d8f2482b5a8e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: Pwirth <wi...@hallowelt.biz>
Gerrit-Reviewer: Mglaser <gla...@hallowelt.biz>
Gerrit-Reviewer: Pwirth <wi...@hallowelt.biz>
Gerrit-Reviewer: Robert Vogel <vo...@hallowelt.biz>
Gerrit-Reviewer: Tweichart <weich...@hallowelt.biz>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to