Browse Source

Fix warning

Laurent Destailleur 1 năm trước cách đây
mục cha
commit
6b72371163
1 tập tin đã thay đổi với 6 bổ sung2 xóa
  1. 6 2
      htdocs/core/class/stats.class.php

+ 6 - 2
htdocs/core/class/stats.class.php

@@ -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;