cvs: php-master-web /scripts mirror-summary
| From: | Hannes Magnusson | Date: | Tue, 17 Apr 2007 20:40:57 +0000 |
| Subject: | cvs: php-master-web /scripts mirror-summary | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-35211@lists.php.net to get a copy of this message | ||
bjori Tue Apr 17 20:40:57 2007 UTC
Modified files:
/php-master-web/scripts mirror-summary
Log:
If there is no error message registered, check administrative comment
Send out notifications to manually-disabled-mirrors too
http://cvs.php.net/viewvc.cgi/php-master-web/scripts/mirror-summary?r1=1.21&r2=1.22&diff_format=u
Index: php-master-web/scripts/mirror-summary
diff -u php-master-web/scripts/mirror-summary:1.21 php-master-web/scripts/mirror-summary:1.22
--- php-master-web/scripts/mirror-summary:1.21 Sat Apr 14 13:02:03 2007
+++ php-master-web/scripts/mirror-summary Tue Apr 17 20:40:57 2007
@@ -14,7 +14,7 @@
set_time_limit (0);
// Empty arrays by default
-$inactives = $outdated = array();
+$inactives = $outdated = $disabled = array();
// Try to connect to the database and select phpmasterdb database
mysql_connect("localhost","nobody","") or die("unable to connect
to database");
@@ -27,7 +27,7 @@
// Select all mirrors ordered by hostname
$query = "SELECT maintainer, hostname, id, UNIX_TIMESTAMP(lastupdated) AS lastupdate, " .
"phpversion, (DATE_SUB(FROM_UNIXTIME($checktime), INTERVAL 3 DAY) < lastchecked)
AS active, " .
- "(DATE_SUB(FROM_UNIXTIME($checktime), INTERVAL 7 DAY) < lastupdated) AS current,
ocmt " .
+ "(DATE_SUB(FROM_UNIXTIME($checktime), INTERVAL 7 DAY) < lastupdated) AS current,
active AS enabled, acmt, ocmt " .
"FROM mirrors ORDER BY hostname";
// Execute SQL query
@@ -49,7 +49,8 @@
// List mirrors which seem to be down
for ($i=0; $i < $total; $i++) {
if (!$hosts[$i]['active']) {
- $inactives[$hosts[$i]['hostname']] = array($hosts[$i]['maintainer'],
$hosts[$i]['ocmt']);
+ $cmt = !empty($hosts[$i]['ocmt']) ? $hosts[$i]['ocmt'] :
$hosts[$i]['acmt'];
+ $inactives[$hosts[$i]['hostname']] = array($hosts[$i]['maintainer'],
$cmt);
}
}
if (count($inactives)) {
@@ -59,8 +60,9 @@
// List all mirrors which seem to be outdated
for ($i=0; $i < $total; $i++) {
- if ($hosts[$i]['active'] && !$hosts[$i]['current']) {
- $outdated[$hosts[$i]['hostname']] = array($hosts[$i]['maintainer'],
$hosts[$i]['ocmt']);
+ if ($hosts[$i]['active'] && !$hosts[$i]['current'] &&
!$hosts[$i]['enabled']) {
+ $cmt = !empty($hosts[$i]['ocmt']) ? $hosts[$i]['ocmt'] :
$hosts[$i]['acmt'];
+ $outdated[$hosts[$i]['hostname']] = array($hosts[$i]['maintainer'],
$cmt);
}
}
if (count($outdated)) {
@@ -68,6 +70,17 @@
$body .= wordwrap(join(', ', array_keys($outdated))) . "\n";
}
+for ($i=0; $i < $total; $i++) {
+ if (!$hosts[$i]['enabled']) {
+ $cmt = !empty($hosts[$i]['ocmt']) ? $hosts[$i]['ocmt'] :
$hosts[$i]['acmt'];
+ $disabled[$hosts[$i]['hostname']] = array($hosts[$i]['maintainer'],
$cmt);
+ }
+}
+if (count($disabled)) {
+ $body .= "\nThese mirrors are manually disabled:\n\n";
+ $body .= wordwrap(join(', ', array_keys($disabled))) . "\n";
+}
+
$body .= "\nAnd now for the rest of the mirrors:\n"
.
"----------------------------------------------------------------------------------------\n"
. " Host \t\t PHP Version \t\t Last Updated\n"
@@ -126,7 +139,7 @@
."Mail sent out by the PHP.net automatic mirror site monitoring system";
// Send mail to all inactive mirror maintainers
-foreach ($inactives as $hostname => $hostinfo) {
+foreach (array_merge($inactives, $disabled) as $hostname => $hostinfo) {
if (!empty($hostinfo[1])) {
$last_error = "The last error message stored for your mirror is:\n
{$hostinfo[1]}\n\n";
}
@@ -165,3 +178,4 @@
);
}
}
+