diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php index 3067d4d34c004f03f2bbf5cbc420e0f585879990..845659588efc325865dda15b5cd5c147ab7e1e53 100644 --- a/apps/files_sharing/sharedstorage.php +++ b/apps/files_sharing/sharedstorage.php @@ -505,7 +505,13 @@ class OC_Filestorage_Shared extends OC_Filestorage { return $storage->getLocalFile($this->getInternalPath($source)); } } - + public function touch($path, $mtime=null){ + $source = $this->getSource($path); + if ($source) { + $storage = OC_Filesystem::getStorage($source); + return $storage->touch($this->getInternalPath($source),$time); + } + } } ?> diff --git a/lib/filestorage.php b/lib/filestorage.php index 6b679eab8991afa0553de0f87317db05b680361f..fd6497b9478387a6746e655dedf0d87af92de7ab 100644 --- a/lib/filestorage.php +++ b/lib/filestorage.php @@ -48,5 +48,6 @@ abstract class OC_Filestorage{ abstract public function hash($type,$path,$raw); abstract public function free_space($path); abstract public function search($query); + abstract public function touch($path, $mtime=null); abstract public function getLocalFile($path);// get a path to a local version of the file, whether the original file is local or remote } diff --git a/lib/filestorage/common.php b/lib/filestorage/common.php index 40a9cff5d06c872ffd5862e878cc8d26e17ac123..fa14d7e99fd6727692e824a42ea7084ca5d4adae 100644 --- a/lib/filestorage/common.php +++ b/lib/filestorage/common.php @@ -121,4 +121,5 @@ abstract class OC_Filestorage_Common extends OC_Filestorage { $count=OC_Helper::streamCopy($source,$target); return $tmpFile; } +// abstract public function touch($path, $mtime=null); } diff --git a/lib/filestorage/commontest.php b/lib/filestorage/commontest.php index dd552c6865b8fb43ecf03cbc83498d27e475fdcd..512e7c1b66d05329914a3731368cb071f3680383 100644 --- a/lib/filestorage/commontest.php +++ b/lib/filestorage/commontest.php @@ -72,4 +72,7 @@ class OC_Filestorage_CommonTest extends OC_Filestorage_Common{ public function search($query){ return $this->storage->search($query); } + public function touch($path, $mtime=null){ + return $this->storage->touch($path,$mtime); + } } \ No newline at end of file diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php index 8acfe504cb2725510cb2952f2a20cdcc4cf22a85..8e07ce6025b88904674d235bd67273ad6de2826e 100644 --- a/lib/filestorage/local.php +++ b/lib/filestorage/local.php @@ -58,15 +58,20 @@ class OC_Filestorage_Local extends OC_Filestorage{ public function filemtime($path){ return filemtime($this->datadir.$path); } - public function touch($path, $mtime){ + public function touch($path, $mtime=null){ // sets the modification time of the file to the given value. // If mtime is nil the current time is set. // note that the access time of the file always changes to the current time. - if( touch( $this->datadir.$path, $mtime ) ) { + if(!is_null($mtime)){ + $result=touch( $this->datadir.$path, $mtime ); + }else{ + $result=touch( $this->datadir.$path); + } + if( $result ) { clearstatcache( true, $this->datadir.$path ); } - return touch($this->datadir.$path, $mtime); + return $result; } public function file_get_contents($path){ return file_get_contents($this->datadir.$path); diff --git a/lib/filesystem.php b/lib/filesystem.php index 90195bc2130e137de210fecb42c2bf037ec8f10a..5013b3968c5a9c8088463bf02a9f2d2ee931e121 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -345,7 +345,7 @@ class OC_Filesystem{ static public function filemtime($path){ return self::$defaultInstance->filemtime($path); } - static public function touch($path, $mtime){ + static public function touch($path, $mtime=null){ return self::$defaultInstance->touch($path, $mtime); } static public function file_get_contents($path){ diff --git a/lib/filesystemview.php b/lib/filesystemview.php index 5996a5f60fbe2d405de45064c8000fc23895f279..2d54a676c8c4fa0181b781fe961c92ca237bce87 100644 --- a/lib/filesystemview.php +++ b/lib/filesystemview.php @@ -163,7 +163,7 @@ class OC_FilesystemView { public function filemtime($path){ return $this->basicOperation('filemtime',$path); } - public function touch($path, $mtime){ + public function touch($path, $mtime=null){ return $this->basicOperation('touch', $path, array('write'), $mtime); } public function file_get_contents($path){