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

balbinus at svn.xiph.org balbinus at svn.xiph.org
Sun May 18 14:48:31 PDT 2008


Author: balbinus
Date: 2008-05-18 14:48:31 -0700 (Sun, 18 May 2008)
New Revision: 14917

Modified:
   branches/dir.xiph.org/cronjobs/rotate_tables.php
Log:
Bug fixes on previous commit + another new table.

Modified: branches/dir.xiph.org/cronjobs/rotate_tables.php
===================================================================
--- branches/dir.xiph.org/cronjobs/rotate_tables.php	2008-05-18 21:44:13 UTC (rev 14916)
+++ branches/dir.xiph.org/cronjobs/rotate_tables.php	2008-05-18 21:48:31 UTC (rev 14917)
@@ -23,7 +23,18 @@
     $sql = sprintf($sql, $yesterday);
     $db->query($sql);
     printf("OK [%.3f s]\n", microtime(true) - $start);
+}
+catch (SQLException $e)
+{
+    echo "[ERROR]\n";
     
+    // Mail the error...
+    custom_exception_handler($e);
+    
+    // do nothing.
+}
+try
+{
     printf("Creating message index on api_log_%s... ", $yesterday);
     $start = microtime(true);
     $sql = 'CREATE INDEX `message` ON `api_log_%s` (`message`, `logged_at`);';
@@ -63,6 +74,7 @@
         // do nothing.
     }
 }
+echo "\n";
 
 /******************************************************************************/
 /**                              PLAYLIST LOG                                **/
@@ -108,5 +120,70 @@
         // do nothing.
     }
 }
+echo "\n";
 
+/******************************************************************************/
+/**                             REFUSED LOG                                  **/
+/******************************************************************************/
+try
+{
+    printf("Creating reason index on refused_log_%s... ", $yesterday);
+    $start = microtime(true);
+    $sql = 'CREATE INDEX `reason` ON `refused_log_%s` (`reason`);';
+    $sql = sprintf($sql, $yesterday);
+    $db->query($sql);
+    printf("OK [%.3f s]\n", microtime(true) - $start);
+}
+catch (SQLException $e)
+{
+    echo "[ERROR]\n";
+    
+    // Mail the error...
+    custom_exception_handler($e);
+    
+    // do nothing.
+}
+try
+{
+    printf("Creating hostname index on refused_log_%s... ", $yesterday);
+    $start = microtime(true);
+    $sql = 'CREATE INDEX `hostname` ON `refused_log_%s` (`listen_url`(11));';
+    $sql = sprintf($sql, $yesterday);
+    $db->query($sql);
+    printf("OK [%.3f s]\n", microtime(true) - $start);
+}
+catch (SQLException $e)
+{
+    echo "[ERROR]\n";
+    
+    // Mail the error...
+    custom_exception_handler($e);
+    
+    // do nothing.
+}
+
+echo "Creating future tables... ";
+$sql_pattern = 'CREATE TABLE IF NOT EXISTS `refused_log_%s` LIKE `refused_log_template`;';
+for ($i = 0 ; $i <= 7 ; $i++)
+{
+    $date = makeFutureDate('Ymd', $i);
+    echo $date." ";
+    
+    $sql = sprintf($sql_pattern, $date);
+    try
+    {
+        $db->query($sql);
+        echo "[OK]... ";
+    }
+    catch (SQLException $e)
+    {
+        echo "[ERROR] ! ";
+        // Mail the error...
+        custom_exception_handler($e);
+        
+        // do nothing.
+    }
+}
+echo "\n";
+
 ?>



More information about the commits mailing list