readd renaming and mtime handling to new directory nodes

This commit is contained in:
Jörn Friedrich Dreyer 2013-02-11 09:43:26 +01:00
parent 2644003bf1
commit 72a2075b1c
1 changed files with 17 additions and 1 deletions

View 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);
}