From 77da96ca379aba320884c6b39f31bfe486103b6e Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 12 Jan 2006 17:48:20 +0000 Subject: [PATCH] Getting things back on track in browse.php --- browse.php | 5 +++-- includes/cachev.php | 40 +++++++++++++++++++++++++++++++++++++++- includes/paths.php | 4 ++-- 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/browse.php b/browse.php index 50e86ca..9069a3e 100644 --- a/browse.php +++ b/browse.php @@ -31,17 +31,18 @@ $navbar = $viewsvn->paths->construct_breadcrumb($viewsvn->paths->path); // ################################################################### $node = preg_replace('#(^/|/$)#', '', ($viewsvn->paths->relpath == '' ? $viewsvn->paths->path : $viewsvn->paths->relpath)); -$latest = $cachev->fetch_latest_revision($node); +$latest = $cachev->fetch_node($node); $link['log'] = $viewsvn->paths->out('log.php' . $viewsvn->paths->revstr, $viewsvn->paths->path); -$show['head'] = ($latest['revnow'] != $viewsvn->paths->revnum AND $viewsvn->paths->revnum != 'HEAD'); +$show['head'] = ($latest['revision'] != $viewsvn->paths->revnum AND $viewsvn->paths->revnum != 'HEAD'); if ($show['head']) { $link['gohead'] = $viewsvn->paths->out('browse.php' . $viewsvn->paths->fetch_rev_str(false, 'HEAD'), $viewsvn->paths->path); $link['diffhead'] = $viewsvn->paths->out('diff.php' . $viewsvn->paths->fetch_rev_str(true, 'HEAD', $viewsvn->paths->revnum), $viewsvn->paths->path); } +$show['prev'] = false; //$show['prev'] = (($prev = $cachev->fetch_prev_revision($viewsvn->paths->path, $viewsvn->paths->revnum)) != -1 ? true : false); if ($show['prev']) { diff --git a/includes/cachev.php b/includes/cachev.php index 0d29033..6c6da80 100644 --- a/includes/cachev.php +++ b/includes/cachev.php @@ -84,6 +84,22 @@ class cacheV $this->hash = md5($this->registry->repos->fetch_path($this->registry->paths->repos)); } + // ################################################################### + /** + * Returns a node string that has the beginning and ending slashes + * removed to allow it to match to the _nodes cacheV table + * + * @access public + * + * @param string Original string + * + * @return string Matchable string + */ + function fetch_node_string($node) + { + return preg_replace('#(^/|/$)#', '', $node); + } + // ################################################################### /** * Returns a specific log entry @@ -148,8 +164,9 @@ class cacheV * * @return integer Latest revision; FALSE if none (not in HEAD) */ - function fetch_latest_revision($node) + function fetch_node($node) { + $node = $this->fetch_node_string($node); if (!isset($this->memcache['nodes']["$node"])) { $this->memcache['nodes']["$node"] = $this->registry->db->query_first("SELECT * FROM {$this->hash}_nodes WHERE name = '" . $this->registry->escape($node) . "'"); @@ -157,6 +174,27 @@ class cacheV return $this->memcache['nodes']["$node"]; } + + // ################################################################### + /** + * Checks to see if a given node is a directory. Returns TRUE if so. + * + * @access public + * + * @param string Node path + * + * @return bool TRUE if directory, FALSE if not + */ + function isdir($node) + { + $node = $this->fetch_node($node); + if ($node['node'] == 'dir') + { + return true; + } + + return false; + } // ################################################################### /** diff --git a/includes/paths.php b/includes/paths.php index 74b93e2..8e0d10f 100644 --- a/includes/paths.php +++ b/includes/paths.php @@ -182,7 +182,7 @@ class Paths */ function construct_breadcrumb($path, $doslash = true) { - global $viewsvn; + global $viewsvn, $cachev; $html = '/ '; $itembit = '/'; @@ -193,7 +193,7 @@ class Paths foreach ($temp AS $val => $item) { $itembit .= $item; - $itembit .= (($count != $val OR @$viewsvn->svn->common->isdir($itembit)) ? '/' : ''); + $itembit .= (($count != $val OR $cachev->isdir($itembit)) ? '/' : ''); $html .= '' . $item . ''. ($count != $val ? ' / ' : ''); } -- 2.43.5