Commit:    8533ee8bb691a8102780c1eab5ffb15e68dbf6cd
Author:    danbrown <[email protected]>         Tue, 24 Sep 2013 12:21:08 -0400
Parents:   f466bef184aaa48ca1e46fdb250eab23887bfbd4
Branches:  master

Link:       
http://git.php.net/?p=web/master.git;a=commitdiff;h=8533ee8bb691a8102780c1eab5ffb15e68dbf6cd

Log:
Basic checking and auto-reactivation of round-robin for mirrors.

Changed paths:
  M  scripts/mirror-test


Diff:
diff --git a/scripts/mirror-test b/scripts/mirror-test
index 2a6d5b7..72449b0 100755
--- a/scripts/mirror-test
+++ b/scripts/mirror-test
@@ -185,13 +185,34 @@ foreach ($hosts as $index => $host) {
             // send a notification email to php-mirrors@
             mail(
                 "[email protected]",
-                "Round robin for {$host['hostname']} is deactivated",
+                "[WARN] Round-robin for {$host['hostname']} is DOWN",
                 $lb_problem,
                 "From: [email protected]",
                 "-f [email protected]"
             );
         }
-    }
+    } else {
+       /**
+         This was done in a hurry, a day after recovering from food poisoning,
+         and should be cleaned up (the code.... the undercooked chicken is
+         already gone, thanks).  This is just to get it going until - someday -
+         we can overhaul these scripts and make things more modular.
+        */
+       $lb_ccname = substr($host['hostname'],0,2);
+       $lb_error = 
host_has_error($host['hostname'],$filename,$lb_data,$lb_problem,$lb_ccname.'.php.net');
+       $lb_info = explode("|", trim($lb_data));
+       if (count($lb_info) >= 8) {
+               $sql = "UPDATE mirrors SET 
load_balanced='".mysql_real_escape_string($lb_ccname)."' WHERE 
hostname='".mysql_real_escape_string($host['hostname'])."'";
+               mysql_query($sql) or die('Error performing query: '.$sql.'.... 
MySQL said:'.PHP_EOL.mysql_error().PHP_EOL);
+               mail(
+                       '[email protected]',
+                       '[ OK ] Round-robin for '.$host['hostname'].' is UP',
+                       'When most recently tested, 
'.$host['load_balanced'].'.php.net was cleared for reactivation.',
+                       "From: [email protected]\r\nX-Mailer: 
PHP-".basename(__FILE__)."\r\n",
+                       '[email protected]'
+               );
+       } // We do nothing if the mirror is still an RR-only SNAFU.
+    } // End of round-robin testing
 
     // Explode information row by delimiter
     $info = explode("|", trim($data));


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to