]> source.dussan.org Git - nextcloud-server.git/commitdiff
disable touch to update mtime for external s3 storage 21734/head
authorRobin Appelman <robin@icewind.nl>
Tue, 7 Jul 2020 13:55:38 +0000 (15:55 +0200)
committerRobin Appelman <robin@icewind.nl>
Tue, 7 Jul 2020 13:55:38 +0000 (15:55 +0200)
since updating the mtime requires doing a copy this can have a significant overhead and it messes with versioning

Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files_external/lib/Lib/Storage/AmazonS3.php

index 641a26b20eef956778cd8756b8790110116c0493..79b48ef453b5f3c2b6bf27fee5ba3c6d68fe7266 100644 (file)
@@ -544,9 +544,6 @@ class AmazonS3 extends \OC\Files\Storage\Common {
        }
 
        public function touch($path, $mtime = null) {
-               $path = $this->normalizePath($path);
-
-               $metadata = [];
                if (is_null($mtime)) {
                        $mtime = time();
                }
@@ -554,21 +551,8 @@ class AmazonS3 extends \OC\Files\Storage\Common {
                        'lastmodified' => gmdate(\DateTime::RFC1123, $mtime)
                ];
 
-               $fileType = $this->filetype($path);
                try {
-                       if ($fileType !== false) {
-                               if ($fileType === 'dir' && !$this->isRoot($path)) {
-                                       $path .= '/';
-                               }
-                               $this->getConnection()->copyObject([
-                                       'Bucket' => $this->bucket,
-                                       'Key' => $this->cleanKey($path),
-                                       'Metadata' => $metadata,
-                                       'CopySource' => $this->bucket . '/' . $path,
-                                       'MetadataDirective' => 'REPLACE',
-                               ]);
-                               $this->testTimeout();
-                       } else {
+                       if (!$this->file_exists($path)) {
                                $mimeType = \OC::$server->getMimeTypeDetector()->detectPath($path);
                                $this->getConnection()->putObject([
                                        'Bucket' => $this->bucket,