Added command-line rebuilder. This needs some security.
authorRobert Sesek <rsesek@bluestatic.org>
Mon, 23 Jan 2006 05:38:13 +0000 (05:38 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Mon, 23 Jan 2006 05:38:13 +0000 (05:38 +0000)
rebuild.sh.php [new file with mode: 0644]

diff --git a/rebuild.sh.php b/rebuild.sh.php
new file mode 100644 (file)
index 0000000..db4427a
--- /dev/null
@@ -0,0 +1,76 @@
+#!/usr/bin/php
+<?php
+/*=====================================================================*\
+|| ###################################################################
+|| # ViewSVN [#]version[#]
+|| # Copyright ©2002-[#]year[#] Iris Studios, Inc.
+|| #
+|| # This program is free software; you can redistribute it and/or modify
+|| # it under the terms of the GNU General Public License as published by
+|| # the Free Software Foundation; version [#]gpl[#] of the License.
+|| #
+|| # This program is distributed in the hope that it will be useful, but
+|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+|| # more details.
+|| #
+|| # You should have received a copy of the GNU General Public License along
+|| # with this program; if not, write to the Free Software Foundation, Inc.,
+|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+|| ###################################################################
+\*=====================================================================*/
+
+define('PATH_OVERRIDE', 1);
+
+require_once('./global.php');
+
+// ###################################################################
+
+$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)
+{
+       if (!in_array('c' . ($hash = md5($viewsvn->repos->fetch_path($repos))) . '_revs', $tablelist))
+       {
+               $viewsvn->debug("creating new cacheV: $repos");
+               $db->query("
+                       CREATE TABLE c{$hash}_revs
+                       (
+                               revision INT(20) UNSIGNED NOT NULL DEFAULT 0,
+                               author VARCHAR(255) NOT NULL DEFAULT '',
+                               dateline VARCHAR(100) NOT NULL DEFAULT '',
+                               files MEDIUMTEXT NOT NULL DEFAULT '',
+                               message MEDIUMTEXT NOT NULL DEFAULT '',
+                               PRIMARY KEY (revision)
+                       )"
+               );
+               
+               $db->query("
+                       CREATE TABLE c{$hash}_nodes
+                       (
+                               name VARCHAR(255) NOT NULL DEFAULT '',
+                               node VARCHAR(50) NOT NULL DEFAULT '',
+                               revision INT(20) UNSIGNED NOT NULL DEFAULT 0,
+                               history MEDIUMTEXT NOT NULL DEFAULT '',
+                               properties MEDIUMTEXT NOT NULL DEFAULT '',
+                               PRIMARY KEY (name)
+                       )"
+               );
+       }
+       
+       $controller = new Controller($repos);
+       $controller->cachev->build(null);
+}
+
+/*=====================================================================*\
+|| ###################################################################
+|| # $HeadURL$
+|| # $Id$
+|| ###################################################################
+\*=====================================================================*/
+?>
\ No newline at end of file