Move patchset feature determination to Vcs lib
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 29 Jan 2009 04:11:24 +0000 (21:11 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 29 Jan 2009 08:12:45 +0000 (01:12 -0700)
chora/patchsets.php
framework/Vcs/lib/Horde/Vcs/Cvs.php

index 340701a..caccddf 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 /**
+ * Patchsets script.
+ *
  * Copyright 1999-2009 The Horde Project (http://www.horde.org/)
  *
  * See the enclosed file COPYING for license information (GPL). If you
@@ -7,14 +9,14 @@
  *
  * @author  Anil Madhavapeddy <anil@recoil.org>
  * @author  Chuck Hagenbuch <chuck@horde.org>
+ * @author  Michael Slusarz <slusarz@horde.org>
  * @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;
 }
index 09a3f40..65e5b05 100644 (file)
@@ -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');