mirror of
https://github.com/friendica/friendica
synced 2025-04-26 12:30:11 +00:00
Adding ConfigCacheTest
This commit is contained in:
parent
b6e2c254fb
commit
2a42f8dded
3 changed files with 185 additions and 3 deletions
|
@ -2,8 +2,6 @@
|
|||
|
||||
namespace Friendica\Core\Config;
|
||||
|
||||
use Friendica\Database\DBA;
|
||||
|
||||
abstract class AbstractDbaConfigAdapter
|
||||
{
|
||||
/** @var bool */
|
||||
|
|
|
@ -18,7 +18,7 @@ class ConfigCache implements IConfigCache, IPConfigCache
|
|||
*/
|
||||
public function __construct(array $config = [])
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->loadConfigArray($config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,6 +110,9 @@ class ConfigCache implements IConfigCache, IPConfigCache
|
|||
} else {
|
||||
if (isset($this->config[$cat][$key])) {
|
||||
unset($this->config[$cat][$key]);
|
||||
if (count($this->config[$cat]) == 0) {
|
||||
unset($this->config[$cat]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -160,6 +163,12 @@ class ConfigCache implements IConfigCache, IPConfigCache
|
|||
{
|
||||
if (isset($this->config[$uid][$cat][$key])) {
|
||||
unset($this->config[$uid][$cat][$key]);
|
||||
if (count($this->config[$uid][$cat]) == 0) {
|
||||
unset($this->config[$uid][$cat]);
|
||||
if (count($this->config[$uid]) == 0) {
|
||||
unset($this->config[$uid]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue