From b373f52fa8c0eb80338e5f06981f4a048f5720e1 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Mon, 14 Nov 2016 16:13:05 +0100 Subject: [PATCH] only use one kind of hack for the storage wrappers of the sharing code Signed-off-by: Morris Jobke --- apps/files_sharing/ajax/shareinfo.php | 3 +++ lib/private/Files/Filesystem.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/ajax/shareinfo.php b/apps/files_sharing/ajax/shareinfo.php index 75d6e6081ec..a32b0a07328 100644 --- a/apps/files_sharing/ajax/shareinfo.php +++ b/apps/files_sharing/ajax/shareinfo.php @@ -63,9 +63,12 @@ $path = $data['realPath']; $isWritable = $share->getPermissions() & (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_CREATE); if (!$isWritable) { + // FIXME: should not add storage wrappers outside of preSetup, need to find a better way + $previousLog = \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false); \OC\Files\Filesystem::addStorageWrapper('readonly', function ($mountPoint, $storage) { return new \OC\Files\Storage\Wrapper\PermissionsMask(array('storage' => $storage, 'mask' => \OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_SHARE)); }); + \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper($previousLog); } $rootInfo = \OC\Files\Filesystem::getFileInfo($path); diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php index 3f776a1a809..42a6d950332 100644 --- a/lib/private/Files/Filesystem.php +++ b/lib/private/Files/Filesystem.php @@ -229,7 +229,7 @@ class Filesystem { * @param int $priority */ public static function addStorageWrapper($wrapperName, $wrapper, $priority = 50) { - if (self::$logWarningWhenAddingStorageWrapper && $wrapperName !== 'readonly') { + if (self::$logWarningWhenAddingStorageWrapper) { \OC::$server->getLogger()->warning("Storage wrapper '{wrapper}' was not registered via the 'OC_Filesystem - preSetup' hook which could cause potential problems.", [ 'wrapper' => $wrapperName, 'app' => 'filesystem', -- 2.39.5