Construct cacheV tables for each repository
authorRobert Sesek <rsesek@bluestatic.org>
Mon, 9 Jan 2006 03:25:22 +0000 (03:25 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Mon, 9 Jan 2006 03:25:22 +0000 (03:25 +0000)
index.php

index b016e8653282f99553401fa0e321f31cc515523a..4808d612cbd449339ff9571378a80f5597d0cf2d 100644 (file)
--- a/index.php
+++ b/index.php
@@ -32,9 +32,34 @@ require_once('./global.php');
 
 $nodes = '';
 
+$tables = $db->query("SHOW TABLES");
+while ($table = $db->fetch_array($tables))
+{
+       $value = array_values($table);
+       $tablelist[] = $value[0];
+}
+
 foreach ($viewsvn->repos->fetch_list() AS $repos)
 {
-       $link = $viewsvn->paths->out('browse.php', $repos . '/');
+       if (!in_array($hash = md5($viewsvn->repos->fetch_path($repos)), $tablelist))
+       {
+               $viewsvn->debug("creating new cacheV: $repos");
+               $db->query("
+                       CREATE TABLE $hash
+                       (
+                               path MEDIUMTEXT NOT NULL DEFAULT '',
+                               uuid VARCHAR(40) NOT NULL DEFAULT '',
+                               revision INT(20) NOT NULL DEFAULT 0,
+                               node VARCHAR(50) NOT NULL DEFAULT '',
+                               author VARCHAR(255) NOT NULL DEFAULT '',
+                               dateline VARCHAR(100) NOT NULL DEFAULT '',
+                               files MEDIUMTEXT NOT NULL DEFAULT '',
+                               message MEDIUMTEXT NOT NULL DEFAULT ''
+                       )"
+               );
+       }
+       
+       $link = $viewsvn->paths->out('browse.php', $repos . '/');       
        eval('$nodes .= "' . $template->fetch('index_node') . '";');
 }