add touch() to all storage backands, and make parameter optional
This commit is contained in:
parent
b23b5aae7f
commit
e76e4e7540
|
@ -505,7 +505,13 @@ class OC_Filestorage_Shared extends OC_Filestorage {
|
||||||
return $storage->getLocalFile($this->getInternalPath($source));
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -48,5 +48,6 @@ abstract class OC_Filestorage{
|
||||||
abstract public function hash($type,$path,$raw);
|
abstract public function hash($type,$path,$raw);
|
||||||
abstract public function free_space($path);
|
abstract public function free_space($path);
|
||||||
abstract public function search($query);
|
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
|
abstract public function getLocalFile($path);// get a path to a local version of the file, whether the original file is local or remote
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,4 +121,5 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
|
||||||
$count=OC_Helper::streamCopy($source,$target);
|
$count=OC_Helper::streamCopy($source,$target);
|
||||||
return $tmpFile;
|
return $tmpFile;
|
||||||
}
|
}
|
||||||
|
// abstract public function touch($path, $mtime=null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,4 +72,7 @@ class OC_Filestorage_CommonTest extends OC_Filestorage_Common{
|
||||||
public function search($query){
|
public function search($query){
|
||||||
return $this->storage->search($query);
|
return $this->storage->search($query);
|
||||||
}
|
}
|
||||||
|
public function touch($path, $mtime=null){
|
||||||
|
return $this->storage->touch($path,$mtime);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -58,15 +58,20 @@ class OC_Filestorage_Local extends OC_Filestorage{
|
||||||
public function filemtime($path){
|
public function filemtime($path){
|
||||||
return filemtime($this->datadir.$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.
|
// sets the modification time of the file to the given value.
|
||||||
// If mtime is nil the current time is set.
|
// If mtime is nil the current time is set.
|
||||||
// note that the access time of the file always changes to the current time.
|
// 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 );
|
clearstatcache( true, $this->datadir.$path );
|
||||||
}
|
}
|
||||||
|
|
||||||
return touch($this->datadir.$path, $mtime);
|
return $result;
|
||||||
}
|
}
|
||||||
public function file_get_contents($path){
|
public function file_get_contents($path){
|
||||||
return file_get_contents($this->datadir.$path);
|
return file_get_contents($this->datadir.$path);
|
||||||
|
|
|
@ -345,7 +345,7 @@ class OC_Filesystem{
|
||||||
static public function filemtime($path){
|
static public function filemtime($path){
|
||||||
return self::$defaultInstance->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);
|
return self::$defaultInstance->touch($path, $mtime);
|
||||||
}
|
}
|
||||||
static public function file_get_contents($path){
|
static public function file_get_contents($path){
|
||||||
|
|
|
@ -163,7 +163,7 @@ class OC_FilesystemView {
|
||||||
public function filemtime($path){
|
public function filemtime($path){
|
||||||
return $this->basicOperation('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);
|
return $this->basicOperation('touch', $path, array('write'), $mtime);
|
||||||
}
|
}
|
||||||
public function file_get_contents($path){
|
public function file_get_contents($path){
|
||||||
|
|
Loading…
Reference in New Issue