|
@@ -158,8 +158,12 @@ abstract class Stats
|
|
|
dol_mkdir($conf->user->dir_temp);
|
|
|
}
|
|
|
$fp = fopen($newpathofdestfile, 'w');
|
|
|
- fwrite($fp, json_encode($data));
|
|
|
- fclose($fp);
|
|
|
+ if ($fp) {
|
|
|
+ fwrite($fp, json_encode($data));
|
|
|
+ fclose($fp);
|
|
|
+ } else {
|
|
|
+ dol_syslog("Failed to save cache file ".$newpathofdestfile);
|
|
|
+ }
|
|
|
dolChmod($newpathofdestfile);
|
|
|
|
|
|
$this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $nowgmt;
|