-
Notifications
You must be signed in to change notification settings - Fork 0
/
cache.php
36 lines (29 loc) · 1.1 KB
/
cache.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php include("includes.php"); ?>
<?php
/*
# Le cache est chargé au lancement du site en variable de SESSION
# Le cache a une unique ID qui permet de savoir si la session a la bonne version du cache
# On compare donc l'id avec celle en session pour savoir si il faut reload le contenu
*/
?>
<html>
<head><title>CACHE MANAGER</title></head>
<body>
<?php
$filePath = CACHE_FOLDER.CACHE_FILE.".".CACHE_FILE_EXT;
//echo "<br/>Opening cache file (".$filePath.")";
$fileContent = file_get_contents($filePath);
//echo "<br/>Decode file to json";
//echo "FILE=".$fileContent;
$data = Zend_Json_Decoder::decode($fileContent);
$db = DatabaseData::getInstance();
echo "<br />CACHE ID = ".$data["uniq"];
echo "<br/>SESSION ID = ".$db->uniq;
if($data["uniq"] != $db->uniq) echo "<div style=\"color:#a00;\">Cache is OUT OF DATE</div>";
echo "<div style=\"color:#0a0;\">Cache is loaded</div>";
echo "<br/>";
echo "<div><b>CONTENT DATA</b></div>";
print_r($db);
?>
</body>
</html>