From 7847e0b7df1709d136be6fc9d1628ce07a14714f Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 28 Jan 2009 21:11:24 -0700 Subject: [PATCH] Move patchset feature determination to Vcs lib --- chora/patchsets.php | 8 +++++--- framework/Vcs/lib/Horde/Vcs/Cvs.php | 12 +++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/chora/patchsets.php b/chora/patchsets.php index 340701a1a..caccddf90 100644 --- a/chora/patchsets.php +++ b/chora/patchsets.php @@ -1,5 +1,7 @@ * @author Chuck Hagenbuch + * @author Michael Slusarz * @package Chora */ require_once dirname(__FILE__) . '/lib/base.php'; -// Exit if cvsps isn't active or it's not a subversion repository. -if (empty($conf['paths']['cvsps']) && - !$GLOBALS['VC']->hasFeature('patchsets')) { +// Exit if patchset feature is not available. +if (!$GLOBALS['VC']->hasFeature('patchsets')) { header('Location: ' . Chora::url('', $where)); exit; } diff --git a/framework/Vcs/lib/Horde/Vcs/Cvs.php b/framework/Vcs/lib/Horde/Vcs/Cvs.php index 09a3f407f..65e5b0545 100644 --- a/framework/Vcs/lib/Horde/Vcs/Cvs.php +++ b/framework/Vcs/lib/Horde/Vcs/Cvs.php @@ -42,13 +42,15 @@ class Horde_Vcs_Cvs extends Horde_Vcs_Rcs protected $_branches = true; /** - * Returns the temporary file path. + * Does this driver support the given feature? * - * @return string Temporary file path. + * @return boolean True if driver supports the given feature. */ - public function getTempPath() + public function hasFeature($feature) { - return $this->_paths['temp']; + return (($feature != 'patchsets') || $this->getPath('cvsps')) + ? parent::hasFeature($feature) + : false; } /** @@ -146,7 +148,7 @@ class Horde_Vcs_Cvs extends Horde_Vcs_Rcs { $this->assertValidRevision($rev); - $tmpfile = Util::getTempFile('vc', true, $this->getTempPath()); + $tmpfile = Util::getTempFile('vc', true, $this->_paths['temp']); $where = $fileob->queryModulePath(); $pipe = popen($this->getPath('cvs') . ' -n server > ' . escapeshellarg($tmpfile), VC_WINDOWS ? 'wb' : 'w'); -- 2.11.0