handle storage exceptions when trying to set mtime

not all storage backends can handle setting the mtime and they might
not always handle that error correctly.

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2019-06-06 16:09:27 +02:00
parent 07ffe4a34a
commit b4e2d8f8ad
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
1 changed files with 6 additions and 1 deletions

View File

@ -566,7 +566,12 @@ class View {
$hooks[] = 'create';
$hooks[] = 'write';
}
$result = $this->basicOperation('touch', $path, $hooks, $mtime);
try {
$result = $this->basicOperation('touch', $path, $hooks, $mtime);
} catch (\Exception $e) {
$this->logger->logException($e, ['level' => ILogger::INFO, 'message' => 'Error while setting modified time']);
$result = false;
}
if (!$result) {
// If create file fails because of permissions on external storage like SMB folders,
// check file exists and return false if not.