]> source.dussan.org Git - nextcloud-server.git/commitdiff
readd renaming and mtime handling to new directory nodes
authorJörn Friedrich Dreyer <jfd@butonic.de>
Mon, 11 Feb 2013 08:43:26 +0000 (09:43 +0100)
committerJörn Friedrich Dreyer <jfd@butonic.de>
Mon, 11 Feb 2013 08:43:26 +0000 (09:43 +0100)
lib/connector/sabre/directory.php

index c4062170d5e106d354387892f9dddd67c53bff10..d8d74b922ab398d20c28a1f36dc99266fc6830ce 100644 (file)
@@ -62,7 +62,23 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
                        }
                } else {
                        $newPath = $this->path . '/' . $name;
-                       \OC\Files\Filesystem::file_put_contents($newPath, $data);
+                       
+                       // mark file as partial while uploading (ignored by the scanner)
+                       $partpath = $newPath . '.part';
+
+                       \OC\Files\Filesystem::file_put_contents($partpath, $data);
+
+                       // rename to correct path
+                       \OC\Files\Filesystem::rename($partpath, $newPath);
+                       
+                       // allow sync clients to send the mtime along in a header
+                       $mtime = OC_Request::hasModificationTime();
+                       if ($mtime !== false) {
+                               if(\OC\Files\Filesystem::touch($newPath, $mtime)) {
+                                       header('X-OC-MTime: accepted');
+                               }
+                       }
+                       
                        return OC_Connector_Sabre_Node::getETagPropertyForPath($newPath);
                }