Merge pull request #7555 from nextcloud/smb-copy-rename-log

additional debug logging on smb copy/rename failures
This commit is contained in:
Robin Appelman 2017-12-18 15:02:18 +01:00 committed by GitHub
commit bdf4111013
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View file

@ -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]);

View file

@ -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;
}