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

balbinus at svn.xiph.org balbinus at svn.xiph.org
Sun May 18 14:51:24 PDT 2008


Author: balbinus
Date: 2008-05-18 14:51:24 -0700 (Sun, 18 May 2008)
New Revision: 14918

Modified:
   branches/dir.xiph.org/cronjobs/rotate_tables.php
Log:
Yet another new table.

Modified: branches/dir.xiph.org/cronjobs/rotate_tables.php
===================================================================
--- branches/dir.xiph.org/cronjobs/rotate_tables.php	2008-05-18 21:48:31 UTC (rev 14917)
+++ branches/dir.xiph.org/cronjobs/rotate_tables.php	2008-05-18 21:51:24 UTC (rev 14918)
@@ -186,4 +186,50 @@
 }
 echo "\n";
 
+/******************************************************************************/
+/**                             SEARCH LOG                                   **/
+/******************************************************************************/
+try
+{
+    printf("Creating search_type index on search_log_%s... ", $yesterday);
+    $start = microtime(true);
+    $sql = 'CREATE INDEX `search_type` ON `search_log_%s` (`search_type`);';
+    $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 `search_log_%s` LIKE `search_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