You are here

function strongarm_get_conf in Strongarm 6

Retrieve variable configuration from the cache.

6 calls to strongarm_get_conf()
strongarm_admin_form in ./strongarm.admin.inc
Variable management strongarm form.
strongarm_admin_revert_submit in ./strongarm.admin.inc
Revert form submit handler.
strongarm_boot in ./strongarm.module
Implementation of hook_boot(). This is a very aggressive way of ensuring that these variables are set. Necessary for variables that are checked by modules on hook_init().
strongarm_drush_export in ./strongarm.drush.inc
strongarm_init in ./strongarm.module
Implementation of hook_init().

... See full list

File

./strongarm.module, line 38

Code

function strongarm_get_conf($bootstrapped = TRUE, $reset = FALSE) {
  static $var_conf;
  if (!isset($var_conf) || $reset) {
    if (!$reset) {
      $cache = cache_get('strongarm', 'cache');
      $var_conf = $cache ? $cache->data : NULL;
    }
    if (!isset($var_conf) && $bootstrapped) {

      // We don't use module_invoke_all() here since
      // array_merge_recursive() can alter the desired structure of
      // some variables.
      foreach (module_implements('strongarm') as $module) {
        $module_conf = module_invoke($module, 'strongarm');
        foreach ($module_conf as $name => $value) {
          if (isset($var_conf[$name])) {
            if (is_array($value)) {
              $var_conf[$name] = array_merge($var_conf[$name], $value);
            }
            else {

              // Blow the earlier one away
              $var_conf[$name] = $value;
            }
          }
          else {
            $var_conf[$name] = $value;
          }
        }
      }
      cache_set('strongarm', $var_conf);
    }
  }
  return $var_conf;
}