When moving a file from/to a temporary location, also update the file access/modification times.
When PHP moves a file across filesystem boundaries, it does not update the access/modification times. Thus do it manually so that this information is not lost.
This commit is contained in:
parent
b98cd2d870
commit
39292ba053
|
@ -359,7 +359,9 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
|
||||||
public function toTmpFile($path){
|
public function toTmpFile($path){
|
||||||
$tmpFolder=sys_get_temp_dir();
|
$tmpFolder=sys_get_temp_dir();
|
||||||
$filename=tempnam($tmpFolder,'OC_TEMP_FILE_'.substr($path,strrpos($path,'.')));
|
$filename=tempnam($tmpFolder,'OC_TEMP_FILE_'.substr($path,strrpos($path,'.')));
|
||||||
|
$fileStats = stat($this->datadir.$path);
|
||||||
if(copy($this->datadir.$path,$filename)){
|
if(copy($this->datadir.$path,$filename)){
|
||||||
|
touch($filename, $fileStats['mtime'], $fileStats['atime']);
|
||||||
$this->notifyObservers($path,OC_FILEACTION_READ);
|
$this->notifyObservers($path,OC_FILEACTION_READ);
|
||||||
return $filename;
|
return $filename;
|
||||||
}else{
|
}else{
|
||||||
|
@ -368,7 +370,9 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fromTmpFile($tmpFile,$path){
|
public function fromTmpFile($tmpFile,$path){
|
||||||
|
$fileStats = stat($tmpFile);
|
||||||
if(rename($tmpFile,$this->datadir.$path)){
|
if(rename($tmpFile,$this->datadir.$path)){
|
||||||
|
touch($this->datadir.$path, $fileStats['mtime'], $fileStats['atime']);
|
||||||
$this->notifyObservers($path,OC_FILEACTION_CREATE);
|
$this->notifyObservers($path,OC_FILEACTION_CREATE);
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
|
|
Loading…
Reference in New Issue