Quellcode durchsuchen

tempnam() may not return the file we want -- be sure to unlink it and translate the error

Zachary Kotlarek vor 12 Jahren
Ursprung
Commit
71a7fbe6e5
1 geänderte Dateien mit 6 neuen und 0 gelöschten Zeilen
  1. 6 0
      web/includes/series.php

+ 6 - 0
web/includes/series.php

@@ -35,6 +35,12 @@ function allSeriesSeasons($base, $use_cache = true) {
 
 
 	# Always update the cache if we read from disk
 	# Always update the cache if we read from disk
 	$temp = @tempnam(dirname($CACHE_FILE), 'tv_web.cache');
 	$temp = @tempnam(dirname($CACHE_FILE), 'tv_web.cache');
+	if ($temp) {
+		if (dirname($temp) != dirname($CACHE_FILE)) {
+			unlink($temp);
+			$temp = false;
+		}
+	}
 	if ($temp) {
 	if ($temp) {
 		file_put_contents($temp, serialize($retval));
 		file_put_contents($temp, serialize($retval));
 		rename($temp, $CACHE_FILE);
 		rename($temp, $CACHE_FILE);