refactor(shop-coupon): migrate admin module to DI and release 0.266

This commit is contained in:
2026-02-14 00:05:23 +01:00
parent 88e5673569
commit 40e777afe6
40 changed files with 1668 additions and 426 deletions

View File

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