From 4f0d03e1722fbc09944f24364501d1264653e6cb Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 18 Dec 2017 13:59:58 +0100 Subject: [PATCH] additional debug logging on smb copy/rename failures Signed-off-by: Robin Appelman --- apps/files_external/lib/Lib/Storage/SMB.php | 2 ++ lib/private/Files/Storage/Common.php | 3 +++ 2 files changed, 5 insertions(+) diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index 557dafda72..67ba2ae2c5 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -52,6 +52,7 @@ use OCP\Files\Notify\IChange; use OCP\Files\Notify\IRenameChange; use OCP\Files\Storage\INotifyStorage; use OCP\Files\StorageNotAvailableException; +use OCP\Util; class SMB extends Common implements INotifyStorage { /** @@ -199,6 +200,7 @@ class SMB extends Common implements INotifyStorage { $this->remove($target); $result = $this->share->rename($absoluteSource, $absoluteTarget); } catch (\Exception $e) { + \OC::$server->getLogger()->logException($e, ['level' => Util::WARN]); return false; } unset($this->statCache[$absoluteSource], $this->statCache[$absoluteTarget]); diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index 715b7b1849..56d683ffa2 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -229,6 +229,9 @@ abstract class Common implements Storage, ILockingStorage { $source = $this->fopen($path1, 'r'); $target = $this->fopen($path2, 'w'); list(, $result) = \OC_Helper::streamCopy($source, $target); + if (!$result) { + \OC::$server->getLogger()->warning("Failed to write data while copying $path1 to $path2"); + } $this->removeCachedFile($path2); return $result; }