diff options
author | Thomas Mueller <thomas.mueller@tmit.eu> | 2013-05-15 23:56:42 +0200 |
---|---|---|
committer | Thomas Mueller <thomas.mueller@tmit.eu> | 2013-05-15 23:56:42 +0200 |
commit | 31d8258d6c0846c1452a7d0af151770650268db5 (patch) | |
tree | 5c22af656981cded9c6c2de21af2411aeb590a80 /apps/files_external/lib | |
parent | 331ad15d9b6b5d6c71285f19e7fda5ea0097d875 (diff) | |
parent | dfddaf8fbf5ff515f26ff462c7ba6166b3d0ed18 (diff) | |
download | nextcloud-server-31d8258d6c0846c1452a7d0af151770650268db5.tar.gz nextcloud-server-31d8258d6c0846c1452a7d0af151770650268db5.zip |
Merge branch 'master' into ext-fs-irods-master
Diffstat (limited to 'apps/files_external/lib')
-rwxr-xr-x | apps/files_external/lib/dropbox.php | 1 | ||||
-rw-r--r-- | apps/files_external/lib/ftp.php | 6 | ||||
-rw-r--r-- | apps/files_external/lib/sftp.php | 4 | ||||
-rw-r--r-- | apps/files_external/lib/smb.php | 1 | ||||
-rw-r--r-- | apps/files_external/lib/streamwrapper.php | 36 | ||||
-rw-r--r-- | apps/files_external/lib/swift.php | 1 | ||||
-rw-r--r-- | apps/files_external/lib/webdav.php | 2 |
7 files changed, 6 insertions, 45 deletions
diff --git a/apps/files_external/lib/dropbox.php b/apps/files_external/lib/dropbox.php index cb04e557f8a..081c5478881 100755 --- a/apps/files_external/lib/dropbox.php +++ b/apps/files_external/lib/dropbox.php @@ -45,7 +45,6 @@ class Dropbox extends \OC\Files\Storage\Common { $oauth = new \Dropbox_OAuth_Curl($params['app_key'], $params['app_secret']); $oauth->setToken($params['token'], $params['token_secret']); $this->dropbox = new \Dropbox_API($oauth, 'dropbox'); - $this->mkdir(''); } else { throw new \Exception('Creating \OC\Files\Storage\Dropbox storage failed'); } diff --git a/apps/files_external/lib/ftp.php b/apps/files_external/lib/ftp.php index 8a7375ebe38..ca6c635eb2b 100644 --- a/apps/files_external/lib/ftp.php +++ b/apps/files_external/lib/ftp.php @@ -35,10 +35,6 @@ class FTP extends \OC\Files\Storage\StreamWrapper{ if ( ! $this->root || $this->root[0]!='/') { $this->root='/'.$this->root; } - //create the root folder if necessary - if ( ! $this->is_dir('')) { - $this->mkdir(''); - } } else { throw new \Exception(); } @@ -63,7 +59,6 @@ class FTP extends \OC\Files\Storage\StreamWrapper{ return $url; } public function fopen($path,$mode) { - $this->init(); switch($mode) { case 'r': case 'rb': @@ -100,7 +95,6 @@ class FTP extends \OC\Files\Storage\StreamWrapper{ } public function writeBack($tmpFile) { - $this->init(); if (isset(self::$tempFiles[$tmpFile])) { $this->uploadFile($tmpFile, self::$tempFiles[$tmpFile]); unlink($tmpFile); diff --git a/apps/files_external/lib/sftp.php b/apps/files_external/lib/sftp.php index ede6c251fd9..4fd36096463 100644 --- a/apps/files_external/lib/sftp.php +++ b/apps/files_external/lib/sftp.php @@ -50,10 +50,6 @@ class SFTP extends \OC\Files\Storage\Common { $host_keys[$this->host] = $current_host_key; $this->write_host_keys($host_keys); } - - if(!$this->file_exists('')){ - $this->mkdir(''); - } } public function test() { diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php index 961efb1a50a..655c3c9a816 100644 --- a/apps/files_external/lib/smb.php +++ b/apps/files_external/lib/smb.php @@ -73,7 +73,6 @@ class SMB extends \OC\Files\Storage\StreamWrapper{ * @return bool */ public function hasUpdated($path,$time) { - $this->init(); if(!$path and $this->root=='/') { // mtime doesn't work for shares, but giving the nature of the backend, // doing a full update is still just fast enough diff --git a/apps/files_external/lib/streamwrapper.php b/apps/files_external/lib/streamwrapper.php index df088e4ad71..beb4ec5605f 100644 --- a/apps/files_external/lib/streamwrapper.php +++ b/apps/files_external/lib/streamwrapper.php @@ -8,46 +8,28 @@ namespace OC\Files\Storage; -abstract class StreamWrapper extends \OC\Files\Storage\Common{ - private $ready = false; - - protected function init(){ - if($this->ready) { - return; - } - $this->ready = true; - - //create the root folder if necesary - if(!$this->is_dir('')) { - $this->mkdir(''); - } - } - +abstract class StreamWrapper extends Common{ abstract public function constructUrl($path); public function mkdir($path) { - $this->init(); return mkdir($this->constructUrl($path)); } public function rmdir($path) { - $this->init(); if($this->file_exists($path)) { - $succes = rmdir($this->constructUrl($path)); + $success = rmdir($this->constructUrl($path)); clearstatcache(); - return $succes; + return $success; } else { return false; } } public function opendir($path) { - $this->init(); return opendir($this->constructUrl($path)); } public function filetype($path) { - $this->init(); return filetype($this->constructUrl($path)); } @@ -60,24 +42,20 @@ abstract class StreamWrapper extends \OC\Files\Storage\Common{ } public function file_exists($path) { - $this->init(); return file_exists($this->constructUrl($path)); } public function unlink($path) { - $this->init(); - $succes = unlink($this->constructUrl($path)); + $success = unlink($this->constructUrl($path)); clearstatcache(); - return $succes; + return $success; } public function fopen($path, $mode) { - $this->init(); return fopen($this->constructUrl($path), $mode); } public function touch($path, $mtime=null) { - $this->init(); if(is_null($mtime)) { $fh = $this->fopen($path, 'a'); fwrite($fh, ''); @@ -90,22 +68,18 @@ abstract class StreamWrapper extends \OC\Files\Storage\Common{ } public function getFile($path, $target) { - $this->init(); return copy($this->constructUrl($path), $target); } public function uploadFile($path, $target) { - $this->init(); return copy($path, $this->constructUrl($target)); } public function rename($path1, $path2) { - $this->init(); return rename($this->constructUrl($path1), $this->constructUrl($path2)); } public function stat($path) { - $this->init(); return stat($this->constructUrl($path)); } diff --git a/apps/files_external/lib/swift.php b/apps/files_external/lib/swift.php index 68c4b48f17c..a9cfe5bd20f 100644 --- a/apps/files_external/lib/swift.php +++ b/apps/files_external/lib/swift.php @@ -287,6 +287,7 @@ class SWIFT extends \OC\Files\Storage\Common{ if ( ! $this->root || $this->root[0]!='/') { $this->root='/'.$this->root; } + $this->id = 'swift:' . $this->host . ':'.$this->root . ':' . $this->user; } else { throw new \Exception(); } diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php index 3ba7c48cd57..c2fe7c67b58 100644 --- a/apps/files_external/lib/webdav.php +++ b/apps/files_external/lib/webdav.php @@ -73,8 +73,6 @@ class DAV extends \OC\Files\Storage\Common{ $this->client->addTrustedCertificates($certPath); } } - //create the root folder if necessary - $this->mkdir(''); } public function getId(){ |