1
0
Fork 0

Deal with the possibility that our cache files might not currently exist.

This commit is contained in:
Andrew Tomaka 2011-10-14 01:18:16 -04:00
parent ac6516bad7
commit 4a578a7e01
1 changed files with 11 additions and 2 deletions

View File

@ -25,8 +25,17 @@ $dataSources = array(
'wow' => 43200,
);
$cacheData = json_decode(file_get_contents($CACHE_FILE),true);
$sourceData = json_decode(file_get_contents($DATA_FILE),true);
if(file_exists($CACHE_FILE)) {
$cacheData = json_decode(file_get_contents($CACHE_FILE),true);
} else {
$cacheData = array();
}
if(file_exists($DATA_FILE)) {
$sourceData = json_decode(file_get_contents($DATA_FILE),true);
} else {
$sourceData = array();
}
foreach($dataSources as $dataSource=>$refreshTime) {
// check last time the data was updated
$lastModified = (array_key_exists($dataSource, $cacheData)) ?