Deal with the possibility that our cache files might not currently exist.
This commit is contained in:
parent
ac6516bad7
commit
4a578a7e01
1 changed files with 11 additions and 2 deletions
|
@ -25,8 +25,17 @@ $dataSources = array(
|
|||
'wow' => 43200,
|
||||
);
|
||||
|
||||
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)) ?
|
||||
|
|
Loading…
Reference in a new issue