mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 09:49:22 +02:00
Settings::clearCache function
This commit is contained in:
parent
649e37ab0f
commit
235e69b8da
@ -38,8 +38,7 @@ class Settings implements \ArrayAccess
|
|||||||
}
|
}
|
||||||
|
|
||||||
$settings = ModelsSettings::all();
|
$settings = ModelsSettings::all();
|
||||||
foreach ($settings as $setting)
|
foreach ($settings as $setting) {
|
||||||
{
|
|
||||||
$this->settingsDatabase[$setting->name][$setting->key] = $setting->value;
|
$this->settingsDatabase[$setting->name][$setting->key] = $setting->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,11 +92,7 @@ class Settings implements \ArrayAccess
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache = Cache::getInstance();
|
$this->clearCache();
|
||||||
if ($cache->enabled()) {
|
|
||||||
$cache->delete('settings');
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,6 +105,8 @@ class Settings implements \ArrayAccess
|
|||||||
// insert new
|
// insert new
|
||||||
ModelsSettings::create(['name' => $pluginName, 'key' => $key, 'value' => $value]);
|
ModelsSettings::create(['name' => $pluginName, 'key' => $key, 'value' => $value]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->clearCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function deleteFromDatabase($pluginName, $key = null)
|
public function deleteFromDatabase($pluginName, $key = null)
|
||||||
@ -120,6 +117,8 @@ class Settings implements \ArrayAccess
|
|||||||
else {
|
else {
|
||||||
ModelsSettings::where('name', $pluginName)->where('key', $key)->delete();
|
ModelsSettings::where('name', $pluginName)->where('key', $key)->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->clearCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function display($plugin, $settings): array
|
public static function display($plugin, $settings): array
|
||||||
@ -604,4 +603,12 @@ class Settings implements \ArrayAccess
|
|||||||
public function getErrors() {
|
public function getErrors() {
|
||||||
return $this->errors;
|
return $this->errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function clearCache(): void
|
||||||
|
{
|
||||||
|
$cache = Cache::getInstance();
|
||||||
|
if ($cache->enabled()) {
|
||||||
|
$cache->delete('settings');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user