diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/connector/sabre/file.php | 4 | ||||
-rw-r--r-- | lib/private/files/cache/cache.php | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php index dc678c0894f..100aba13668 100644 --- a/lib/private/connector/sabre/file.php +++ b/lib/private/connector/sabre/file.php @@ -117,7 +117,7 @@ class File extends Node implements IFile { $target = $storage->fopen($internalPartPath, 'wb'); if ($target === false) { \OC_Log::write('webdav', '\OC\Files\Filesystem::fopen() failed', \OC_Log::ERROR); - $this->fileView->unlink($partFilePath); + $storage->unlink($internalPartPath); // because we have no clue about the cause we can only throw back a 500/Internal Server Error throw new Exception('Could not write file contents'); } @@ -166,7 +166,7 @@ class File extends Node implements IFile { $fileExists = $storage->file_exists($internalPath); if ($renameOkay === false || $fileExists === false) { \OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR); - $this->fileView->unlink($partFilePath); + $storage->unlink($internalPartPath); throw new Exception('Could not rename part file to final file'); } } catch (\OCP\Files\LockNotAcquiredException $e) { diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php index f00177d9c5b..7d3738fdc73 100644 --- a/lib/private/files/cache/cache.php +++ b/lib/private/files/cache/cache.php @@ -306,10 +306,17 @@ class Cache { } list($queryParts, $params) = $this->buildParts($data); + // duplicate $params because we need the parts twice in the SQL statement + // once for the SET part, once in the WHERE clause + $params = array_merge($params, $params); $params[] = $id; - $sql = 'UPDATE `*PREFIX*filecache` SET ' . implode(' = ?, ', $queryParts) . '=? WHERE `fileid` = ?'; + // don't update if the data we try to set is the same as the one in the record + // some databases (Postgres) don't like superfluous updates + $sql = 'UPDATE `*PREFIX*filecache` SET ' . implode(' = ?, ', $queryParts) . '=? ' . + 'WHERE (' . implode(' <> ? OR ', $queryParts) . ' <> ? ) AND `fileid` = ? '; \OC_DB::executeAudited($sql, $params); + } /** |