From 4fe032e49d6042d5cf69b714369034b08859af37 Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Fri, 24 Jul 2009 17:31:47 -0400 Subject: [PATCH] for now, if a repo file doesn't exist, default to 60 seconds of caching. In the future we should cache git SHA1s infinitely, since they're immutable --- framework/Vcs/lib/Horde/Vcs.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/framework/Vcs/lib/Horde/Vcs.php b/framework/Vcs/lib/Horde/Vcs.php index 5a4d713f2..a47663bf7 100644 --- a/framework/Vcs/lib/Horde/Vcs.php +++ b/framework/Vcs/lib/Horde/Vcs.php @@ -501,7 +501,11 @@ class Horde_Vcs if (!empty($this->_cache)) { // TODO: Can't use filemtime() - Git bare repos contain no files - $ctime = time() - filemtime($filename); + if (file_exists($filename)) { + $ctime = time() - filemtime($filename); + } else { + $ctime = 60; + } if ($this->_cache->exists($cacheId, $ctime)) { $ob = unserialize($this->_cache->get($cacheId, $ctime)); $ob->setRepository($this); @@ -558,7 +562,11 @@ class Horde_Vcs if (!empty($this->_cache)) { // TODO: Can't use filemtime() - Git bare repos contain no files - $ctime = time() - filemtime($filename); + if (file_exists($filename)) { + $ctime = time() - filemtime($filename); + } else { + $ctime = 60; + } if ($this->_cache->exists($cacheId, $ctime)) { return unserialize($this->_cache->get($cacheId, $ctime)); } -- 2.11.0