From 03ba4b8570198a127b0a3929e558cb9ed37331e0 Mon Sep 17 00:00:00 2001 From: Knah-Tsaeb Date: Mon, 17 Jun 2024 11:48:42 +0200 Subject: [PATCH] Forgot move cache outside public dir --- .gitignore | 1 + app/App.php | 6 +++--- cache/.gitkeep | 0 public/index.php | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 cache/.gitkeep diff --git a/.gitignore b/.gitignore index 3c81c2f..ea1d969 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ data/* !data/.gitkeep +cache/index.html public/index.html public/assets/css/user.css diff --git a/app/App.php b/app/App.php index 7273bcb..541793e 100644 --- a/app/App.php +++ b/app/App.php @@ -16,7 +16,7 @@ class App { public function cacheExist(): bool { - if (file_exists('index.html')) { + if (file_exists('../cache/index.html')) { return true; } return false; @@ -141,8 +141,8 @@ class App { * @return void */ public function clearCache(): void { - if (file_exists('../public/index.html')) { - unlink('../public/index.html'); + if (file_exists('../cache/index.html')) { + unlink('../cache/index.html'); } } diff --git a/cache/.gitkeep b/cache/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/public/index.php b/public/index.php index 0a103aa..9a19586 100644 --- a/public/index.php +++ b/public/index.php @@ -50,7 +50,7 @@ if (isset($_POST['settings'])) { } if ($KTH->cacheExist()) { - echo file_get_contents('index.html'); + echo file_get_contents('../cache/index.html'); } else { if (file_exists('../data/services.yaml')) { $services = Yaml::parseFile('../data/services.yaml'); @@ -79,5 +79,5 @@ if ($KTH->cacheExist()) { require('../template/default/footer.php'); $out = ob_get_contents(); - file_put_contents('index.html', $out); + file_put_contents('../cache/index.html', $out); }