diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-02 17:40:45 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-05 16:53:57 +0200 |
commit | def8e0c12a263e16ec7245c5be47b6aed10f7a78 (patch) | |
tree | f39e8f57aade4d3f3b5b909b59746a7da622fc58 /lib/private/files.php | |
parent | b5dce05cb6856cfd99bded35ca87b4a8c12813bd (diff) | |
download | nextcloud-server-def8e0c12a263e16ec7245c5be47b6aed10f7a78.tar.gz nextcloud-server-def8e0c12a263e16ec7245c5be47b6aed10f7a78.zip |
log the exception during zip creation
Diffstat (limited to 'lib/private/files.php')
-rw-r--r-- | lib/private/files.php | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/lib/private/files.php b/lib/private/files.php index 5befda3bad5..4783a617065 100644 --- a/lib/private/files.php +++ b/lib/private/files.php @@ -173,24 +173,14 @@ class OC_Files { } else { \OC\Files\Filesystem::readfile($filename); } - if ($getType === self::FILE) { - $view->unlockFile($filename, ILockingProvider::LOCK_SHARED); - } - if ($getType === self::ZIP_FILES) { - foreach ($files as $file) { - $file = $dir . '/' . $file; - $view->unlockFile($file, ILockingProvider::LOCK_SHARED); - } - } - if ($getType === self::ZIP_DIR) { - $file = $dir . '/' . $files; - $view->unlockFile($file, ILockingProvider::LOCK_SHARED); - } + self::unlockAllTheFiles($dir, $files, $getType, $view, $filename); } catch (\OCP\Lock\LockedException $ex) { + OC::$server->getLogger()->logException($ex); $l = \OC::$server->getL10N('core'); $hint = method_exists($ex, 'getHint') ? $ex->getHint() : ''; \OC_Template::printErrorPage($l->t('File is currently busy, please try again later'), $hint); } catch (\Exception $ex) { + OC::$server->getLogger()->logException($ex); $l = \OC::$server->getL10N('core'); $hint = method_exists($ex, 'getHint') ? $ex->getHint() : ''; \OC_Template::printErrorPage($l->t('Can\'t read file'), $hint); @@ -278,4 +268,27 @@ class OC_Files { } return false; } + + /** + * @param $dir + * @param $files + * @param $getType + * @param $view + * @param $filename + */ + private static function unlockAllTheFiles($dir, $files, $getType, $view, $filename) { + if ($getType === self::FILE) { + $view->unlockFile($filename, ILockingProvider::LOCK_SHARED); + } + if ($getType === self::ZIP_FILES) { + foreach ($files as $file) { + $file = $dir . '/' . $file; + $view->unlockFile($file, ILockingProvider::LOCK_SHARED); + } + } + if ($getType === self::ZIP_DIR) { + $file = $dir . '/' . $files; + $view->unlockFile($file, ILockingProvider::LOCK_SHARED); + } + } } |