private $user;
private $host;
private $root;
+ private $share;
private static $tempFiles=array();
$this->host=$params['host'];
$this->user=$params['user'];
$this->password=$params['password'];
+ $this->share=$params['share'];
$this->root=isset($params['root'])?$params['root']:'/';
+ if(substr($this->root,-1,1)!='/'){
+ $this->root.='/';
+ }
+ if(substr($this->root,0,1)!='/'){
+ $this->root='/'.$this->root;
+ }
+ if(substr($this->share,0,1)!='/'){
+ $this->share='/'.$this->share;
+ }
+ if(substr($this->share,-1,1)=='/'){
+ $this->share=substr($this->share,0,-1);
+ }
//create the root folder if necesary
- $this->mkdir('');
+ if(!$this->is_dir('')){
+ $this->mkdir('');
+ }
}
public function constructUrl($path){
if(substr($path,-1)=='/'){
$path=substr($path,0,-1);
}
- return 'smb://'.$this->user.':'.$this->password.'@'.$this->host.$this->root.$path;
+ return 'smb://'.$this->user.':'.$this->password.'@'.$this->host.$this->share.$this->root.$path;
}
}
public function setUp(){
$id=uniqid();
$this->config=include('apps/files_external/tests/config.php');
- $this->config['smb']['root'].='/'.$id;//make sure we have an new empty folder to work in
+ $this->config['smb']['root'].=$id;//make sure we have an new empty folder to work in
$this->instance=new OC_Filestorage_SMB($this->config['smb']);
}