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

balbinus at svn.xiph.org balbinus at svn.xiph.org
Sun May 18 14:53:41 PDT 2008


Author: balbinus
Date: 2008-05-18 14:53:41 -0700 (Sun, 18 May 2008)
New Revision: 14920

Modified:
   branches/dir.xiph.org/cronjobs/rotate_tables.php
Log:
YANT (last one).

Modified: branches/dir.xiph.org/cronjobs/rotate_tables.php
===================================================================
--- branches/dir.xiph.org/cronjobs/rotate_tables.php	2008-05-18 21:53:05 UTC (rev 14919)
+++ branches/dir.xiph.org/cronjobs/rotate_tables.php	2008-05-18 21:53:41 UTC (rev 14920)
@@ -232,4 +232,50 @@
 }
 echo "\n";
 
+/******************************************************************************/
+/**                                SID LOG                                   **/
+/******************************************************************************/
+try
+{
+    printf("Creating listen_url_hash index on sid_log_%s... ", $yesterday);
+    $start = microtime(true);
+    $sql = 'CREATE INDEX `listen_url_hash` ON `sid_log_%s` (`listen_url_hash`);';
+    $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 `sid_log_%s` LIKE `sid_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