cvs: php-master-web /scripts update-backend
| From: | Gabor Hojtsy | Date: | Thu, 01 May 2003 11:44:56 +0000 |
| Subject: | cvs: php-master-web /scripts update-backend | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-17174@lists.php.net to get a copy of this message | ||
goba Thu May 1 07:44:56 2003 EDT
Modified files:
/php-master-web/scripts update-backend
Log:
Always remove the temp file, and store it's
name in a var, so there is no need to repeat it
Index: php-master-web/scripts/update-backend
diff -u php-master-web/scripts/update-backend:1.8 php-master-web/scripts/update-backend:1.9
--- php-master-web/scripts/update-backend:1.8 Thu May 1 07:39:33 2003
+++ php-master-web/scripts/update-backend Thu May 1 07:44:56 2003
@@ -28,20 +28,22 @@
"$root/backend/events.csv");
// Get last modified date of ip-to-country data
-$ipdb = "$root/backend/ip-to-country.db";
+$ipdbt = "ip-to-country.db~";
+$ipdb = "$root/backend/ip-to-country.db";
if (file_exists($ipdb)) { $lastmod = filemtime($ipdb); }
else { $lastmod = 0; }
// Fetch data from server to local temporary file
fetch_into_file("http://www.directi.com/iptocountry/?site=php.net&dbformat=1&lastupdate="
. $lastmod,
- "ip-to-country.db");
+ $ipdbt);
// If the file contains more then a 'no updates' message,
// then we expect it to be real ip-to-country data, and
// move the file to the right place
-if (@filesize("ip-to-country.db") > strlen("no updates")) {
- rename("ip-to-country.db", $ipdb);
+if (@filesize($ipdbt) > strlen("no updates")) {
+ rename($ipdbt, $ipdb);
}
+unlink($ipdbt);
// Create RSS news feed file
$dest = fopen("$root/news.rss", "w");