summaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-07-14 11:45:35 +0200
committerVincent Petry <pvince81@owncloud.com>2014-07-14 11:45:35 +0200
commit8cad574379c6c5a1127f7f540b5cf5b4aec06600 (patch)
tree8d4b868264640443d3c88dc5b2a00cdd66fdb3f6 /apps/files_external
parente58dce2ee0768248f3ef4ee9070af5432a97f541 (diff)
parentd02604b3fbb4b2087ab74a4b969ef3cd4bfe2541 (diff)
downloadnextcloud-server-8cad574379c6c5a1127f7f540b5cf5b4aec06600.tar.gz
nextcloud-server-8cad574379c6c5a1127f7f540b5cf5b4aec06600.zip
Merge pull request #9605 from owncloud/sftp-missing-streamwrapper
Re-add missing sftp:// stream wrapper
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/lib/sftp.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/files_external/lib/sftp.php b/apps/files_external/lib/sftp.php
index 52cac9bb64a..fc74d5b2a90 100644
--- a/apps/files_external/lib/sftp.php
+++ b/apps/files_external/lib/sftp.php
@@ -7,6 +7,10 @@
*/
namespace OC\Files\Storage;
+/**
+* Uses phpseclib's Net_SFTP class and the Net_SFTP_Stream stream wrapper to
+* provide access to SFTP servers.
+*/
class SFTP extends \OC\Files\Storage\Common {
private $host;
private $user;
@@ -18,6 +22,17 @@ class SFTP extends \OC\Files\Storage\Common {
private static $tempFiles = array();
public function __construct($params) {
+ // The sftp:// scheme has to be manually registered via inclusion of
+ // the 'Net/SFTP/Stream.php' file which registers the Net_SFTP_Stream
+ // stream wrapper as a side effect.
+ // A slightly better way to register the stream wrapper is available
+ // since phpseclib 0.3.7 in the form of a static call to
+ // Net_SFTP_Stream::register() which will trigger autoloading if
+ // necessary.
+ // TODO: Call Net_SFTP_Stream::register() instead when phpseclib is
+ // updated to 0.3.7 or higher.
+ require_once 'Net/SFTP/Stream.php';
+
$this->host = $params['host'];
$proto = strpos($this->host, '://');
if ($proto != false) {