Skip to content

Commit

Permalink
Fix cache dir issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierstoval committed Jan 2, 2023
1 parent 45e56f5 commit 6ad005f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
const P_FPDF_FONTPATH = ROOT.DS.'files'.DS.'fpdf'.DS.'fonts';
const P_FPDF_SYSTEM_TTF_FONTS = ROOT.DS.'files'.DS.'fpdf'.DS.'fonts';

const CACHE_DIR = ROOT.DS.'tmp';
if (!is_dir(CACHE_DIR)) {
FileAndDir::createPath(CACHE_DIR);
}

## Générer les fichiers css et js des pages à chaque chargement via la fonction buffWrite(). Permet de réinitialiser une partie cache en local ou lorsque le superadmin est connecté
define('P_GEN_FILES_ONLOAD', $_SERVER['HTTP_HOST'] === '127.0.0.1');

Expand Down
2 changes: 1 addition & 1 deletion modules/mod_versions.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
$updates = array();
$total_maj = 0;

$cacheFile = ROOT.DS.'tmp'.DS.'modversions.html';
$cacheFile = CACHE_DIR.DS.'modversions.html';
if (file_exists($cacheFile) && filemtime($cacheFile) >= (time() - 86400) && $cnt = file_get_contents($cacheFile)) {
echo $cnt;
return;
Expand Down
3 changes: 1 addition & 2 deletions modules_sitemap/mod_sitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
redirect(array('ext' => 'xml'));
}

$cacheFile = ROOT.DS.'tmp'.DS.'modsitemap.xml';
$cacheFile = CACHE_DIR.DS.'modsitemap.xml';
if (file_exists($cacheFile) && filemtime($cacheFile) >= (time() - 86400) && $cnt = file_get_contents($cacheFile)) {
echo $cnt;
return;
Expand Down Expand Up @@ -172,4 +172,3 @@

file_put_contents($cacheFile, $cacheFileContent);
touch($cacheFile);

2 changes: 1 addition & 1 deletion request.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
$_PAGE['more_js'] = [];
$_PAGE['more_css'] = [];

$cacheFile = ROOT.DS.'tmp'.DS.'requestlist.php';
$cacheFile = CACHE_DIR.DS.'requestlist.php';
if (file_exists($cacheFile) && filemtime($cacheFile) >= (time() - 864000) && $cnt = file_get_contents($cacheFile)) {
$_PAGE['list'] = require $cacheFile;
} else {
Expand Down

0 comments on commit 6ad005f

Please sign in to comment.