- // If $a->config[$family] has been previously set to '!<unset>!', then
- // $a->config[$family][$key] will evaluate to $a->config[$family][0], and
- // $a->config[$family][$key] = $value will be equivalent to
- // $a->config[$family][0] = $value[0] (this causes infuriating bugs),
- // so unset the family before assigning a value to a family's key
- if($a->config[$family] === '!<unset>!')
- unset($a->config[$family]);
+ $stored = self::get($family, $key, null, true);
+
+ if (($stored === $dbvalue) AND self::$in_db[$family][$key]) {
+ return true;
+ }
+
+ if ($family === 'config') {
+ $a->config[$key] = $dbvalue;
+ } elseif ($family != 'system') {
+ $a->config[$family][$key] = $dbvalue;
+ }
+
+ // Assign the just added value to the cache
+ self::$cache[$family][$key] = $dbvalue;