From f8121585ae97890245b1969cb62fbef583462b7d Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 22 Jan 2009 12:44:57 +0100 Subject: further updates to config_cascade patch - add mediameta and license config files into the cascade - update the cache validity code in cache.php, css.php & js.php to use config_cascade - redo inclusion of main config files to avoid suppression of errors in config files - add getConfigFiles($type) function - minor updates elsewhere to use config_cascade rather than hardcoded config file names darcs-hash:20090122114457-f07c6-98ad5627fd5df93edf8dd03289b9cf6d81962afe.gz --- inc/confutils.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'inc/confutils.php') diff --git a/inc/confutils.php b/inc/confutils.php index 2099ba949..53db69565 100644 --- a/inc/confutils.php +++ b/inc/confutils.php @@ -181,6 +181,27 @@ function retrieveConfig($type,$fn) { return $combined; } +/** + * Include the requested configuration information + * + * @author Chris Smith + * + * @param string $type the configuration settings to be read, must correspond to a key/array in $config_cascade + * @return array list of files, default before local before protected + */ +function getConfigFiles($type) { + global $config_cascade; + $files = array(); + + if (!is_array($config_cascade[$type])) trigger_error('Missing config cascade for "'.$type.'"',E_USER_WARNING); + foreach (array('default','local','protected') as $config_group) { + if (empty($config_cascade[$type][$config_group])) continue; + $files = array_merge($files, $config_cascade[$type][$config_group]); + } + + return $files; +} + /** * check if the given action was disabled in config * -- cgit v1.2.3