Merge pull request #2186 from nextcloud/stable10-2122

[stable10] Hack to prevent warning for read-only wrapper in public links
This commit is contained in:
Morris Jobke 2016-11-17 18:34:53 +01:00 committed by GitHub
commit 915334a44b
3 changed files with 9 additions and 0 deletions

View File

@ -76,9 +76,12 @@ $server = $serverFactory->createServer($baseuri, $requestUri, $authBackend, func
return false;
}
// 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('sharePermissions', function ($mountPoint, $storage) use ($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);
$ownerView = \OC\Files\Filesystem::getView();

View File

@ -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);

View File

@ -213,10 +213,13 @@ class Filesystem {
/**
* @param bool $shouldLog
* @return bool previous value
* @internal
*/
public static function logWarningWhenAddingStorageWrapper($shouldLog) {
$previousValue = self::$logWarningWhenAddingStorageWrapper;
self::$logWarningWhenAddingStorageWrapper = (bool) $shouldLog;
return $previousValue;
}
/**