mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 09:04:39 +00:00
as discussed with @fichtner, add invalidateCache() to acl and menu system
This commit is contained in:
parent
a5d91a7e9b
commit
b2a2fbdf6e
@ -47,5 +47,5 @@ system_firmware_configure(true);
|
||||
system_login_configure(true);
|
||||
|
||||
/* flush cache */
|
||||
(new OPNsense\Core\ACL())->persist();
|
||||
(new OPNsense\Base\Menu\MenuSystem())->persist();
|
||||
(new OPNsense\Core\ACL())->invalidateCache();
|
||||
(new OPNsense\Base\Menu\MenuSystem())->invalidateCache();
|
||||
|
||||
@ -94,6 +94,16 @@ class MenuSystem
|
||||
return $node->append($id, $properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* invalidate cache, removes cache file from disk if available, which forces the next request to persist() again
|
||||
*/
|
||||
public function invalidateCache()
|
||||
{
|
||||
if (file_exists($this->menuCacheFilename)) {
|
||||
unlink($this->menuCacheFilename);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load and persist Menu configuration to disk.
|
||||
* @param bool $nowait when the cache is locked, skip waiting for it to become available.
|
||||
|
||||
@ -304,6 +304,16 @@ class ACL
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* invalidate cache, removes cache file from disk if available, which forces the next request to persist() again
|
||||
*/
|
||||
public function invalidateCache()
|
||||
{
|
||||
if (file_exists($this->aclCacheFilename)) {
|
||||
unlink($this->aclCacheFilename);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* check if pluggable ACL's are expired
|
||||
* @return bool is expired
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user