Hack to prevent warning for read-only wrapper in public links
Storage wrappers should normally always be registered inside a presetup hook. However in the public link scenario this is not possible and there is currently no good alternative with the current architecture. Instead of logging a warning every time, this fix prevents the warning to be shown but also adds a FIXME in the code for the future. This is ok because this app is already using private/internal APIs at the moment and should be reworked properly in the future.
This commit is contained in:
parent
cc8750ca30
commit
e7b1196dd6
|
@ -73,14 +73,12 @@ $server = $serverFactory->createServer($baseuri, $requestUri, $authBackend, func
|
||||||
$isReadable = $share->getPermissions() & \OCP\Constants::PERMISSION_READ;
|
$isReadable = $share->getPermissions() & \OCP\Constants::PERMISSION_READ;
|
||||||
$fileId = $share->getNodeId();
|
$fileId = $share->getNodeId();
|
||||||
|
|
||||||
/*
|
// FIXME: should not add storage wrappers outside of preSetup, need to find a better way
|
||||||
if (!$isReadable) {
|
$previousLog = \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false);
|
||||||
return false;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
\OC\Files\Filesystem::addStorageWrapper('sharePermissions', function ($mountPoint, $storage) use ($share) {
|
\OC\Files\Filesystem::addStorageWrapper('sharePermissions', function ($mountPoint, $storage) use ($share) {
|
||||||
return new \OC\Files\Storage\Wrapper\PermissionsMask(array('storage' => $storage, 'mask' => $share->getPermissions() | \OCP\Constants::PERMISSION_SHARE));
|
return new \OC\Files\Storage\Wrapper\PermissionsMask(array('storage' => $storage, 'mask' => $share->getPermissions() | \OCP\Constants::PERMISSION_SHARE));
|
||||||
});
|
});
|
||||||
|
\OC\Files\Filesystem::logWarningWhenAddingStorageWrapper($previousLog);
|
||||||
|
|
||||||
OC_Util::setupFS($owner);
|
OC_Util::setupFS($owner);
|
||||||
$ownerView = \OC\Files\Filesystem::getView();
|
$ownerView = \OC\Files\Filesystem::getView();
|
||||||
|
|
|
@ -214,10 +214,13 @@ class Filesystem {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bool $shouldLog
|
* @param bool $shouldLog
|
||||||
|
* @return bool previous value
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
public static function logWarningWhenAddingStorageWrapper($shouldLog) {
|
public static function logWarningWhenAddingStorageWrapper($shouldLog) {
|
||||||
self::$logWarningWhenAddingStorageWrapper = (bool)$shouldLog;
|
$previousValue = self::$logWarningWhenAddingStorageWrapper;
|
||||||
|
self::$logWarningWhenAddingStorageWrapper = (bool) $shouldLog;
|
||||||
|
return $previousValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue