cvs: php-master-web /scripts mirror-test
| From: | Gabor Hojtsy | Date: | Sun, 09 Feb 2003 10:43:19 +0000 |
| Subject: | cvs: php-master-web /scripts mirror-test | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-15610@lists.php.net to get a copy of this message | ||
goba Sun Feb 9 05:43:19 2003 EDT
Modified files:
/php-master-web/scripts mirror-test
Log:
Ups, Simone was right, language and has_stats was not updated from mirrors
to be actual in the database. Fix this error now...
Index: php-master-web/scripts/mirror-test
diff -u php-master-web/scripts/mirror-test:1.34 php-master-web/scripts/mirror-test:1.35
--- php-master-web/scripts/mirror-test:1.34 Wed Jan 15 11:58:38 2003
+++ php-master-web/scripts/mirror-test Sun Feb 9 05:43:19 2003
@@ -19,7 +19,7 @@
mysql_select_db("php3");
// Get mirror information for all active mirrors (regardless of their type!)
-$query = "SELECT maintainer, hostname, id, has_search FROM mirrors WHERE active = 1";
+$query = "SELECT maintainer, hostname, id, has_search, has_stats, lang FROM mirrors WHERE
active = 1";
$result = mysql_query($query)
or die("unable to get from the database: " . mysql_error());
@@ -95,6 +95,17 @@
if (in_array($info[3], array('0', '1', '2'))) {
$hosts[$index]['has_search'] = $info[3];
}
+
+ // If stats is sure to be supported, update db
+ if ($info[4] == '1') {
+ $hosts[$index]['has_stats'] = $info[4];
+ }
+
+ // If language value is SQL safe, update it
+ if (preg_match("!^[a-z_]+$!", $info[5])) {
+ $hosts[$index]['lang'] = $info[5];
+ }
+
}
// Go through all mirror sites checked
@@ -105,9 +116,13 @@
// the mirror, so the mirror data can be updated. Otherwise
// the previous data need to be kept!
if (isset($host['mirrorupdated'])) {
- $query = "UPDATE mirrors SET lastchecked = NOW(), has_search = '" . ((int)
$host['has_search']) . "', " .
+ $query = "UPDATE mirrors SET " .
+ "lastchecked = NOW(), " .
"lastupdated = FROM_UNIXTIME(" . $host['mirrorupdated'] .
"), " .
- "phpversion = '" . addslashes($host['phpversion']) .
"' " .
+ "has_search = '" . ((int) $host['has_search']) .
"', " .
+ "has_stats = '" . ((int) $host['has_stats']) .
"', " .
+ "phpversion = '" . addslashes($host['phpversion']) .
"', " .
+ "lang = '" . $host['lang'] .
"' " .
"WHERE hostname = '" . $host['hostname'] .
"'";
$result = mysql_query($query) or die("unable to update the database: $query: " .
mysql_error());
if ($result) { $mirrorsupdated++; }