diff options
author | Björn Schießle <bjoern@schiessle.org> | 2013-12-06 10:00:04 -0800 |
---|---|---|
committer | Björn Schießle <bjoern@schiessle.org> | 2013-12-06 10:00:04 -0800 |
commit | 575a68074fbaa9614ad746bf589d843998a2cb3c (patch) | |
tree | 5453615ba1dc4ebb69cce81820cd15fc6597c149 /apps/files_encryption/lib/util.php | |
parent | b5939324b0053b6447423ebc8b269e9f773f7f02 (diff) | |
parent | 4c8bc61753dd26db1a239f8a6743c662d0d83dd4 (diff) | |
download | nextcloud-server-575a68074fbaa9614ad746bf589d843998a2cb3c.tar.gz nextcloud-server-575a68074fbaa9614ad746bf589d843998a2cb3c.zip |
Merge pull request #6220 from owncloud/debug_oracle_errors
cherry-picks from #5884, just for debugging purpose
Diffstat (limited to 'apps/files_encryption/lib/util.php')
-rw-r--r-- | apps/files_encryption/lib/util.php | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index ef8d0161f6e..bf7c49504a2 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -840,32 +840,35 @@ class Util { // Open enc file handle for binary writing, with same filename as original plain file $encHandle = fopen('crypt://' . $rawPath . '.part', 'wb'); - // Move plain file to a temporary location - $size = stream_copy_to_stream($plainHandle, $encHandle); + if (is_resource($encHandle)) { + // Move plain file to a temporary location + $size = stream_copy_to_stream($plainHandle, $encHandle); - fclose($encHandle); - fclose($plainHandle); + fclose($encHandle); + fclose($plainHandle); - $fakeRoot = $this->view->getRoot(); - $this->view->chroot('/' . $this->userId . '/files'); + $fakeRoot = $this->view->getRoot(); + $this->view->chroot('/' . $this->userId . '/files'); - $this->view->rename($relPath . '.part', $relPath); + $this->view->rename($relPath . '.part', $relPath); - // set timestamp - $this->view->touch($relPath, $timestamp); + // set timestamp + $this->view->touch($relPath, $timestamp); - $this->view->chroot($fakeRoot); + $encSize = $this->view->filesize($relPath); - // Add the file to the cache - \OC\Files\Filesystem::putFileInfo($relPath, array( - 'encrypted' => true, - 'size' => $size, - 'unencrypted_size' => $size, - 'etag' => $fileInfo['etag'] - )); + $this->view->chroot($fakeRoot); - $encryptedFiles[] = $relPath; + // Add the file to the cache + \OC\Files\Filesystem::putFileInfo($relPath, array( + 'encrypted' => true, + 'size' => $encSize, + 'unencrypted_size' => $size, + 'etag' => $fileInfo['etag'] + )); + $encryptedFiles[] = $relPath; + } } // Encrypt legacy encrypted files |