remove excessive logging

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2017-04-26 16:41:48 +02:00
parent f2bd5f7496
commit 43970b93d1
No known key found for this signature in database
GPG Key ID: CBCA68FBAEBF98C9
1 changed files with 8 additions and 25 deletions

View File

@ -31,6 +31,7 @@
namespace OCA\Files_External\Lib\Storage; namespace OCA\Files_External\Lib\Storage;
use Icewind\SMB\Exception\AlreadyExistsException;
use Icewind\SMB\Exception\ConnectException; use Icewind\SMB\Exception\ConnectException;
use Icewind\SMB\Exception\Exception; use Icewind\SMB\Exception\Exception;
use Icewind\SMB\Exception\ForbiddenException; use Icewind\SMB\Exception\ForbiddenException;
@ -182,28 +183,21 @@ class SMB extends Common implements INotifyStorage {
* @return bool true if the rename is successful, false otherwise * @return bool true if the rename is successful, false otherwise
*/ */
public function rename($source, $target) { public function rename($source, $target) {
$this->log("enter: rename('$source', '$target')", Util::DEBUG);
if ($this->isRootDir($source) || $this->isRootDir($target)) { if ($this->isRootDir($source) || $this->isRootDir($target)) {
$this->log("refusing to rename \"$source\" to \"$target\""); return false;
return $this->leave(__FUNCTION__, false);
} }
try { try {
$result = $this->share->rename($this->root . $source, $this->root . $target); $result = $this->share->rename($this->root . $source, $this->root . $target);
$this->removeFromCache($this->root . $source); unset($this->statCache[$this->root . $source], $this->statCache[$this->root . $target]);
$this->removeFromCache($this->root . $target);
} catch (AlreadyExistsException $e) { } catch (AlreadyExistsException $e) {
$this->unlink($target); $this->unlink($target);
$result = $this->share->rename($this->root . $source, $this->root . $target); $result = $this->share->rename($this->root . $source, $this->root . $target);
$this->removeFromCache($this->root . $source); unset($this->statCache[$this->root . $source], $this->statCache[$this->root . $target]);
$this->removeFromCache($this->root . $target);
$this->swallow(__FUNCTION__, $e);
} catch (\Exception $e) { } catch (\Exception $e) {
$this->swallow(__FUNCTION__, $e);
$result = false; $result = false;
} }
return $this->leave(__FUNCTION__, $result); return $result;
} }
/** /**
@ -258,11 +252,8 @@ class SMB extends Common implements INotifyStorage {
* @return bool * @return bool
*/ */
public function unlink($path) { public function unlink($path) {
$this->log('enter: '.__FUNCTION__."($path)");
if ($this->isRootDir($path)) { if ($this->isRootDir($path)) {
$this->log("refusing to unlink \"$path\""); return false;
return $this->leave(__FUNCTION__, false);
} }
try { try {
@ -311,7 +302,7 @@ class SMB extends Common implements INotifyStorage {
* @return bool * @return bool
*/ */
public function hasUpdated($path, $time) { public function hasUpdated($path, $time) {
if (!$path and $this->root == '/') { if (!$path and $this->root === '/') {
// mtime doesn't work for shares, but giving the nature of the backend, // mtime doesn't work for shares, but giving the nature of the backend,
// doing a full update is still just fast enough // doing a full update is still just fast enough
return true; return true;
@ -388,11 +379,8 @@ class SMB extends Common implements INotifyStorage {
} }
public function rmdir($path) { public function rmdir($path) {
$this->log('enter: '.__FUNCTION__."($path)");
if ($this->isRootDir($path)) { if ($this->isRootDir($path)) {
$this->log("refusing to delete \"$path\""); return false;
return $this->leave(__FUNCTION__, false);
} }
try { try {
@ -491,8 +479,6 @@ class SMB extends Common implements INotifyStorage {
} }
public function isUpdatable($path) { public function isUpdatable($path) {
$this->log('enter: '.__FUNCTION__."($path)");
$result = false;
try { try {
$info = $this->getFileInfo($path); $info = $this->getFileInfo($path);
// following windows behaviour for read-only folders: they can be written into // following windows behaviour for read-only folders: they can be written into
@ -503,12 +489,9 @@ class SMB extends Common implements INotifyStorage {
} catch (ForbiddenException $e) { } catch (ForbiddenException $e) {
return false; return false;
} }
return $this->leave(__FUNCTION__, $result);
} }
public function isDeletable($path) { public function isDeletable($path) {
$this->log('enter: '.__FUNCTION__."($path)");
$result = false;
try { try {
$info = $this->getFileInfo($path); $info = $this->getFileInfo($path);
return !$info->isHidden() && !$info->isReadOnly(); return !$info->isHidden() && !$info->isReadOnly();