mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 17:29:21 +02:00
clearRouteCache on database pages change
This commit is contained in:
parent
e18ada3d9d
commit
b1224d9d1a
@ -1265,12 +1265,17 @@ function clearCache()
|
||||
deleteDirectory(CACHE, ['signatures', 'twig', 'plugins', 'index.html', 'persistent'], true);
|
||||
|
||||
// routes cache
|
||||
clearRouteCache();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function clearRouteCache(): void
|
||||
{
|
||||
$routeCacheFile = CACHE . 'route.cache';
|
||||
if (file_exists($routeCacheFile)) {
|
||||
unlink($routeCacheFile);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function getCustomPageInfo($name)
|
||||
|
@ -63,7 +63,7 @@ class Pages
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ModelsPages::where('name', $name)->exists())
|
||||
if (!ModelsPages::where('name', $name)->exists()) {
|
||||
ModelsPages::create([
|
||||
'name' => $name,
|
||||
'title' => $title,
|
||||
@ -73,6 +73,8 @@ class Pages
|
||||
'enable_tinymce' => $enable_tinymce ? '1' : '0',
|
||||
'access' => $access
|
||||
]);
|
||||
clearRouteCache();
|
||||
}
|
||||
else
|
||||
$errors[] = 'Page with this link already exists.';
|
||||
|
||||
@ -94,6 +96,8 @@ class Pages
|
||||
'enable_tinymce' => $enable_tinymce ? '1' : '0',
|
||||
'access' => $access
|
||||
]);
|
||||
|
||||
clearRouteCache();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -103,6 +107,7 @@ class Pages
|
||||
$row = ModelsPages::find($id);
|
||||
if ($row) {
|
||||
$row->delete();
|
||||
clearRouteCache();
|
||||
}
|
||||
else
|
||||
$errors[] = 'Page with id ' . $id . ' does not exists.';
|
||||
@ -121,6 +126,9 @@ class Pages
|
||||
if (!$row->save()) {
|
||||
$errors[] = 'Fail during toggle hidden Page.';
|
||||
}
|
||||
else {
|
||||
clearRouteCache();
|
||||
}
|
||||
$status = $row->hidden;
|
||||
}
|
||||
else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user