Robert Vogel has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/267221

Change subject: Added config file registry
......................................................................

Added config file registry

This change introduces a simple config file registry that allows
extensions to dynamically add config files that will be included with
BlueSpice.

A follow up commit of BlueSpiceExtensions will be necessary for this to
work.

Change-Id: I8eb4d80a5d832b5bd874762d03642587576b80d0
---
M includes/CoreHooks.php
M includes/DefaultSettings.php
2 files changed, 17 insertions(+), 8 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceFoundation 
refs/changes/21/267221/1

diff --git a/includes/CoreHooks.php b/includes/CoreHooks.php
index 929987f..3b170fe 100755
--- a/includes/CoreHooks.php
+++ b/includes/CoreHooks.php
@@ -10,17 +10,16 @@
                $wgNamespacePermissionLockdown, $wgSpecialPageLockdown, 
$wgActionLockdown, $wgNonincludableNamespaces,
                $wgExtraNamespaces, $wgContentNamespaces, 
$wgNamespacesWithSubpages, $wgNamespacesToBeSearchedDefault,
                $wgLocalisationCacheConf, $wgAutoloadLocalClasses, 
$wgFlaggedRevsNamespaces, $wgNamespaceAliases, $wgVersion;
+               /*
+                * TODO: All those globals above can be removed once all 
included
+                * settings files use $GLOBALS['wg...'] to access them
+                */
 
-               $sConfigPath = BSCONFIGDIR;
-               $aConfigFiles = array(
-                       'nm-settings.php',
-                       'gm-settings.php',
-                       'pm-settings.php'
-               );
+               global $bsgConfigFiles;
 
-               foreach ( $aConfigFiles as $sConfigFile) {
-                       $sConfigFilePath = $sConfigPath . DS . $sConfigFile;
+               foreach( $bsgConfigFiles as $sConfigFileKey => $sConfigFilePath 
) {
                        if ( file_exists( $sConfigFilePath ) ) {
+                               error_log( "$sConfigFileKey --> 
$sConfigFilePath");
                                include( $sConfigFilePath );
                        }
                }
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 30575aa..8e23b9c 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -181,3 +181,13 @@
 $bsgSystemNamespaces = array(
        //1599 => 'NS_COOL_STUFF'
 );
+
+/**
+ * PHP config files registered here will be included on "SetupAfterCache"
+ * time. Access to all global config variables need to be in the form of
+ * $GLOBALS['wg...'] as the inclusion will be done in callback function scope
+ * rather than in global scope.
+ */
+$bsgConfigFiles = array(
+       //'extensionname' => 'path/to/file.php'
+);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8eb4d80a5d832b5bd874762d03642587576b80d0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceFoundation
Gerrit-Branch: master
Gerrit-Owner: Robert Vogel <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to