Merge pull request #7207 from nextcloud/fix-object-storage-touch-12
[stable12] touch opertation on object storage, don't create the file cache entry to early
This commit is contained in:
commit
d9cea2fb61
|
@ -351,8 +351,11 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
|
|||
$stat['mtime'] = $mtime;
|
||||
$this->getCache()->update($stat['fileid'], $stat);
|
||||
} else {
|
||||
try {
|
||||
//create a empty file, need to have at least on char to make it
|
||||
// work with all object storage implementations
|
||||
$this->file_put_contents($path, ' ');
|
||||
$mimeType = \OC::$server->getMimeTypeDetector()->detectPath($path);
|
||||
// create new file
|
||||
$stat = array(
|
||||
'etag' => $this->getETag($path),
|
||||
'mimetype' => $mimeType,
|
||||
|
@ -361,15 +364,11 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
|
|||
'storage_mtime' => $mtime,
|
||||
'permissions' => \OCP\Constants::PERMISSION_ALL - \OCP\Constants::PERMISSION_CREATE,
|
||||
);
|
||||
$fileId = $this->getCache()->put($path, $stat);
|
||||
try {
|
||||
//read an empty file from memory
|
||||
$this->file_put_contents($path, ' ');
|
||||
$this->getCache()->put($path, $stat);
|
||||
} catch (\Exception $ex) {
|
||||
$this->getCache()->remove($path);
|
||||
$this->logger->logException($ex, [
|
||||
'app' => 'objectstore',
|
||||
'message' => 'Could not create object ' . $this->getURN($fileId) . ' for ' . $path,
|
||||
'message' => 'Could not create object for ' . $path,
|
||||
]);
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue