From c1193a16e865f28208c3e5ca733d7ac6f495e62d Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 12 Jan 2006 16:50:37 +0000 Subject: [PATCH] Again changing cacheV; we now store each node's history in _nodes --- includes/cachev.php | 21 +++++++++++++++++++-- index.php | 5 +++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/includes/cachev.php b/includes/cachev.php index f09af73..0d29033 100644 --- a/includes/cachev.php +++ b/includes/cachev.php @@ -260,7 +260,24 @@ class cacheV // construct list of HEAD nodes for _nodes foreach ($infolist['info']['entry'] AS $node) { - $inserts['nodes'][] = "('$node[path]', " . $this->registry->clean($addlist["$node[path]"], TYPE_UINT) . ", " . $node['revision'] . ", '" . $this->registry->escape(serialize($proplist["$node[path]"])) . "')"; + $history = $this->registry->svn->svn('log --xml ' . $node['url']['value']); + $history = implode("\n", $history); + $history = $this->registry->xml->parse($history); + + $loglist = array(); + $latestrev = -1; + foreach ($history['log']['logentry'] AS $log) + { + $latestrev = ($log['revision'] > $latestrev ? $log['revision'] : $latestrev); + $loglist["$log[revision]"] = array( + 'revision' => $log['revision'], + 'author' => $log['author']['value'], + 'date' => $log['date']['value'], + 'message' => $log['msg']['value'] + ); + } + + $inserts['nodes'][] = "('$node[path]', '" . $node['kind'] . "', $latestrev, '" . $this->registry->escape(serialize($loglist)) . "', '" . $this->registry->escape(serialize($proplist["$node[path]"])) . "')"; } // insert _revs @@ -274,7 +291,7 @@ class cacheV // insert _nodes $this->registry->db->query(" REPLACE INTO {$this->hash}_nodes - (name, revadd, revnow, properties) + (name, node, revision, history, properties) VALUES " . implode(",\n", $inserts['nodes']) ); diff --git a/index.php b/index.php index 32af714..c21c837 100644 --- a/index.php +++ b/index.php @@ -60,8 +60,9 @@ foreach ($viewsvn->repos->fetch_list() AS $repos) CREATE TABLE {$hash}_nodes ( name VARCHAR(255) NOT NULL DEFAULT '', - revnow INT(20) UNSIGNED NOT NULL DEFAULT '', - revadd INT(20) UNSIGNED 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) )" -- 2.22.5