fix using touch to create a file for smb

This commit is contained in:
Robin Appelman 2013-10-01 22:31:22 +02:00
parent ea566868a8
commit 29deef38b2
1 changed files with 15 additions and 11 deletions

View File

@ -8,7 +8,7 @@
namespace OC\Files\Storage; namespace OC\Files\Storage;
abstract class StreamWrapper extends Common{ abstract class StreamWrapper extends Common {
abstract public function constructUrl($path); abstract public function constructUrl($path);
public function mkdir($path) { public function mkdir($path) {
@ -16,7 +16,7 @@ abstract class StreamWrapper extends Common{
} }
public function rmdir($path) { public function rmdir($path) {
if($this->file_exists($path)) { if ($this->file_exists($path)) {
$success = rmdir($this->constructUrl($path)); $success = rmdir($this->constructUrl($path));
clearstatcache(); clearstatcache();
return $success; return $success;
@ -34,11 +34,11 @@ abstract class StreamWrapper extends Common{
} }
public function isReadable($path) { public function isReadable($path) {
return true;//not properly supported return true; //not properly supported
} }
public function isUpdatable($path) { public function isUpdatable($path) {
return true;//not properly supported return true; //not properly supported
} }
public function file_exists($path) { public function file_exists($path) {
@ -55,15 +55,19 @@ abstract class StreamWrapper extends Common{
return fopen($this->constructUrl($path), $mode); return fopen($this->constructUrl($path), $mode);
} }
public function touch($path, $mtime=null) { public function touch($path, $mtime = null) {
if(is_null($mtime)) { if ($this->file_exists($path)) {
$fh = $this->fopen($path, 'a'); if (is_null($mtime)) {
fwrite($fh, ''); $fh = $this->fopen($path, 'a');
fclose($fh); fwrite($fh, '');
fclose($fh);
return true; return true;
} else {
return false; //not supported
}
} else { } else {
return false;//not supported $this->file_put_contents($path, '');
} }
} }