cvs: php-master-web /scripts mirror-test
| From: | Gabor Hojtsy | Date: | Mon, 04 Aug 2003 11:01:49 +0000 |
| Subject: | cvs: php-master-web /scripts mirror-test | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-19810@lists.php.net to get a copy of this message | ||
goba Mon Aug 4 07:01:49 2003 EDT
Modified files:
/php-master-web/scripts mirror-test
Log:
Set back the last updated time (the update time of content
on the mirror) to a default zero, in case of automatic error
found, thus implicitly disable the mirror instead of explicitly
disabling it (which is reserved for mirror admins)
Index: php-master-web/scripts/mirror-test
diff -u php-master-web/scripts/mirror-test:1.47 php-master-web/scripts/mirror-test:1.48
--- php-master-web/scripts/mirror-test:1.47 Mon Aug 4 06:13:50 2003
+++ php-master-web/scripts/mirror-test Mon Aug 4 07:01:48 2003
@@ -22,7 +22,8 @@
mysql_select_db("php3");
// Get mirror information for all active mirrors (regardless of their type!)
-$query = "SELECT active, maintainer, hostname, id, has_search, has_stats, lang
+$query = "SELECT maintainer, hostname, id, has_search, has_stats, lang,
+ UNIX_TIMESTAMP(lastupdated) AS lastupdated
FROM mirrors WHERE active = 1";
$result = mysql_query($query)
or die("unable to get from the database: " . mysql_error());
@@ -33,6 +34,9 @@
$hosts[] = $row;
}
+// Free up the result to get more memory
+mysql_free_result($result);
+
// Get all mirror sites, and count the index of them
foreach ($hosts as $index => $host) {
@@ -126,10 +130,11 @@
$hosts[$index]['lang'] = $info[5];
}
- // Deactivate mirror immediately in case of a
- // manual alias is in effect
+ // Set mirror's lastupdated time to a default,
+ // thus deactivating it in case of a manual
+ // alias is in effect
if ($info[6] == "manual-alias") {
- $hosts[$index]['active'] = '0';
+ $hosts[$index]['lastupdated'] = '0';
$hosts[$index]['problem'] = "manual alias in effect";
}
}
@@ -160,7 +165,7 @@
// all the problems into one string in case it will be mailed
else {
$query = "UPDATE mirrors SET ocmt = '" .
addslashes($host['problem']) . "', " .
- "active = '" . ((int) $host['active']) . "'
" .
+ "lastupdated = FROM_UNIXTIME(" . $host['lastupdated'] .
") " .
"WHERE hostname = '" . $host['hostname'] .
"'";
$result = mysql_query($query) or die("unable to update the database: $query: " .
mysql_error());
$problems .= $host['hostname'] . " : " . $host['problem'] .
"\n";
@@ -169,10 +174,10 @@
}
// Send a debug mail at midnight with current details
-if (intval(date("H")) == 0) {
+//if (intval(date("H")) == 0) {
@mail(
"goba@php.net",
"Mirror site updates done",
"$mirrorsupdated mirror sites properly updated (out of " . count($hosts) .
")\n\nProblematic mirrors:\n\n" . $problems
);
-}
+//}