- public static function get($family, $key, $default_value = null, $refresh = false) {
-
- $a = get_app();
-
- if (!$refresh) {
-
- // Do we have the cached value? Then return it
- if (isset(self::$cache[$family][$key])) {
- if (self::$cache[$family][$key] === '!<unset>!') {
- return $default_value;
- } else {
- return self::$cache[$family][$key];
- }
- }
- }
-
- $ret = dba::select('config', array('v'), array('cat' => $family, 'k' => $key), array('limit' => 1));
- if (dbm::is_result($ret)) {
- // manage array value
- $val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret['v']) ? unserialize($ret['v']) : $ret['v']);
-
- // Assign the value from the database to the cache
- self::$cache[$family][$key] = $val;
- self::$in_db[$family][$key] = true;
- return $val;
- } elseif (isset($a->config[$family][$key])) {
-
- // Assign the value (mostly) from the .htconfig.php to the cache
- self::$cache[$family][$key] = $a->config[$family][$key];
- self::$in_db[$family][$key] = false;
-
- return $a->config[$family][$key];
+ public static function get($family, $key, $default_value = null, $refresh = false)
+ {
+ if (empty(self::$adapter)) {
+ self::init();