mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 00:32:29 -04:00
add touch() to all storage backands, and make parameter optional
Conflicts: lib/filestorage.php lib/filestorage/common.php lib/filestorage/commontest.php lib/filestorage/local.php lib/filesystemview.php
This commit is contained in:
parent
f89f3701df
commit
2528778651
4 changed files with 18 additions and 6 deletions
|
|
@ -569,7 +569,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -53,5 +53,6 @@ class OC_Filestorage{
|
|||
public function hash($type,$path,$raw){}
|
||||
public function free_space($path){}
|
||||
public function search($query){}
|
||||
public function touch($path, $mtime=null){}
|
||||
public function getLocalFile($path){}// get a path to a local version of the file, whether the original file is local or remote
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,15 +70,20 @@ class OC_Filestorage_Local extends OC_Filestorage{
|
|||
public function fileatime($path){
|
||||
return fileatime($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);
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ class OC_Filesystem{
|
|||
static public function fileatime($path){
|
||||
return self::basicOperation('fileatime',$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){
|
||||
|
|
|
|||
Loading…
Reference in a new issue