From 035fb8a0778b4d31a45968eb329d0444a70a5f19 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 12 Jan 2006 06:18:27 +0000 Subject: [PATCH] Changing some of that large chunk we just sent in --- includes/cachev.php | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/includes/cachev.php b/includes/cachev.php index dd0276a..3c0946f 100644 --- a/includes/cachev.php +++ b/includes/cachev.php @@ -163,7 +163,7 @@ class cacheV $output = implode("\n", $output); $infolist = $this->registry->xml->parse($output); - // other part of _nodes + // other part of _nodes: properties $output = $this->registry->svn->svn('proplist -v -R ' . ($revision !== null ? ' -r' . $revision . ':HEAD ' : '') . $this->registry->repos->fetch_path($this->registry->paths->repos)); foreach ($output AS $line) { @@ -188,6 +188,7 @@ class cacheV } } + // construct _revs inserts and the list of add revisions foreach ($tree['log']['logentry'] AS $log) { $this->registry->xml->unify_node($log['paths']['path']); @@ -196,29 +197,24 @@ class cacheV foreach ($log['paths']['path'] AS $path) { - if ($path['action'] == 'A') + if (trim($path['action']) == 'A') { - $act = 'addrevs'; + if (!isset($addlist["$path[value]"])) + { + $path['value'] = preg_replace('#^/#', '', $path['value']); + $addlist["$path[value]"] = $log['revision']; + } } - else if ($path['action'] == 'D') - { - $act = 'delrevs'; - } - else - { - $act = 'revs'; - } - - $path['value'] = preg_replace('#^/#', '', $path['value']); - $pathlist["$path[value]"]["$act"][] = $log['revision']; } } + // construct list of HEAD nodes for _nodes foreach ($infolist['info']['entry'] AS $node) { - $inserts['nodes'][] = "('$node[path]', '{$node['repository']['uuid']['value']}', '" . implode(',', $pathlist["$node[path]"]['delrevs']) . "', '" . implode(',', $pathlist["$node[path]"]['addrevs']) . "', '" . implode(',', $pathlist["$node[path]"]['revs']) . "', '" . $this->registry->escape(serialize($proplist["$node[path]"])) . "')"; + $inserts['nodes'][] = "('$node[path]', " . $this->registry->clean($addlist["$node[path]"], TYPE_UINT) . ", " . $node['revision'] . ", '" . $this->registry->escape(serialize($proplist["$node[path]"])) . "')"; } + // insert _revs $this->registry->db->query(" REPLACE INTO {$this->hash}_revs (revision, author, dateline, message, files) @@ -226,21 +222,14 @@ class cacheV " . implode(",\n", $inserts['revs']) ); + // insert _nodes $this->registry->db->query(" REPLACE INTO {$this->hash}_nodes - (name, uuid, delrevs, addrevs, revs, properties) + (name, addrevs, revs, properties) VALUES " . implode(",\n", $inserts['nodes']) ); - - /* - name VARCHAR(255) NOT NULL DEFAULT '', - uuid VARCHAR(50) NOT NULL DEFAULT '', - delrevs MEDIUMTEXT NOT NULL DEFAULT '', - addrevs MEDIUMTEXT NOT NULL DEFAULT '', - revs MEDIUMTEXT NOT NULL DEFAULT '', - properties MEDIUMTEXT NOT NULL DEFAULT '',*/ - + $this->registry->debug("TIME TO (RE)BUILD: " . $this->registry->funct->fetch_microtime_diff($start)); } } -- 2.22.5