[xiph-commits] r14692 - branches/dir.xiph.org/cronjobs

balbinus at svn.xiph.org balbinus at svn.xiph.org
Thu Apr 10 08:29:14 PDT 2008


Author: balbinus
Date: 2008-04-10 08:29:14 -0700 (Thu, 10 Apr 2008)
New Revision: 14692

Modified:
   branches/dir.xiph.org/cronjobs/check_servers.php
Log:
Now it should be better.

Modified: branches/dir.xiph.org/cronjobs/check_servers.php
===================================================================
--- branches/dir.xiph.org/cronjobs/check_servers.php	2008-04-10 15:19:36 UTC (rev 14691)
+++ branches/dir.xiph.org/cronjobs/check_servers.php	2008-04-10 15:29:14 UTC (rev 14692)
@@ -12,7 +12,7 @@
 $memcache = DirXiphOrgMCC::getInstance();
 
 // Old stuff that "timeouted"
-$res = $db->selectQuery('SELECT * FROM `server` WHERE `checked` = 0;');
+$res = $db->selectQuery('SELECT `id`, `listen_url` FROM `server` WHERE `checked` = 0;');
 while (!$res->endOf())
 {
     try
@@ -84,11 +84,20 @@
         {
             throw new ToDeleteException();
         }
-    }
+        
+        // If we're here, everything's ok.
+        $sql = 'UPDATE `server` SET `checked` = 1, `checked_at` = NOW() WHERE `id` = %d;';
+        $sql = sprintf($sql, $res->current('id'));
+        $db->noReturnQuery($sql);
+    } 
     catch (ToDeleteException $e)
     {
         // TODO: remove the stream
         echo("Delete it! ".$res->current('listen_url')."\n");
+        
+        $sql = 'UPDATE `server` SET `checked` = 1, `checked_at` = NOW() WHERE `id` = %d;';
+        $sql = sprintf($sql, $res->current('id'));
+        $db->noReturnQuery($sql);
     }
     
     $res->next();



More information about the commits mailing list