only use one kind of hack for the storage wrappers of the sharing code
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
parent
e7b1196dd6
commit
b373f52fa8
|
@ -63,9 +63,12 @@ $path = $data['realPath'];
|
||||||
|
|
||||||
$isWritable = $share->getPermissions() & (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_CREATE);
|
$isWritable = $share->getPermissions() & (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_CREATE);
|
||||||
if (!$isWritable) {
|
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) {
|
\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));
|
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);
|
$rootInfo = \OC\Files\Filesystem::getFileInfo($path);
|
||||||
|
|
|
@ -229,7 +229,7 @@ class Filesystem {
|
||||||
* @param int $priority
|
* @param int $priority
|
||||||
*/
|
*/
|
||||||
public static function addStorageWrapper($wrapperName, $wrapper, $priority = 50) {
|
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.", [
|
\OC::$server->getLogger()->warning("Storage wrapper '{wrapper}' was not registered via the 'OC_Filesystem - preSetup' hook which could cause potential problems.", [
|
||||||
'wrapper' => $wrapperName,
|
'wrapper' => $wrapperName,
|
||||||
'app' => 'filesystem',
|
'app' => 'filesystem',
|
||||||
|
|
Loading…
Reference in New Issue