refactor(shop-coupon): migrate admin module to DI and release 0.266
This commit is contained in:
@@ -18,7 +18,13 @@ class LayoutsRepository
|
||||
return false;
|
||||
}
|
||||
|
||||
return (bool)$this->db->delete('pp_layouts', ['id' => $layoutId]);
|
||||
$deleted = (bool)$this->db->delete('pp_layouts', ['id' => $layoutId]);
|
||||
if ($deleted) {
|
||||
\S::delete_dir('../temp/');
|
||||
$this->clearFrontLayoutsCache();
|
||||
}
|
||||
|
||||
return $deleted;
|
||||
}
|
||||
|
||||
public function find(int $layoutId): array
|
||||
@@ -77,6 +83,7 @@ class LayoutsRepository
|
||||
$this->syncCategories($layoutId, $data['categories'] ?? []);
|
||||
|
||||
\S::delete_dir('../temp/');
|
||||
$this->clearFrontLayoutsCache();
|
||||
|
||||
return $layoutId;
|
||||
}
|
||||
@@ -288,6 +295,22 @@ class LayoutsRepository
|
||||
];
|
||||
}
|
||||
|
||||
private function clearFrontLayoutsCache(): void
|
||||
{
|
||||
if (!class_exists('\CacheHandler')) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$cacheHandler = new \CacheHandler();
|
||||
if (method_exists($cacheHandler, 'deletePattern')) {
|
||||
$cacheHandler->deletePattern('*Layouts::*');
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
// Inwalidacja cache nie moze blokowac zapisu/usuwania.
|
||||
}
|
||||
}
|
||||
|
||||
private function menuPages(int $menuId, $parentId = null): array
|
||||
{
|
||||
if ($menuId <= 0) {
|
||||
|
||||
Reference in New Issue
Block a user