X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FConfig%2FJITConfigAdapter.php;h=ed5f1a3f673ed0b623af7182972335143181c0e7;hb=3282ce53894b624893ee2989747a59866ab4b137;hp=96e4305ea39e87f38c226b0930c543fa8cb139e1;hpb=2fa6cc000013089d59d9cc221b544ed1a7a4cd37;p=friendica.git diff --git a/src/Core/Config/JITConfigAdapter.php b/src/Core/Config/JITConfigAdapter.php index 96e4305ea3..ed5f1a3f67 100644 --- a/src/Core/Config/JITConfigAdapter.php +++ b/src/Core/Config/JITConfigAdapter.php @@ -1,18 +1,15 @@ + * @author Hypolite Petovan */ class JITConfigAdapter extends BaseObject implements IConfigAdapter { @@ -27,8 +24,8 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter return; } - $configs = dba::select('config', ['v', 'k'], ['cat' => $cat]); - while ($config = dba::fetch($configs)) { + $configs = DBA::select('config', ['v', 'k'], ['cat' => $cat]); + while ($config = DBA::fetch($configs)) { $k = $config['k']; self::getApp()->setConfigValue($cat, $k, $config['v']); @@ -38,7 +35,7 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter $this->in_db[$cat][$k] = true; } } - dba::close($configs); + DBA::close($configs); } public function get($cat, $k, $default_value = null, $refresh = false) @@ -56,8 +53,8 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter } } - $config = dba::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $k]); - if (DBM::is_result($config)) { + $config = DBA::selectFirst('config', ['v'], ['cat' => $cat, 'k' => $k]); + if (DBA::isResult($config)) { // manage array value $value = (preg_match("|^a:[0-9]+:{.*}$|s", $config['v']) ? unserialize($config['v']) : $config['v']); @@ -66,13 +63,13 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter $this->in_db[$cat][$k] = true; return $value; } elseif (isset($a->config[$cat][$k])) { - // Assign the value (mostly) from config/local.ini.php file to the cache + // Assign the value (mostly) from config/local.config.php file to the cache $this->cache[$cat][$k] = $a->config[$cat][$k]; $this->in_db[$cat][$k] = false; return $a->config[$cat][$k]; } elseif (isset($a->config[$k])) { - // Assign the value (mostly) from config/local.ini.php file to the cache + // Assign the value (mostly) from config/local.config.php file to the cache $this->cache[$k] = $a->config[$k]; $this->in_db[$k] = false; @@ -96,6 +93,13 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter $stored = $this->get($cat, $k, null, true); + if (!isset($this->in_db[$cat])) { + $this->in_db[$cat] = []; + } + if (!isset($this->in_db[$cat][$k])) { + $this->in_db[$cat] = false; + } + if (($stored === $dbvalue) && $this->in_db[$cat][$k]) { return true; } @@ -108,7 +112,7 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter // manage array value $dbvalue = (is_array($value) ? serialize($value) : $dbvalue); - $result = dba::update('config', ['v' => $dbvalue], ['cat' => $cat, 'k' => $k], true); + $result = DBA::update('config', ['v' => $dbvalue], ['cat' => $cat, 'k' => $k], true); if ($result) { $this->in_db[$cat][$k] = true; @@ -124,7 +128,7 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter unset($this->in_db[$cat][$k]); } - $result = dba::delete('config', ['cat' => $cat, 'k' => $k]); + $result = DBA::delete('config', ['cat' => $cat, 'k' => $k]); return $result; }