Forgot move cache outside public dir

This commit is contained in:
Knah Tsaeb 2024-06-17 11:48:42 +02:00
parent 5dd12b556b
commit 03ba4b8570
4 changed files with 6 additions and 5 deletions

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
data/* data/*
!data/.gitkeep !data/.gitkeep
cache/index.html
public/index.html public/index.html
public/assets/css/user.css public/assets/css/user.css

View file

@ -16,7 +16,7 @@ class App {
public function cacheExist(): bool { public function cacheExist(): bool {
if (file_exists('index.html')) { if (file_exists('../cache/index.html')) {
return true; return true;
} }
return false; return false;
@ -141,8 +141,8 @@ class App {
* @return void * @return void
*/ */
public function clearCache(): void { public function clearCache(): void {
if (file_exists('../public/index.html')) { if (file_exists('../cache/index.html')) {
unlink('../public/index.html'); unlink('../cache/index.html');
} }
} }

0
cache/.gitkeep vendored Normal file
View file

View file

@ -50,7 +50,7 @@ if (isset($_POST['settings'])) {
} }
if ($KTH->cacheExist()) { if ($KTH->cacheExist()) {
echo file_get_contents('index.html'); echo file_get_contents('../cache/index.html');
} else { } else {
if (file_exists('../data/services.yaml')) { if (file_exists('../data/services.yaml')) {
$services = Yaml::parseFile('../data/services.yaml'); $services = Yaml::parseFile('../data/services.yaml');
@ -79,5 +79,5 @@ if ($KTH->cacheExist()) {
require('../template/default/footer.php'); require('../template/default/footer.php');
$out = ob_get_contents(); $out = ob_get_contents();
file_put_contents('index.html', $out); file_put_contents('../cache/index.html', $out);
} }