[ingo] sftp support for VFS driver

Cliff Green green at umdnj.edu
Thu Jun 8 07:29:55 PDT 2006


On 06/08/2006, Steve Caissie wrote about [ingo] sftp support for VFS driver:

> To get sftp to work:
>
> 1) I changed ingo/lib/Driver/vfs.php to accept "ssh2" as a valid vfstype.
> 2) rm -r horde/lib/VFS*
> 3) pear install VFS-0.1.0
>
> I haven't tested it much, but it appears to work.
>
> VFS-0.1.0 requires the SSH2 pear module.  I had to download it from
> http://pecl.php.net/package/ssh2/0.5.  I couldn't get `pear install` to
> work for it.
>
> Steve
>
>
> 75c75
> <         if ($this->_params['vfstype'] != 'ftp') {
> ---
>>        if ($this->_params['vfstype'] != 'ftp' &&
> $this->_params['vfstype'] != 'ssh2') {
> 101c101
> <         if ($this->_params['vfstype'] != 'ftp') {
> ---
>>        if ($this->_params['vfstype'] != 'ftp' &&
> $this->_params['vfstype'] != 'ssh2') {

Interesting.  I went about it slightly differently, adding a $_drivers  
array and testing against that;  the patch for cvs  is different,  
obviously, but I can't vouch for how well it functions since I'm not  
currently using it.

c
-- 
Cliff Green
Business Systems & Technologies/UMDNJ
"Without deviation from the norm, progress is not possible."
-- Frank Zappa
-------------- next part --------------
--- vfs.php.dist	2006-02-09 13:42:16.000000000 -0500
+++ vfs.php	2006-02-12 01:23:06.000000000 -0500
@@ -14,6 +14,9 @@
  * @package Ingo
  */
 class Ingo_Driver_vfs extends Ingo_Driver {
+    
+    // acceptable drivers
+    var $_drivers = array( 'ftp', 'ssh2' );
 
     /**
      * Constructs a new VFS-based storage driver.
@@ -40,7 +43,7 @@
      */
     function setScriptActive($script, $username, $password)
     {
-        if ($this->_params['vfstype'] != 'ftp') {
+        if (!(in_array($this->_params['vfstype'], $this->_drivers))) {
             return PEAR::raiseError(_(sprintf("VFS type \"%s\" not yet implemented.", $this->_params['vfstype'])));
         }
         $this->_params['username'] = $username;
@@ -66,7 +69,8 @@
      */
     function getScript($username, $password)
     {
-        if ($this->_params['vfstype'] != 'ftp') {
+
+        if (!(in_array($this->_params['vfstype'], $this->_drivers))) {
             return PEAR::raiseError(_(sprintf("VFS type \"%s\" not yet implemented.", $this->_params['vfstype'])));
         }
         $this->_params['username'] = $username;
-------------- next part --------------
--- vfs.php.dist	2006-06-08 09:34:54.000000000 -0400
+++ vfs.php	2006-06-08 09:41:06.000000000 -0400
@@ -17,6 +17,7 @@
  */
 class Ingo_Driver_vfs extends Ingo_Driver {
 
+    
     /**
      * Whether this driver allows managing other users' rules.
      *
@@ -24,6 +25,13 @@
      */
     var $_support_shares = true;
 
+    /** 
+     * a list of acceptable drivers
+     *
+     * @var array
+     */
+    var $_drivers = array( 'ftp', 'ssh2' );
+
     /**
      * Constructs a new VFS-based storage driver.
      *
@@ -106,7 +114,7 @@
             return true;
         }
 
-        if ($this->_params['vfstype'] != 'ftp') {
+        if (!(in_array($this->_params['vfstype'], $this->_drivers))) {
             return PEAR::raiseError(sprintf('VFS type "%s" not yet implemented.', $this->_params['vfstype']));
         }
 


More information about the ingo mailing list