mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 09:42:09 -04:00
fix(files): Preserve directory mtime on rename and move
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
parent
a9c3a148f6
commit
f9b4cf417a
1 changed files with 8 additions and 0 deletions
|
|
@ -240,6 +240,10 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage,
|
|||
}
|
||||
}
|
||||
closedir($dir);
|
||||
if ($preserveMtime) {
|
||||
$mtime = $this->filemtime($source);
|
||||
$this->touch($target, is_int($mtime) ? $mtime : null);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
$sourceStream = $this->fopen($source, 'r');
|
||||
|
|
@ -637,6 +641,10 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage,
|
|||
$result = $this->copyFromStorage($sourceStorage, $sourceInternalPath . '/' . $file, $targetInternalPath . '/' . $file, $preserveMtime);
|
||||
}
|
||||
}
|
||||
if ($result && $preserveMtime) {
|
||||
$mtime = $sourceStorage->filemtime($sourceInternalPath);
|
||||
$this->touch($targetInternalPath, is_int($mtime) ? $mtime : null);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$source = $sourceStorage->fopen($sourceInternalPath, 'r');
|
||||
|
|
|
|||
Loading…
Reference in a new issue