Merge pull request #22950 from owncloud/fixsharemountrecursion
Fix share mounting recursion
This commit is contained in:
commit
8c8ff0eae7
|
@ -85,6 +85,7 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function isValid() {
|
private function isValid() {
|
||||||
|
$this->init();
|
||||||
return ($this->sourceRootInfo->getPermissions() & Constants::PERMISSION_SHARE) === Constants::PERMISSION_SHARE;
|
return ($this->sourceRootInfo->getPermissions() & Constants::PERMISSION_SHARE) === Constants::PERMISSION_SHARE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -566,6 +567,7 @@ class Shared extends \OC\Files\Storage\Common implements ISharedStorage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCache($path = '', $storage = null) {
|
public function getCache($path = '', $storage = null) {
|
||||||
|
$this->init();
|
||||||
if (!$storage) {
|
if (!$storage) {
|
||||||
$storage = $this;
|
$storage = $this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace OC\Files\Config;
|
||||||
|
|
||||||
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
|
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
|
||||||
use OC\Files\Filesystem;
|
use OC\Files\Filesystem;
|
||||||
|
use OCA\Files_Sharing\SharedMount;
|
||||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||||
use OCP\Files\Config\ICachedMountInfo;
|
use OCP\Files\Config\ICachedMountInfo;
|
||||||
use OCP\Files\Config\IUserMountCache;
|
use OCP\Files\Config\IUserMountCache;
|
||||||
|
@ -75,12 +76,16 @@ class UserMountCache implements IUserMountCache {
|
||||||
public function registerMounts(IUser $user, array $mounts) {
|
public function registerMounts(IUser $user, array $mounts) {
|
||||||
// filter out non-proper storages coming from unit tests
|
// filter out non-proper storages coming from unit tests
|
||||||
$mounts = array_filter($mounts, function (IMountPoint $mount) {
|
$mounts = array_filter($mounts, function (IMountPoint $mount) {
|
||||||
return $mount->getStorage() && $mount->getStorage()->getCache();
|
return $mount instanceof SharedMount || $mount->getStorage() && $mount->getStorage()->getCache();
|
||||||
});
|
});
|
||||||
/** @var ICachedMountInfo[] $newMounts */
|
/** @var ICachedMountInfo[] $newMounts */
|
||||||
$newMounts = array_map(function (IMountPoint $mount) use ($user) {
|
$newMounts = array_map(function (IMountPoint $mount) use ($user) {
|
||||||
$storage = $mount->getStorage();
|
$storage = $mount->getStorage();
|
||||||
$rootId = (int)$storage->getCache()->getId('');
|
if ($storage->instanceOfStorage('\OC\Files\Storage\Shared')) {
|
||||||
|
$rootId = (int)$storage->getShare()['file_source'];
|
||||||
|
} else {
|
||||||
|
$rootId = (int)$storage->getCache()->getId('');
|
||||||
|
}
|
||||||
$storageId = (int)$storage->getStorageCache()->getNumericId();
|
$storageId = (int)$storage->getStorageCache()->getNumericId();
|
||||||
// filter out any storages which aren't scanned yet since we aren't interested in files from those storages (yet)
|
// filter out any storages which aren't scanned yet since we aren't interested in files from those storages (yet)
|
||||||
if ($rootId === -1) {
|
if ($rootId === -1) {
|
||||||
|
|
|
@ -165,7 +165,7 @@ class OC_Util {
|
||||||
|
|
||||||
// install storage availability wrapper, before most other wrappers
|
// install storage availability wrapper, before most other wrappers
|
||||||
\OC\Files\Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, $storage) {
|
\OC\Files\Filesystem::addStorageWrapper('oc_availability', function ($mountPoint, $storage) {
|
||||||
if (!$storage->isLocal()) {
|
if (!$storage->instanceOfStorage('\OC\Files\Storage\Shared') && !$storage->isLocal()) {
|
||||||
return new \OC\Files\Storage\Wrapper\Availability(['storage' => $storage]);
|
return new \OC\Files\Storage\Wrapper\Availability(['storage' => $storage]);
|
||||||
}
|
}
|
||||||
return $storage;
|
return $storage;
|
||||||
|
|
Loading…
Reference in New Issue