Changing some of that large chunk we just sent in
authorRobert Sesek <rsesek@bluestatic.org>
Thu, 12 Jan 2006 06:18:27 +0000 (06:18 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Thu, 12 Jan 2006 06:18:27 +0000 (06:18 +0000)
includes/cachev.php

index dd0276a03e17a8864fcce5a23e4b10cd7e02f86e..3c0946f9b2516b6125c4b7bacb16803f2f37f726 100644 (file)
@@ -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));
        }
 }