summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/ftp.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/lib/ftp.php')
-rw-r--r--apps/files_external/lib/ftp.php39
1 files changed, 22 insertions, 17 deletions
diff --git a/apps/files_external/lib/ftp.php b/apps/files_external/lib/ftp.php
index 9b6c037bb57..8a7375ebe38 100644
--- a/apps/files_external/lib/ftp.php
+++ b/apps/files_external/lib/ftp.php
@@ -18,26 +18,31 @@ class FTP extends \OC\Files\Storage\StreamWrapper{
private static $tempFiles=array();
public function __construct($params) {
- $this->host=$params['host'];
- $this->user=$params['user'];
- $this->password=$params['password'];
- if (isset($params['secure'])) {
- if (is_string($params['secure'])) {
- $this->secure = ($params['secure'] === 'true');
+ if (isset($params['host']) && isset($params['user']) && isset($params['password'])) {
+ $this->host=$params['host'];
+ $this->user=$params['user'];
+ $this->password=$params['password'];
+ if (isset($params['secure'])) {
+ if (is_string($params['secure'])) {
+ $this->secure = ($params['secure'] === 'true');
+ } else {
+ $this->secure = (bool)$params['secure'];
+ }
} else {
- $this->secure = (bool)$params['secure'];
+ $this->secure = false;
+ }
+ $this->root=isset($params['root'])?$params['root']:'/';
+ if ( ! $this->root || $this->root[0]!='/') {
+ $this->root='/'.$this->root;
+ }
+ //create the root folder if necessary
+ if ( ! $this->is_dir('')) {
+ $this->mkdir('');
}
} else {
- $this->secure = false;
- }
- $this->root=isset($params['root'])?$params['root']:'/';
- if ( ! $this->root || $this->root[0]!='/') {
- $this->root='/'.$this->root;
- }
- //create the root folder if necesary
- if ( ! $this->is_dir('')) {
- $this->mkdir('');
+ throw new \Exception();
}
+
}
public function getId(){
@@ -83,7 +88,7 @@ class FTP extends \OC\Files\Storage\StreamWrapper{
} else {
$ext='';
}
- $tmpFile=OCP\Files::tmpFile($ext);
+ $tmpFile=\OCP\Files::tmpFile($ext);
\OC\Files\Stream\Close::registerCallback($tmpFile, array($this, 'writeBack'));
if ($this->file_exists($path)) {
$this->getFile($path, $tmpFile);