summaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/smb.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/lib/smb.php')
-rw-r--r--apps/files_external/lib/smb.php24
1 files changed, 13 insertions, 11 deletions
diff --git a/apps/files_external/lib/smb.php b/apps/files_external/lib/smb.php
index a4b2338e3b2..96778b0b2e1 100644
--- a/apps/files_external/lib/smb.php
+++ b/apps/files_external/lib/smb.php
@@ -23,13 +23,13 @@ class SMB extends \OC\Files\Storage\StreamWrapper{
$this->password=$params['password'];
$this->share=$params['share'];
$this->root=isset($params['root'])?$params['root']:'/';
- if(!$this->root || $this->root[0]!='/') {
+ if ( ! $this->root || $this->root[0]!='/') {
$this->root='/'.$this->root;
}
- if(substr($this->root, -1, 1)!='/') {
+ if (substr($this->root, -1, 1)!='/') {
$this->root.='/';
}
- if(!$this->share || $this->share[0]!='/') {
+ if ( ! $this->share || $this->share[0]!='/') {
$this->share='/'.$this->share;
}
if(substr($this->share, -1, 1)=='/') {
@@ -42,25 +42,26 @@ class SMB extends \OC\Files\Storage\StreamWrapper{
}
public function constructUrl($path) {
- if(substr($path, -1)=='/') {
+ if (substr($path, -1)=='/') {
$path=substr($path, 0, -1);
}
return 'smb://'.$this->user.':'.$this->password.'@'.$this->host.$this->share.$this->root.$path;
}
public function stat($path) {
- if(!$path and $this->root=='/') {//mtime doesn't work for shares
+ if ( ! $path and $this->root=='/') {//mtime doesn't work for shares
$mtime=$this->shareMTime();
$stat=stat($this->constructUrl($path));
$stat['mtime']=$mtime;
return $stat;
- }else{
+ } else {
return stat($this->constructUrl($path));
}
}
public function filetype($path) {
- return (bool)@$this->opendir($path) ? 'dir' : 'file';//using opendir causes the same amount of requests and caches the content of the folder in one go
+ // using opendir causes the same amount of requests and caches the content of the folder in one go
+ return (bool)@$this->opendir($path) ? 'dir' : 'file';
}
/**
@@ -72,9 +73,10 @@ class SMB extends \OC\Files\Storage\StreamWrapper{
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
+ // mtime doesn't work for shares, but giving the nature of the backend,
+ // doing a full update is still just fast enough
return true;
- }else{
+ } else {
$actualTime=$this->filemtime($path);
return $actualTime>$time;
}
@@ -87,9 +89,9 @@ class SMB extends \OC\Files\Storage\StreamWrapper{
$dh=$this->opendir('');
$lastCtime=0;
while($file=readdir($dh)) {
- if($file!='.' and $file!='..') {
+ if ($file!='.' and $file!='..') {
$ctime=$this->filemtime($file);
- if($ctime>$lastCtime) {
+ if ($ctime>$lastCtime) {
$lastCtime=$ctime;
}
}