as discussed with @fichtner, add invalidateCache() to acl and menu system

This commit is contained in:
Ad Schellevis 2017-12-15 19:34:35 +01:00
parent a5d91a7e9b
commit b2a2fbdf6e
3 changed files with 22 additions and 2 deletions

View File

@ -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();

View File

@ -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.

View File

@ -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