mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 09:49:22 +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);
|
deleteDirectory(CACHE, ['signatures', 'twig', 'plugins', 'index.html', 'persistent'], true);
|
||||||
|
|
||||||
// routes cache
|
// routes cache
|
||||||
|
clearRouteCache();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearRouteCache(): void
|
||||||
|
{
|
||||||
$routeCacheFile = CACHE . 'route.cache';
|
$routeCacheFile = CACHE . 'route.cache';
|
||||||
if (file_exists($routeCacheFile)) {
|
if (file_exists($routeCacheFile)) {
|
||||||
unlink($routeCacheFile);
|
unlink($routeCacheFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCustomPageInfo($name)
|
function getCustomPageInfo($name)
|
||||||
|
@ -63,7 +63,7 @@ class Pages
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ModelsPages::where('name', $name)->exists())
|
if (!ModelsPages::where('name', $name)->exists()) {
|
||||||
ModelsPages::create([
|
ModelsPages::create([
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
@ -73,6 +73,8 @@ class Pages
|
|||||||
'enable_tinymce' => $enable_tinymce ? '1' : '0',
|
'enable_tinymce' => $enable_tinymce ? '1' : '0',
|
||||||
'access' => $access
|
'access' => $access
|
||||||
]);
|
]);
|
||||||
|
clearRouteCache();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
$errors[] = 'Page with this link already exists.';
|
$errors[] = 'Page with this link already exists.';
|
||||||
|
|
||||||
@ -94,6 +96,8 @@ class Pages
|
|||||||
'enable_tinymce' => $enable_tinymce ? '1' : '0',
|
'enable_tinymce' => $enable_tinymce ? '1' : '0',
|
||||||
'access' => $access
|
'access' => $access
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
clearRouteCache();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,6 +107,7 @@ class Pages
|
|||||||
$row = ModelsPages::find($id);
|
$row = ModelsPages::find($id);
|
||||||
if ($row) {
|
if ($row) {
|
||||||
$row->delete();
|
$row->delete();
|
||||||
|
clearRouteCache();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$errors[] = 'Page with id ' . $id . ' does not exists.';
|
$errors[] = 'Page with id ' . $id . ' does not exists.';
|
||||||
@ -121,6 +126,9 @@ class Pages
|
|||||||
if (!$row->save()) {
|
if (!$row->save()) {
|
||||||
$errors[] = 'Fail during toggle hidden Page.';
|
$errors[] = 'Fail during toggle hidden Page.';
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
clearRouteCache();
|
||||||
|
}
|
||||||
$status = $row->hidden;
|
$status = $row->hidden;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user