From c2e1700367e42311ac490439013e054223bab321 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 22 Jan 2006 22:03:34 +0000 Subject: [PATCH] - fetch_prev_revision() should now work as desired - Added an optional override parameter to fetch_node() to specify a node --- includes/cachev.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/includes/cachev.php b/includes/cachev.php index 04b9593..d257978 100644 --- a/includes/cachev.php +++ b/includes/cachev.php @@ -138,17 +138,21 @@ class cacheV */ function fetch_prev_revision($revision) { - $data = $this->fetch_node(); - $data = $data['history']; - + $data = $this->fetch_node(($this->controller->path == '/' ? $this->controller->repos : $this->controller->path)); + $data = $data['history']; if (sizeof($data) < 1) { return $this->fetch_revision(0); } $list = array_keys($data); - $key = array_search($revision, $list); + + if ($revision == 'HEAD') + { + $key = 0; + } + $key++; // go to the next earliest revision if (!isset($list["$key"])) { @@ -180,11 +184,13 @@ class cacheV * * @access public * + * @param string Node override + * * @return integer Latest revision; FALSE if none (not in HEAD) */ - function fetch_node() + function fetch_node($node = false) { - $node = $this->fetch_node_string($this->controller->path); + $node = $this->fetch_node_string(($node === false ? $this->controller->path : $node)); if (!isset($this->memcache['nodes']["$node"])) { $result = $this->controller->registry->db->query_first("SELECT * FROM {$this->hash}_nodes WHERE name = '" . $this->controller->registry->escape($node) . "'"); -- 2.22.5