@@ -34,107 +34,107 @@ |
||
| 34 | 34 | * Mount provider for object store home storages |
| 35 | 35 | */ |
| 36 | 36 | class ObjectHomeMountProvider implements IHomeMountProvider { |
| 37 | - /** |
|
| 38 | - * @var IConfig |
|
| 39 | - */ |
|
| 40 | - private $config; |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * ObjectStoreHomeMountProvider constructor. |
|
| 44 | - * |
|
| 45 | - * @param IConfig $config |
|
| 46 | - */ |
|
| 47 | - public function __construct(IConfig $config) { |
|
| 48 | - $this->config = $config; |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * Get the cache mount for a user |
|
| 53 | - * |
|
| 54 | - * @param IUser $user |
|
| 55 | - * @param IStorageFactory $loader |
|
| 56 | - * @return \OCP\Files\Mount\IMountPoint |
|
| 57 | - */ |
|
| 58 | - public function getHomeMountForUser(IUser $user, IStorageFactory $loader) { |
|
| 59 | - $config = $this->getMultiBucketObjectStoreConfig($user); |
|
| 60 | - if ($config === null) { |
|
| 61 | - $config = $this->getSingleBucketObjectStoreConfig($user); |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - if ($config === null) { |
|
| 65 | - return null; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - return new MountPoint('\OC\Files\ObjectStore\HomeObjectStoreStorage', '/' . $user->getUID(), $config['arguments'], $loader, null, null, self::class); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * @param IUser $user |
|
| 73 | - * @return array|null |
|
| 74 | - */ |
|
| 75 | - private function getSingleBucketObjectStoreConfig(IUser $user) { |
|
| 76 | - $config = $this->config->getSystemValue('objectstore'); |
|
| 77 | - if (!is_array($config)) { |
|
| 78 | - return null; |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - // sanity checks |
|
| 82 | - if (empty($config['class'])) { |
|
| 83 | - \OCP\Util::writeLog('files', 'No class given for objectstore', ILogger::ERROR); |
|
| 84 | - } |
|
| 85 | - if (!isset($config['arguments'])) { |
|
| 86 | - $config['arguments'] = []; |
|
| 87 | - } |
|
| 88 | - // instantiate object store implementation |
|
| 89 | - $config['arguments']['objectstore'] = new $config['class']($config['arguments']); |
|
| 90 | - |
|
| 91 | - $config['arguments']['user'] = $user; |
|
| 92 | - |
|
| 93 | - return $config; |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * @param IUser $user |
|
| 98 | - * @return array|null |
|
| 99 | - */ |
|
| 100 | - private function getMultiBucketObjectStoreConfig(IUser $user) { |
|
| 101 | - $config = $this->config->getSystemValue('objectstore_multibucket'); |
|
| 102 | - if (!is_array($config)) { |
|
| 103 | - return null; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - // sanity checks |
|
| 107 | - if (empty($config['class'])) { |
|
| 108 | - \OCP\Util::writeLog('files', 'No class given for objectstore', ILogger::ERROR); |
|
| 109 | - } |
|
| 110 | - if (!isset($config['arguments'])) { |
|
| 111 | - $config['arguments'] = []; |
|
| 112 | - } |
|
| 113 | - |
|
| 114 | - $bucket = $this->config->getUserValue($user->getUID(), 'homeobjectstore', 'bucket', null); |
|
| 115 | - |
|
| 116 | - if ($bucket === null) { |
|
| 117 | - /* |
|
| 37 | + /** |
|
| 38 | + * @var IConfig |
|
| 39 | + */ |
|
| 40 | + private $config; |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * ObjectStoreHomeMountProvider constructor. |
|
| 44 | + * |
|
| 45 | + * @param IConfig $config |
|
| 46 | + */ |
|
| 47 | + public function __construct(IConfig $config) { |
|
| 48 | + $this->config = $config; |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * Get the cache mount for a user |
|
| 53 | + * |
|
| 54 | + * @param IUser $user |
|
| 55 | + * @param IStorageFactory $loader |
|
| 56 | + * @return \OCP\Files\Mount\IMountPoint |
|
| 57 | + */ |
|
| 58 | + public function getHomeMountForUser(IUser $user, IStorageFactory $loader) { |
|
| 59 | + $config = $this->getMultiBucketObjectStoreConfig($user); |
|
| 60 | + if ($config === null) { |
|
| 61 | + $config = $this->getSingleBucketObjectStoreConfig($user); |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + if ($config === null) { |
|
| 65 | + return null; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + return new MountPoint('\OC\Files\ObjectStore\HomeObjectStoreStorage', '/' . $user->getUID(), $config['arguments'], $loader, null, null, self::class); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * @param IUser $user |
|
| 73 | + * @return array|null |
|
| 74 | + */ |
|
| 75 | + private function getSingleBucketObjectStoreConfig(IUser $user) { |
|
| 76 | + $config = $this->config->getSystemValue('objectstore'); |
|
| 77 | + if (!is_array($config)) { |
|
| 78 | + return null; |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + // sanity checks |
|
| 82 | + if (empty($config['class'])) { |
|
| 83 | + \OCP\Util::writeLog('files', 'No class given for objectstore', ILogger::ERROR); |
|
| 84 | + } |
|
| 85 | + if (!isset($config['arguments'])) { |
|
| 86 | + $config['arguments'] = []; |
|
| 87 | + } |
|
| 88 | + // instantiate object store implementation |
|
| 89 | + $config['arguments']['objectstore'] = new $config['class']($config['arguments']); |
|
| 90 | + |
|
| 91 | + $config['arguments']['user'] = $user; |
|
| 92 | + |
|
| 93 | + return $config; |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * @param IUser $user |
|
| 98 | + * @return array|null |
|
| 99 | + */ |
|
| 100 | + private function getMultiBucketObjectStoreConfig(IUser $user) { |
|
| 101 | + $config = $this->config->getSystemValue('objectstore_multibucket'); |
|
| 102 | + if (!is_array($config)) { |
|
| 103 | + return null; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + // sanity checks |
|
| 107 | + if (empty($config['class'])) { |
|
| 108 | + \OCP\Util::writeLog('files', 'No class given for objectstore', ILogger::ERROR); |
|
| 109 | + } |
|
| 110 | + if (!isset($config['arguments'])) { |
|
| 111 | + $config['arguments'] = []; |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + $bucket = $this->config->getUserValue($user->getUID(), 'homeobjectstore', 'bucket', null); |
|
| 115 | + |
|
| 116 | + if ($bucket === null) { |
|
| 117 | + /* |
|
| 118 | 118 | * Use any provided bucket argument as prefix |
| 119 | 119 | * and add the mapping from username => bucket |
| 120 | 120 | */ |
| 121 | - if (!isset($config['arguments']['bucket'])) { |
|
| 122 | - $config['arguments']['bucket'] = ''; |
|
| 123 | - } |
|
| 124 | - $mapper = new \OC\Files\ObjectStore\Mapper($user, $this->config); |
|
| 125 | - $numBuckets = isset($config['arguments']['num_buckets']) ? $config['arguments']['num_buckets'] : 64; |
|
| 126 | - $config['arguments']['bucket'] .= $mapper->getBucket($numBuckets); |
|
| 121 | + if (!isset($config['arguments']['bucket'])) { |
|
| 122 | + $config['arguments']['bucket'] = ''; |
|
| 123 | + } |
|
| 124 | + $mapper = new \OC\Files\ObjectStore\Mapper($user, $this->config); |
|
| 125 | + $numBuckets = isset($config['arguments']['num_buckets']) ? $config['arguments']['num_buckets'] : 64; |
|
| 126 | + $config['arguments']['bucket'] .= $mapper->getBucket($numBuckets); |
|
| 127 | 127 | |
| 128 | - $this->config->setUserValue($user->getUID(), 'homeobjectstore', 'bucket', $config['arguments']['bucket']); |
|
| 129 | - } else { |
|
| 130 | - $config['arguments']['bucket'] = $bucket; |
|
| 131 | - } |
|
| 128 | + $this->config->setUserValue($user->getUID(), 'homeobjectstore', 'bucket', $config['arguments']['bucket']); |
|
| 129 | + } else { |
|
| 130 | + $config['arguments']['bucket'] = $bucket; |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - // instantiate object store implementation |
|
| 134 | - $config['arguments']['objectstore'] = new $config['class']($config['arguments']); |
|
| 133 | + // instantiate object store implementation |
|
| 134 | + $config['arguments']['objectstore'] = new $config['class']($config['arguments']); |
|
| 135 | 135 | |
| 136 | - $config['arguments']['user'] = $user; |
|
| 136 | + $config['arguments']['user'] = $user; |
|
| 137 | 137 | |
| 138 | - return $config; |
|
| 139 | - } |
|
| 138 | + return $config; |
|
| 139 | + } |
|
| 140 | 140 | } |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | return null; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - return new MountPoint('\OC\Files\ObjectStore\HomeObjectStoreStorage', '/' . $user->getUID(), $config['arguments'], $loader, null, null, self::class); |
|
| 68 | + return new MountPoint('\OC\Files\ObjectStore\HomeObjectStoreStorage', '/'.$user->getUID(), $config['arguments'], $loader, null, null, self::class); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | /** |
@@ -37,120 +37,120 @@ |
||
| 37 | 37 | * Mount provider for object store app data folder for previews |
| 38 | 38 | */ |
| 39 | 39 | class ObjectStorePreviewCacheMountProvider implements IRootMountProvider { |
| 40 | - /** @var ILogger */ |
|
| 41 | - private $logger; |
|
| 42 | - /** @var IConfig */ |
|
| 43 | - private $config; |
|
| 44 | - |
|
| 45 | - public function __construct(ILogger $logger, IConfig $config) { |
|
| 46 | - $this->logger = $logger; |
|
| 47 | - $this->config = $config; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * @return MountPoint[] |
|
| 52 | - * @throws \Exception |
|
| 53 | - */ |
|
| 54 | - public function getRootMounts(IStorageFactory $loader): array { |
|
| 55 | - if (!is_array($this->config->getSystemValue('objectstore_multibucket'))) { |
|
| 56 | - return []; |
|
| 57 | - } |
|
| 58 | - if ($this->config->getSystemValue('objectstore.multibucket.preview-distribution', false) !== true) { |
|
| 59 | - return []; |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - $instanceId = $this->config->getSystemValueString('instanceid', ''); |
|
| 63 | - $mountPoints = []; |
|
| 64 | - $directoryRange = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; |
|
| 65 | - $i = 0; |
|
| 66 | - foreach ($directoryRange as $parent) { |
|
| 67 | - foreach ($directoryRange as $child) { |
|
| 68 | - $mountPoints[] = new MountPoint( |
|
| 69 | - AppdataPreviewObjectStoreStorage::class, |
|
| 70 | - '/appdata_' . $instanceId . '/preview/' . $parent . '/' . $child, |
|
| 71 | - $this->getMultiBucketObjectStore($i), |
|
| 72 | - $loader, |
|
| 73 | - null, |
|
| 74 | - null, |
|
| 75 | - self::class |
|
| 76 | - ); |
|
| 77 | - $i++; |
|
| 78 | - } |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - $rootStorageArguments = $this->getMultiBucketObjectStoreForRoot(); |
|
| 82 | - $fakeRootStorage = new ObjectStoreStorage($rootStorageArguments); |
|
| 83 | - $fakeRootStorageJail = new Jail([ |
|
| 84 | - 'storage' => $fakeRootStorage, |
|
| 85 | - 'root' => '/appdata_' . $instanceId . '/preview', |
|
| 86 | - ]); |
|
| 87 | - |
|
| 88 | - // add a fallback location to be able to fetch existing previews from the old bucket |
|
| 89 | - $mountPoints[] = new MountPoint( |
|
| 90 | - $fakeRootStorageJail, |
|
| 91 | - '/appdata_' . $instanceId . '/preview/old-multibucket', |
|
| 92 | - null, |
|
| 93 | - $loader, |
|
| 94 | - null, |
|
| 95 | - null, |
|
| 96 | - self::class |
|
| 97 | - ); |
|
| 98 | - |
|
| 99 | - return $mountPoints; |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - protected function getMultiBucketObjectStore(int $number): array { |
|
| 103 | - $config = $this->config->getSystemValue('objectstore_multibucket'); |
|
| 104 | - |
|
| 105 | - // sanity checks |
|
| 106 | - if (empty($config['class'])) { |
|
| 107 | - $this->logger->error('No class given for objectstore', ['app' => 'files']); |
|
| 108 | - } |
|
| 109 | - if (!isset($config['arguments'])) { |
|
| 110 | - $config['arguments'] = []; |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - /* |
|
| 40 | + /** @var ILogger */ |
|
| 41 | + private $logger; |
|
| 42 | + /** @var IConfig */ |
|
| 43 | + private $config; |
|
| 44 | + |
|
| 45 | + public function __construct(ILogger $logger, IConfig $config) { |
|
| 46 | + $this->logger = $logger; |
|
| 47 | + $this->config = $config; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * @return MountPoint[] |
|
| 52 | + * @throws \Exception |
|
| 53 | + */ |
|
| 54 | + public function getRootMounts(IStorageFactory $loader): array { |
|
| 55 | + if (!is_array($this->config->getSystemValue('objectstore_multibucket'))) { |
|
| 56 | + return []; |
|
| 57 | + } |
|
| 58 | + if ($this->config->getSystemValue('objectstore.multibucket.preview-distribution', false) !== true) { |
|
| 59 | + return []; |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + $instanceId = $this->config->getSystemValueString('instanceid', ''); |
|
| 63 | + $mountPoints = []; |
|
| 64 | + $directoryRange = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; |
|
| 65 | + $i = 0; |
|
| 66 | + foreach ($directoryRange as $parent) { |
|
| 67 | + foreach ($directoryRange as $child) { |
|
| 68 | + $mountPoints[] = new MountPoint( |
|
| 69 | + AppdataPreviewObjectStoreStorage::class, |
|
| 70 | + '/appdata_' . $instanceId . '/preview/' . $parent . '/' . $child, |
|
| 71 | + $this->getMultiBucketObjectStore($i), |
|
| 72 | + $loader, |
|
| 73 | + null, |
|
| 74 | + null, |
|
| 75 | + self::class |
|
| 76 | + ); |
|
| 77 | + $i++; |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + $rootStorageArguments = $this->getMultiBucketObjectStoreForRoot(); |
|
| 82 | + $fakeRootStorage = new ObjectStoreStorage($rootStorageArguments); |
|
| 83 | + $fakeRootStorageJail = new Jail([ |
|
| 84 | + 'storage' => $fakeRootStorage, |
|
| 85 | + 'root' => '/appdata_' . $instanceId . '/preview', |
|
| 86 | + ]); |
|
| 87 | + |
|
| 88 | + // add a fallback location to be able to fetch existing previews from the old bucket |
|
| 89 | + $mountPoints[] = new MountPoint( |
|
| 90 | + $fakeRootStorageJail, |
|
| 91 | + '/appdata_' . $instanceId . '/preview/old-multibucket', |
|
| 92 | + null, |
|
| 93 | + $loader, |
|
| 94 | + null, |
|
| 95 | + null, |
|
| 96 | + self::class |
|
| 97 | + ); |
|
| 98 | + |
|
| 99 | + return $mountPoints; |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + protected function getMultiBucketObjectStore(int $number): array { |
|
| 103 | + $config = $this->config->getSystemValue('objectstore_multibucket'); |
|
| 104 | + |
|
| 105 | + // sanity checks |
|
| 106 | + if (empty($config['class'])) { |
|
| 107 | + $this->logger->error('No class given for objectstore', ['app' => 'files']); |
|
| 108 | + } |
|
| 109 | + if (!isset($config['arguments'])) { |
|
| 110 | + $config['arguments'] = []; |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + /* |
|
| 114 | 114 | * Use any provided bucket argument as prefix |
| 115 | 115 | * and add the mapping from parent/child => bucket |
| 116 | 116 | */ |
| 117 | - if (!isset($config['arguments']['bucket'])) { |
|
| 118 | - $config['arguments']['bucket'] = ''; |
|
| 119 | - } |
|
| 117 | + if (!isset($config['arguments']['bucket'])) { |
|
| 118 | + $config['arguments']['bucket'] = ''; |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - $config['arguments']['bucket'] .= "-preview-$number"; |
|
| 121 | + $config['arguments']['bucket'] .= "-preview-$number"; |
|
| 122 | 122 | |
| 123 | - // instantiate object store implementation |
|
| 124 | - $config['arguments']['objectstore'] = new $config['class']($config['arguments']); |
|
| 123 | + // instantiate object store implementation |
|
| 124 | + $config['arguments']['objectstore'] = new $config['class']($config['arguments']); |
|
| 125 | 125 | |
| 126 | - $config['arguments']['internal-id'] = $number; |
|
| 126 | + $config['arguments']['internal-id'] = $number; |
|
| 127 | 127 | |
| 128 | - return $config['arguments']; |
|
| 129 | - } |
|
| 128 | + return $config['arguments']; |
|
| 129 | + } |
|
| 130 | 130 | |
| 131 | - protected function getMultiBucketObjectStoreForRoot(): array { |
|
| 132 | - $config = $this->config->getSystemValue('objectstore_multibucket'); |
|
| 131 | + protected function getMultiBucketObjectStoreForRoot(): array { |
|
| 132 | + $config = $this->config->getSystemValue('objectstore_multibucket'); |
|
| 133 | 133 | |
| 134 | - // sanity checks |
|
| 135 | - if (empty($config['class'])) { |
|
| 136 | - $this->logger->error('No class given for objectstore', ['app' => 'files']); |
|
| 137 | - } |
|
| 138 | - if (!isset($config['arguments'])) { |
|
| 139 | - $config['arguments'] = []; |
|
| 140 | - } |
|
| 134 | + // sanity checks |
|
| 135 | + if (empty($config['class'])) { |
|
| 136 | + $this->logger->error('No class given for objectstore', ['app' => 'files']); |
|
| 137 | + } |
|
| 138 | + if (!isset($config['arguments'])) { |
|
| 139 | + $config['arguments'] = []; |
|
| 140 | + } |
|
| 141 | 141 | |
| 142 | - /* |
|
| 142 | + /* |
|
| 143 | 143 | * Use any provided bucket argument as prefix |
| 144 | 144 | * and add the mapping from parent/child => bucket |
| 145 | 145 | */ |
| 146 | - if (!isset($config['arguments']['bucket'])) { |
|
| 147 | - $config['arguments']['bucket'] = ''; |
|
| 148 | - } |
|
| 149 | - $config['arguments']['bucket'] .= '0'; |
|
| 146 | + if (!isset($config['arguments']['bucket'])) { |
|
| 147 | + $config['arguments']['bucket'] = ''; |
|
| 148 | + } |
|
| 149 | + $config['arguments']['bucket'] .= '0'; |
|
| 150 | 150 | |
| 151 | - // instantiate object store implementation |
|
| 152 | - $config['arguments']['objectstore'] = new $config['class']($config['arguments']); |
|
| 151 | + // instantiate object store implementation |
|
| 152 | + $config['arguments']['objectstore'] = new $config['class']($config['arguments']); |
|
| 153 | 153 | |
| 154 | - return $config['arguments']; |
|
| 155 | - } |
|
| 154 | + return $config['arguments']; |
|
| 155 | + } |
|
| 156 | 156 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | foreach ($directoryRange as $child) { |
| 68 | 68 | $mountPoints[] = new MountPoint( |
| 69 | 69 | AppdataPreviewObjectStoreStorage::class, |
| 70 | - '/appdata_' . $instanceId . '/preview/' . $parent . '/' . $child, |
|
| 70 | + '/appdata_'.$instanceId.'/preview/'.$parent.'/'.$child, |
|
| 71 | 71 | $this->getMultiBucketObjectStore($i), |
| 72 | 72 | $loader, |
| 73 | 73 | null, |
@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | $fakeRootStorage = new ObjectStoreStorage($rootStorageArguments); |
| 83 | 83 | $fakeRootStorageJail = new Jail([ |
| 84 | 84 | 'storage' => $fakeRootStorage, |
| 85 | - 'root' => '/appdata_' . $instanceId . '/preview', |
|
| 85 | + 'root' => '/appdata_'.$instanceId.'/preview', |
|
| 86 | 86 | ]); |
| 87 | 87 | |
| 88 | 88 | // add a fallback location to be able to fetch existing previews from the old bucket |
| 89 | 89 | $mountPoints[] = new MountPoint( |
| 90 | 90 | $fakeRootStorageJail, |
| 91 | - '/appdata_' . $instanceId . '/preview/old-multibucket', |
|
| 91 | + '/appdata_'.$instanceId.'/preview/old-multibucket', |
|
| 92 | 92 | null, |
| 93 | 93 | $loader, |
| 94 | 94 | null, |
@@ -34,465 +34,465 @@ |
||
| 34 | 34 | * @package OC\Files\Node |
| 35 | 35 | */ |
| 36 | 36 | class LazyFolder implements \OCP\Files\Folder { |
| 37 | - /** @var \Closure */ |
|
| 38 | - private $folderClosure; |
|
| 39 | - |
|
| 40 | - /** @var LazyFolder | null */ |
|
| 41 | - protected $folder = null; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * LazyFolder constructor. |
|
| 45 | - * |
|
| 46 | - * @param \Closure $folderClosure |
|
| 47 | - */ |
|
| 48 | - public function __construct(\Closure $folderClosure) { |
|
| 49 | - $this->folderClosure = $folderClosure; |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - /** |
|
| 53 | - * Magic method to first get the real rootFolder and then |
|
| 54 | - * call $method with $args on it |
|
| 55 | - * |
|
| 56 | - * @param $method |
|
| 57 | - * @param $args |
|
| 58 | - * @return mixed |
|
| 59 | - */ |
|
| 60 | - public function __call($method, $args) { |
|
| 61 | - if ($this->folder === null) { |
|
| 62 | - $this->folder = call_user_func($this->folderClosure); |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - return call_user_func_array([$this->folder, $method], $args); |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * @inheritDoc |
|
| 70 | - */ |
|
| 71 | - public function getUser() { |
|
| 72 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - /** |
|
| 76 | - * @inheritDoc |
|
| 77 | - */ |
|
| 78 | - public function listen($scope, $method, callable $callback) { |
|
| 79 | - $this->__call(__FUNCTION__, func_get_args()); |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * @inheritDoc |
|
| 84 | - */ |
|
| 85 | - public function removeListener($scope = null, $method = null, callable $callback = null) { |
|
| 86 | - $this->__call(__FUNCTION__, func_get_args()); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * @inheritDoc |
|
| 91 | - */ |
|
| 92 | - public function emit($scope, $method, $arguments = []) { |
|
| 93 | - $this->__call(__FUNCTION__, func_get_args()); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * @inheritDoc |
|
| 98 | - */ |
|
| 99 | - public function mount($storage, $mountPoint, $arguments = []) { |
|
| 100 | - $this->__call(__FUNCTION__, func_get_args()); |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - /** |
|
| 104 | - * @inheritDoc |
|
| 105 | - */ |
|
| 106 | - public function getMount($mountPoint) { |
|
| 107 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - /** |
|
| 111 | - * @inheritDoc |
|
| 112 | - */ |
|
| 113 | - public function getMountsIn($mountPoint) { |
|
| 114 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - /** |
|
| 118 | - * @inheritDoc |
|
| 119 | - */ |
|
| 120 | - public function getMountByStorageId($storageId) { |
|
| 121 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * @inheritDoc |
|
| 126 | - */ |
|
| 127 | - public function getMountByNumericStorageId($numericId) { |
|
| 128 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - /** |
|
| 132 | - * @inheritDoc |
|
| 133 | - */ |
|
| 134 | - public function unMount($mount) { |
|
| 135 | - $this->__call(__FUNCTION__, func_get_args()); |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - /** |
|
| 139 | - * @inheritDoc |
|
| 140 | - */ |
|
| 141 | - public function get($path) { |
|
| 142 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - /** |
|
| 146 | - * @inheritDoc |
|
| 147 | - */ |
|
| 148 | - public function rename($targetPath) { |
|
| 149 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * @inheritDoc |
|
| 154 | - */ |
|
| 155 | - public function delete() { |
|
| 156 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 157 | - } |
|
| 158 | - |
|
| 159 | - /** |
|
| 160 | - * @inheritDoc |
|
| 161 | - */ |
|
| 162 | - public function copy($targetPath) { |
|
| 163 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - /** |
|
| 167 | - * @inheritDoc |
|
| 168 | - */ |
|
| 169 | - public function touch($mtime = null) { |
|
| 170 | - $this->__call(__FUNCTION__, func_get_args()); |
|
| 171 | - } |
|
| 172 | - |
|
| 173 | - /** |
|
| 174 | - * @inheritDoc |
|
| 175 | - */ |
|
| 176 | - public function getStorage() { |
|
| 177 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - /** |
|
| 181 | - * @inheritDoc |
|
| 182 | - */ |
|
| 183 | - public function getPath() { |
|
| 184 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - /** |
|
| 188 | - * @inheritDoc |
|
| 189 | - */ |
|
| 190 | - public function getInternalPath() { |
|
| 191 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - /** |
|
| 195 | - * @inheritDoc |
|
| 196 | - */ |
|
| 197 | - public function getId() { |
|
| 198 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 199 | - } |
|
| 200 | - |
|
| 201 | - /** |
|
| 202 | - * @inheritDoc |
|
| 203 | - */ |
|
| 204 | - public function stat() { |
|
| 205 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - /** |
|
| 209 | - * @inheritDoc |
|
| 210 | - */ |
|
| 211 | - public function getMTime() { |
|
| 212 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - /** |
|
| 216 | - * @inheritDoc |
|
| 217 | - */ |
|
| 218 | - public function getSize($includeMounts = true) { |
|
| 219 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - /** |
|
| 223 | - * @inheritDoc |
|
| 224 | - */ |
|
| 225 | - public function getEtag() { |
|
| 226 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 227 | - } |
|
| 228 | - |
|
| 229 | - /** |
|
| 230 | - * @inheritDoc |
|
| 231 | - */ |
|
| 232 | - public function getPermissions() { |
|
| 233 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - /** |
|
| 237 | - * @inheritDoc |
|
| 238 | - */ |
|
| 239 | - public function isReadable() { |
|
| 240 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 241 | - } |
|
| 242 | - |
|
| 243 | - /** |
|
| 244 | - * @inheritDoc |
|
| 245 | - */ |
|
| 246 | - public function isUpdateable() { |
|
| 247 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 248 | - } |
|
| 249 | - |
|
| 250 | - /** |
|
| 251 | - * @inheritDoc |
|
| 252 | - */ |
|
| 253 | - public function isDeletable() { |
|
| 254 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 255 | - } |
|
| 256 | - |
|
| 257 | - /** |
|
| 258 | - * @inheritDoc |
|
| 259 | - */ |
|
| 260 | - public function isShareable() { |
|
| 261 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 262 | - } |
|
| 263 | - |
|
| 264 | - /** |
|
| 265 | - * @inheritDoc |
|
| 266 | - */ |
|
| 267 | - public function getParent() { |
|
| 268 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 269 | - } |
|
| 270 | - |
|
| 271 | - /** |
|
| 272 | - * @inheritDoc |
|
| 273 | - */ |
|
| 274 | - public function getName() { |
|
| 275 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 276 | - } |
|
| 277 | - |
|
| 278 | - /** |
|
| 279 | - * @inheritDoc |
|
| 280 | - */ |
|
| 281 | - public function getUserFolder($userId) { |
|
| 282 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 283 | - } |
|
| 284 | - |
|
| 285 | - /** |
|
| 286 | - * @inheritDoc |
|
| 287 | - */ |
|
| 288 | - public function getMimetype() { |
|
| 289 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 290 | - } |
|
| 291 | - |
|
| 292 | - /** |
|
| 293 | - * @inheritDoc |
|
| 294 | - */ |
|
| 295 | - public function getMimePart() { |
|
| 296 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 297 | - } |
|
| 298 | - |
|
| 299 | - /** |
|
| 300 | - * @inheritDoc |
|
| 301 | - */ |
|
| 302 | - public function isEncrypted() { |
|
| 303 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 304 | - } |
|
| 305 | - |
|
| 306 | - /** |
|
| 307 | - * @inheritDoc |
|
| 308 | - */ |
|
| 309 | - public function getType() { |
|
| 310 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 311 | - } |
|
| 312 | - |
|
| 313 | - /** |
|
| 314 | - * @inheritDoc |
|
| 315 | - */ |
|
| 316 | - public function isShared() { |
|
| 317 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 318 | - } |
|
| 319 | - |
|
| 320 | - /** |
|
| 321 | - * @inheritDoc |
|
| 322 | - */ |
|
| 323 | - public function isMounted() { |
|
| 324 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 325 | - } |
|
| 326 | - |
|
| 327 | - /** |
|
| 328 | - * @inheritDoc |
|
| 329 | - */ |
|
| 330 | - public function getMountPoint() { |
|
| 331 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 332 | - } |
|
| 333 | - |
|
| 334 | - /** |
|
| 335 | - * @inheritDoc |
|
| 336 | - */ |
|
| 337 | - public function getOwner() { |
|
| 338 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 339 | - } |
|
| 340 | - |
|
| 341 | - /** |
|
| 342 | - * @inheritDoc |
|
| 343 | - */ |
|
| 344 | - public function getChecksum() { |
|
| 345 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 346 | - } |
|
| 347 | - |
|
| 348 | - public function getExtension(): string { |
|
| 349 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 350 | - } |
|
| 351 | - |
|
| 352 | - /** |
|
| 353 | - * @inheritDoc |
|
| 354 | - */ |
|
| 355 | - public function getFullPath($path) { |
|
| 356 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 357 | - } |
|
| 358 | - |
|
| 359 | - /** |
|
| 360 | - * @inheritDoc |
|
| 361 | - */ |
|
| 362 | - public function getRelativePath($path) { |
|
| 363 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 364 | - } |
|
| 365 | - |
|
| 366 | - /** |
|
| 367 | - * @inheritDoc |
|
| 368 | - */ |
|
| 369 | - public function isSubNode($node) { |
|
| 370 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 371 | - } |
|
| 372 | - |
|
| 373 | - /** |
|
| 374 | - * @inheritDoc |
|
| 375 | - */ |
|
| 376 | - public function getDirectoryListing() { |
|
| 377 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 378 | - } |
|
| 379 | - |
|
| 380 | - /** |
|
| 381 | - * @inheritDoc |
|
| 382 | - */ |
|
| 383 | - public function nodeExists($path) { |
|
| 384 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 385 | - } |
|
| 386 | - |
|
| 387 | - /** |
|
| 388 | - * @inheritDoc |
|
| 389 | - */ |
|
| 390 | - public function newFolder($path) { |
|
| 391 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 392 | - } |
|
| 393 | - |
|
| 394 | - /** |
|
| 395 | - * @inheritDoc |
|
| 396 | - */ |
|
| 397 | - public function newFile($path, $content = null) { |
|
| 398 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 399 | - } |
|
| 400 | - |
|
| 401 | - /** |
|
| 402 | - * @inheritDoc |
|
| 403 | - */ |
|
| 404 | - public function search($query) { |
|
| 405 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 406 | - } |
|
| 407 | - |
|
| 408 | - /** |
|
| 409 | - * @inheritDoc |
|
| 410 | - */ |
|
| 411 | - public function searchByMime($mimetype) { |
|
| 412 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 413 | - } |
|
| 414 | - |
|
| 415 | - /** |
|
| 416 | - * @inheritDoc |
|
| 417 | - */ |
|
| 418 | - public function searchByTag($tag, $userId) { |
|
| 419 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 420 | - } |
|
| 421 | - |
|
| 422 | - /** |
|
| 423 | - * @inheritDoc |
|
| 424 | - */ |
|
| 425 | - public function getById($id) { |
|
| 426 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 427 | - } |
|
| 428 | - |
|
| 429 | - /** |
|
| 430 | - * @inheritDoc |
|
| 431 | - */ |
|
| 432 | - public function getFreeSpace() { |
|
| 433 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 434 | - } |
|
| 435 | - |
|
| 436 | - /** |
|
| 437 | - * @inheritDoc |
|
| 438 | - */ |
|
| 439 | - public function isCreatable() { |
|
| 440 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 441 | - } |
|
| 442 | - |
|
| 443 | - /** |
|
| 444 | - * @inheritDoc |
|
| 445 | - */ |
|
| 446 | - public function getNonExistingName($name) { |
|
| 447 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 448 | - } |
|
| 449 | - |
|
| 450 | - /** |
|
| 451 | - * @inheritDoc |
|
| 452 | - */ |
|
| 453 | - public function move($targetPath) { |
|
| 454 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 455 | - } |
|
| 456 | - |
|
| 457 | - /** |
|
| 458 | - * @inheritDoc |
|
| 459 | - */ |
|
| 460 | - public function lock($type) { |
|
| 461 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 462 | - } |
|
| 463 | - |
|
| 464 | - /** |
|
| 465 | - * @inheritDoc |
|
| 466 | - */ |
|
| 467 | - public function changeLock($targetType) { |
|
| 468 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 469 | - } |
|
| 470 | - |
|
| 471 | - /** |
|
| 472 | - * @inheritDoc |
|
| 473 | - */ |
|
| 474 | - public function unlock($type) { |
|
| 475 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 476 | - } |
|
| 477 | - |
|
| 478 | - /** |
|
| 479 | - * @inheritDoc |
|
| 480 | - */ |
|
| 481 | - public function getRecent($limit, $offset = 0) { |
|
| 482 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 483 | - } |
|
| 484 | - |
|
| 485 | - /** |
|
| 486 | - * @inheritDoc |
|
| 487 | - */ |
|
| 488 | - public function getCreationTime(): int { |
|
| 489 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 490 | - } |
|
| 491 | - |
|
| 492 | - /** |
|
| 493 | - * @inheritDoc |
|
| 494 | - */ |
|
| 495 | - public function getUploadTime(): int { |
|
| 496 | - return $this->__call(__FUNCTION__, func_get_args()); |
|
| 497 | - } |
|
| 37 | + /** @var \Closure */ |
|
| 38 | + private $folderClosure; |
|
| 39 | + |
|
| 40 | + /** @var LazyFolder | null */ |
|
| 41 | + protected $folder = null; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * LazyFolder constructor. |
|
| 45 | + * |
|
| 46 | + * @param \Closure $folderClosure |
|
| 47 | + */ |
|
| 48 | + public function __construct(\Closure $folderClosure) { |
|
| 49 | + $this->folderClosure = $folderClosure; |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + /** |
|
| 53 | + * Magic method to first get the real rootFolder and then |
|
| 54 | + * call $method with $args on it |
|
| 55 | + * |
|
| 56 | + * @param $method |
|
| 57 | + * @param $args |
|
| 58 | + * @return mixed |
|
| 59 | + */ |
|
| 60 | + public function __call($method, $args) { |
|
| 61 | + if ($this->folder === null) { |
|
| 62 | + $this->folder = call_user_func($this->folderClosure); |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + return call_user_func_array([$this->folder, $method], $args); |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * @inheritDoc |
|
| 70 | + */ |
|
| 71 | + public function getUser() { |
|
| 72 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + /** |
|
| 76 | + * @inheritDoc |
|
| 77 | + */ |
|
| 78 | + public function listen($scope, $method, callable $callback) { |
|
| 79 | + $this->__call(__FUNCTION__, func_get_args()); |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * @inheritDoc |
|
| 84 | + */ |
|
| 85 | + public function removeListener($scope = null, $method = null, callable $callback = null) { |
|
| 86 | + $this->__call(__FUNCTION__, func_get_args()); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * @inheritDoc |
|
| 91 | + */ |
|
| 92 | + public function emit($scope, $method, $arguments = []) { |
|
| 93 | + $this->__call(__FUNCTION__, func_get_args()); |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * @inheritDoc |
|
| 98 | + */ |
|
| 99 | + public function mount($storage, $mountPoint, $arguments = []) { |
|
| 100 | + $this->__call(__FUNCTION__, func_get_args()); |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + /** |
|
| 104 | + * @inheritDoc |
|
| 105 | + */ |
|
| 106 | + public function getMount($mountPoint) { |
|
| 107 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + /** |
|
| 111 | + * @inheritDoc |
|
| 112 | + */ |
|
| 113 | + public function getMountsIn($mountPoint) { |
|
| 114 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + /** |
|
| 118 | + * @inheritDoc |
|
| 119 | + */ |
|
| 120 | + public function getMountByStorageId($storageId) { |
|
| 121 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * @inheritDoc |
|
| 126 | + */ |
|
| 127 | + public function getMountByNumericStorageId($numericId) { |
|
| 128 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + /** |
|
| 132 | + * @inheritDoc |
|
| 133 | + */ |
|
| 134 | + public function unMount($mount) { |
|
| 135 | + $this->__call(__FUNCTION__, func_get_args()); |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + /** |
|
| 139 | + * @inheritDoc |
|
| 140 | + */ |
|
| 141 | + public function get($path) { |
|
| 142 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + /** |
|
| 146 | + * @inheritDoc |
|
| 147 | + */ |
|
| 148 | + public function rename($targetPath) { |
|
| 149 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * @inheritDoc |
|
| 154 | + */ |
|
| 155 | + public function delete() { |
|
| 156 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 157 | + } |
|
| 158 | + |
|
| 159 | + /** |
|
| 160 | + * @inheritDoc |
|
| 161 | + */ |
|
| 162 | + public function copy($targetPath) { |
|
| 163 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + /** |
|
| 167 | + * @inheritDoc |
|
| 168 | + */ |
|
| 169 | + public function touch($mtime = null) { |
|
| 170 | + $this->__call(__FUNCTION__, func_get_args()); |
|
| 171 | + } |
|
| 172 | + |
|
| 173 | + /** |
|
| 174 | + * @inheritDoc |
|
| 175 | + */ |
|
| 176 | + public function getStorage() { |
|
| 177 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + /** |
|
| 181 | + * @inheritDoc |
|
| 182 | + */ |
|
| 183 | + public function getPath() { |
|
| 184 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + /** |
|
| 188 | + * @inheritDoc |
|
| 189 | + */ |
|
| 190 | + public function getInternalPath() { |
|
| 191 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + /** |
|
| 195 | + * @inheritDoc |
|
| 196 | + */ |
|
| 197 | + public function getId() { |
|
| 198 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 199 | + } |
|
| 200 | + |
|
| 201 | + /** |
|
| 202 | + * @inheritDoc |
|
| 203 | + */ |
|
| 204 | + public function stat() { |
|
| 205 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + /** |
|
| 209 | + * @inheritDoc |
|
| 210 | + */ |
|
| 211 | + public function getMTime() { |
|
| 212 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + /** |
|
| 216 | + * @inheritDoc |
|
| 217 | + */ |
|
| 218 | + public function getSize($includeMounts = true) { |
|
| 219 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + /** |
|
| 223 | + * @inheritDoc |
|
| 224 | + */ |
|
| 225 | + public function getEtag() { |
|
| 226 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 227 | + } |
|
| 228 | + |
|
| 229 | + /** |
|
| 230 | + * @inheritDoc |
|
| 231 | + */ |
|
| 232 | + public function getPermissions() { |
|
| 233 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + /** |
|
| 237 | + * @inheritDoc |
|
| 238 | + */ |
|
| 239 | + public function isReadable() { |
|
| 240 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 241 | + } |
|
| 242 | + |
|
| 243 | + /** |
|
| 244 | + * @inheritDoc |
|
| 245 | + */ |
|
| 246 | + public function isUpdateable() { |
|
| 247 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 248 | + } |
|
| 249 | + |
|
| 250 | + /** |
|
| 251 | + * @inheritDoc |
|
| 252 | + */ |
|
| 253 | + public function isDeletable() { |
|
| 254 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 255 | + } |
|
| 256 | + |
|
| 257 | + /** |
|
| 258 | + * @inheritDoc |
|
| 259 | + */ |
|
| 260 | + public function isShareable() { |
|
| 261 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 262 | + } |
|
| 263 | + |
|
| 264 | + /** |
|
| 265 | + * @inheritDoc |
|
| 266 | + */ |
|
| 267 | + public function getParent() { |
|
| 268 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 269 | + } |
|
| 270 | + |
|
| 271 | + /** |
|
| 272 | + * @inheritDoc |
|
| 273 | + */ |
|
| 274 | + public function getName() { |
|
| 275 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 276 | + } |
|
| 277 | + |
|
| 278 | + /** |
|
| 279 | + * @inheritDoc |
|
| 280 | + */ |
|
| 281 | + public function getUserFolder($userId) { |
|
| 282 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 283 | + } |
|
| 284 | + |
|
| 285 | + /** |
|
| 286 | + * @inheritDoc |
|
| 287 | + */ |
|
| 288 | + public function getMimetype() { |
|
| 289 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 290 | + } |
|
| 291 | + |
|
| 292 | + /** |
|
| 293 | + * @inheritDoc |
|
| 294 | + */ |
|
| 295 | + public function getMimePart() { |
|
| 296 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 297 | + } |
|
| 298 | + |
|
| 299 | + /** |
|
| 300 | + * @inheritDoc |
|
| 301 | + */ |
|
| 302 | + public function isEncrypted() { |
|
| 303 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 304 | + } |
|
| 305 | + |
|
| 306 | + /** |
|
| 307 | + * @inheritDoc |
|
| 308 | + */ |
|
| 309 | + public function getType() { |
|
| 310 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 311 | + } |
|
| 312 | + |
|
| 313 | + /** |
|
| 314 | + * @inheritDoc |
|
| 315 | + */ |
|
| 316 | + public function isShared() { |
|
| 317 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 318 | + } |
|
| 319 | + |
|
| 320 | + /** |
|
| 321 | + * @inheritDoc |
|
| 322 | + */ |
|
| 323 | + public function isMounted() { |
|
| 324 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 325 | + } |
|
| 326 | + |
|
| 327 | + /** |
|
| 328 | + * @inheritDoc |
|
| 329 | + */ |
|
| 330 | + public function getMountPoint() { |
|
| 331 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 332 | + } |
|
| 333 | + |
|
| 334 | + /** |
|
| 335 | + * @inheritDoc |
|
| 336 | + */ |
|
| 337 | + public function getOwner() { |
|
| 338 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 339 | + } |
|
| 340 | + |
|
| 341 | + /** |
|
| 342 | + * @inheritDoc |
|
| 343 | + */ |
|
| 344 | + public function getChecksum() { |
|
| 345 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 346 | + } |
|
| 347 | + |
|
| 348 | + public function getExtension(): string { |
|
| 349 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 350 | + } |
|
| 351 | + |
|
| 352 | + /** |
|
| 353 | + * @inheritDoc |
|
| 354 | + */ |
|
| 355 | + public function getFullPath($path) { |
|
| 356 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 357 | + } |
|
| 358 | + |
|
| 359 | + /** |
|
| 360 | + * @inheritDoc |
|
| 361 | + */ |
|
| 362 | + public function getRelativePath($path) { |
|
| 363 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 364 | + } |
|
| 365 | + |
|
| 366 | + /** |
|
| 367 | + * @inheritDoc |
|
| 368 | + */ |
|
| 369 | + public function isSubNode($node) { |
|
| 370 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 371 | + } |
|
| 372 | + |
|
| 373 | + /** |
|
| 374 | + * @inheritDoc |
|
| 375 | + */ |
|
| 376 | + public function getDirectoryListing() { |
|
| 377 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 378 | + } |
|
| 379 | + |
|
| 380 | + /** |
|
| 381 | + * @inheritDoc |
|
| 382 | + */ |
|
| 383 | + public function nodeExists($path) { |
|
| 384 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 385 | + } |
|
| 386 | + |
|
| 387 | + /** |
|
| 388 | + * @inheritDoc |
|
| 389 | + */ |
|
| 390 | + public function newFolder($path) { |
|
| 391 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 392 | + } |
|
| 393 | + |
|
| 394 | + /** |
|
| 395 | + * @inheritDoc |
|
| 396 | + */ |
|
| 397 | + public function newFile($path, $content = null) { |
|
| 398 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 399 | + } |
|
| 400 | + |
|
| 401 | + /** |
|
| 402 | + * @inheritDoc |
|
| 403 | + */ |
|
| 404 | + public function search($query) { |
|
| 405 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 406 | + } |
|
| 407 | + |
|
| 408 | + /** |
|
| 409 | + * @inheritDoc |
|
| 410 | + */ |
|
| 411 | + public function searchByMime($mimetype) { |
|
| 412 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 413 | + } |
|
| 414 | + |
|
| 415 | + /** |
|
| 416 | + * @inheritDoc |
|
| 417 | + */ |
|
| 418 | + public function searchByTag($tag, $userId) { |
|
| 419 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 420 | + } |
|
| 421 | + |
|
| 422 | + /** |
|
| 423 | + * @inheritDoc |
|
| 424 | + */ |
|
| 425 | + public function getById($id) { |
|
| 426 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 427 | + } |
|
| 428 | + |
|
| 429 | + /** |
|
| 430 | + * @inheritDoc |
|
| 431 | + */ |
|
| 432 | + public function getFreeSpace() { |
|
| 433 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 434 | + } |
|
| 435 | + |
|
| 436 | + /** |
|
| 437 | + * @inheritDoc |
|
| 438 | + */ |
|
| 439 | + public function isCreatable() { |
|
| 440 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 441 | + } |
|
| 442 | + |
|
| 443 | + /** |
|
| 444 | + * @inheritDoc |
|
| 445 | + */ |
|
| 446 | + public function getNonExistingName($name) { |
|
| 447 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 448 | + } |
|
| 449 | + |
|
| 450 | + /** |
|
| 451 | + * @inheritDoc |
|
| 452 | + */ |
|
| 453 | + public function move($targetPath) { |
|
| 454 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 455 | + } |
|
| 456 | + |
|
| 457 | + /** |
|
| 458 | + * @inheritDoc |
|
| 459 | + */ |
|
| 460 | + public function lock($type) { |
|
| 461 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 462 | + } |
|
| 463 | + |
|
| 464 | + /** |
|
| 465 | + * @inheritDoc |
|
| 466 | + */ |
|
| 467 | + public function changeLock($targetType) { |
|
| 468 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 469 | + } |
|
| 470 | + |
|
| 471 | + /** |
|
| 472 | + * @inheritDoc |
|
| 473 | + */ |
|
| 474 | + public function unlock($type) { |
|
| 475 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 476 | + } |
|
| 477 | + |
|
| 478 | + /** |
|
| 479 | + * @inheritDoc |
|
| 480 | + */ |
|
| 481 | + public function getRecent($limit, $offset = 0) { |
|
| 482 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 483 | + } |
|
| 484 | + |
|
| 485 | + /** |
|
| 486 | + * @inheritDoc |
|
| 487 | + */ |
|
| 488 | + public function getCreationTime(): int { |
|
| 489 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 490 | + } |
|
| 491 | + |
|
| 492 | + /** |
|
| 493 | + * @inheritDoc |
|
| 494 | + */ |
|
| 495 | + public function getUploadTime(): int { |
|
| 496 | + return $this->__call(__FUNCTION__, func_get_args()); |
|
| 497 | + } |
|
| 498 | 498 | } |
@@ -64,340 +64,340 @@ |
||
| 64 | 64 | * @package OC\Files\Node |
| 65 | 65 | */ |
| 66 | 66 | class Root extends Folder implements IRootFolder { |
| 67 | - /** @var Manager */ |
|
| 68 | - private $mountManager; |
|
| 69 | - /** @var PublicEmitter */ |
|
| 70 | - private $emitter; |
|
| 71 | - /** @var null|\OC\User\User */ |
|
| 72 | - private $user; |
|
| 73 | - /** @var CappedMemoryCache */ |
|
| 74 | - private $userFolderCache; |
|
| 75 | - /** @var IUserMountCache */ |
|
| 76 | - private $userMountCache; |
|
| 77 | - /** @var ILogger */ |
|
| 78 | - private $logger; |
|
| 79 | - /** @var IUserManager */ |
|
| 80 | - private $userManager; |
|
| 81 | - |
|
| 82 | - /** |
|
| 83 | - * @param \OC\Files\Mount\Manager $manager |
|
| 84 | - * @param \OC\Files\View $view |
|
| 85 | - * @param \OC\User\User|null $user |
|
| 86 | - * @param IUserMountCache $userMountCache |
|
| 87 | - * @param ILogger $logger |
|
| 88 | - * @param IUserManager $userManager |
|
| 89 | - */ |
|
| 90 | - public function __construct($manager, |
|
| 91 | - $view, |
|
| 92 | - $user, |
|
| 93 | - IUserMountCache $userMountCache, |
|
| 94 | - ILogger $logger, |
|
| 95 | - IUserManager $userManager) { |
|
| 96 | - parent::__construct($this, $view, ''); |
|
| 97 | - $this->mountManager = $manager; |
|
| 98 | - $this->user = $user; |
|
| 99 | - $this->emitter = new PublicEmitter(); |
|
| 100 | - $this->userFolderCache = new CappedMemoryCache(); |
|
| 101 | - $this->userMountCache = $userMountCache; |
|
| 102 | - $this->logger = $logger; |
|
| 103 | - $this->userManager = $userManager; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * Get the user for which the filesystem is setup |
|
| 108 | - * |
|
| 109 | - * @return \OC\User\User |
|
| 110 | - */ |
|
| 111 | - public function getUser() { |
|
| 112 | - return $this->user; |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - /** |
|
| 116 | - * @param string $scope |
|
| 117 | - * @param string $method |
|
| 118 | - * @param callable $callback |
|
| 119 | - */ |
|
| 120 | - public function listen($scope, $method, callable $callback) { |
|
| 121 | - $this->emitter->listen($scope, $method, $callback); |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - /** |
|
| 125 | - * @param string $scope optional |
|
| 126 | - * @param string $method optional |
|
| 127 | - * @param callable $callback optional |
|
| 128 | - */ |
|
| 129 | - public function removeListener($scope = null, $method = null, callable $callback = null) { |
|
| 130 | - $this->emitter->removeListener($scope, $method, $callback); |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - /** |
|
| 134 | - * @param string $scope |
|
| 135 | - * @param string $method |
|
| 136 | - * @param Node[] $arguments |
|
| 137 | - */ |
|
| 138 | - public function emit($scope, $method, $arguments = []) { |
|
| 139 | - $this->emitter->emit($scope, $method, $arguments); |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * @param \OC\Files\Storage\Storage $storage |
|
| 144 | - * @param string $mountPoint |
|
| 145 | - * @param array $arguments |
|
| 146 | - */ |
|
| 147 | - public function mount($storage, $mountPoint, $arguments = []) { |
|
| 148 | - $mount = new MountPoint($storage, $mountPoint, $arguments); |
|
| 149 | - $this->mountManager->addMount($mount); |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * @param string $mountPoint |
|
| 154 | - * @return \OC\Files\Mount\MountPoint |
|
| 155 | - */ |
|
| 156 | - public function getMount($mountPoint) { |
|
| 157 | - return $this->mountManager->find($mountPoint); |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - /** |
|
| 161 | - * @param string $mountPoint |
|
| 162 | - * @return \OC\Files\Mount\MountPoint[] |
|
| 163 | - */ |
|
| 164 | - public function getMountsIn($mountPoint) { |
|
| 165 | - return $this->mountManager->findIn($mountPoint); |
|
| 166 | - } |
|
| 167 | - |
|
| 168 | - /** |
|
| 169 | - * @param string $storageId |
|
| 170 | - * @return \OC\Files\Mount\MountPoint[] |
|
| 171 | - */ |
|
| 172 | - public function getMountByStorageId($storageId) { |
|
| 173 | - return $this->mountManager->findByStorageId($storageId); |
|
| 174 | - } |
|
| 175 | - |
|
| 176 | - /** |
|
| 177 | - * @param int $numericId |
|
| 178 | - * @return MountPoint[] |
|
| 179 | - */ |
|
| 180 | - public function getMountByNumericStorageId($numericId) { |
|
| 181 | - return $this->mountManager->findByNumericId($numericId); |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - /** |
|
| 185 | - * @param \OC\Files\Mount\MountPoint $mount |
|
| 186 | - */ |
|
| 187 | - public function unMount($mount) { |
|
| 188 | - $this->mountManager->remove($mount); |
|
| 189 | - } |
|
| 190 | - |
|
| 191 | - /** |
|
| 192 | - * @param string $path |
|
| 193 | - * @return Node |
|
| 194 | - * @throws \OCP\Files\NotPermittedException |
|
| 195 | - * @throws \OCP\Files\NotFoundException |
|
| 196 | - */ |
|
| 197 | - public function get($path) { |
|
| 198 | - $path = $this->normalizePath($path); |
|
| 199 | - if ($this->isValidPath($path)) { |
|
| 200 | - $fullPath = $this->getFullPath($path); |
|
| 201 | - $fileInfo = $this->view->getFileInfo($fullPath); |
|
| 202 | - if ($fileInfo) { |
|
| 203 | - return $this->createNode($fullPath, $fileInfo); |
|
| 204 | - } else { |
|
| 205 | - throw new NotFoundException($path); |
|
| 206 | - } |
|
| 207 | - } else { |
|
| 208 | - throw new NotPermittedException(); |
|
| 209 | - } |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - //most operations can't be done on the root |
|
| 213 | - |
|
| 214 | - /** |
|
| 215 | - * @param string $targetPath |
|
| 216 | - * @return \OC\Files\Node\Node |
|
| 217 | - * @throws \OCP\Files\NotPermittedException |
|
| 218 | - */ |
|
| 219 | - public function rename($targetPath) { |
|
| 220 | - throw new NotPermittedException(); |
|
| 221 | - } |
|
| 222 | - |
|
| 223 | - public function delete() { |
|
| 224 | - throw new NotPermittedException(); |
|
| 225 | - } |
|
| 226 | - |
|
| 227 | - /** |
|
| 228 | - * @param string $targetPath |
|
| 229 | - * @return \OC\Files\Node\Node |
|
| 230 | - * @throws \OCP\Files\NotPermittedException |
|
| 231 | - */ |
|
| 232 | - public function copy($targetPath) { |
|
| 233 | - throw new NotPermittedException(); |
|
| 234 | - } |
|
| 235 | - |
|
| 236 | - /** |
|
| 237 | - * @param int $mtime |
|
| 238 | - * @throws \OCP\Files\NotPermittedException |
|
| 239 | - */ |
|
| 240 | - public function touch($mtime = null) { |
|
| 241 | - throw new NotPermittedException(); |
|
| 242 | - } |
|
| 243 | - |
|
| 244 | - /** |
|
| 245 | - * @return \OC\Files\Storage\Storage |
|
| 246 | - * @throws \OCP\Files\NotFoundException |
|
| 247 | - */ |
|
| 248 | - public function getStorage() { |
|
| 249 | - throw new NotFoundException(); |
|
| 250 | - } |
|
| 251 | - |
|
| 252 | - /** |
|
| 253 | - * @return string |
|
| 254 | - */ |
|
| 255 | - public function getPath() { |
|
| 256 | - return '/'; |
|
| 257 | - } |
|
| 258 | - |
|
| 259 | - /** |
|
| 260 | - * @return string |
|
| 261 | - */ |
|
| 262 | - public function getInternalPath() { |
|
| 263 | - return ''; |
|
| 264 | - } |
|
| 265 | - |
|
| 266 | - /** |
|
| 267 | - * @return int |
|
| 268 | - */ |
|
| 269 | - public function getId() { |
|
| 270 | - return null; |
|
| 271 | - } |
|
| 272 | - |
|
| 273 | - /** |
|
| 274 | - * @return array |
|
| 275 | - */ |
|
| 276 | - public function stat() { |
|
| 277 | - return null; |
|
| 278 | - } |
|
| 279 | - |
|
| 280 | - /** |
|
| 281 | - * @return int |
|
| 282 | - */ |
|
| 283 | - public function getMTime() { |
|
| 284 | - return null; |
|
| 285 | - } |
|
| 286 | - |
|
| 287 | - /** |
|
| 288 | - * @param bool $includeMounts |
|
| 289 | - * @return int |
|
| 290 | - */ |
|
| 291 | - public function getSize($includeMounts = true) { |
|
| 292 | - return null; |
|
| 293 | - } |
|
| 294 | - |
|
| 295 | - /** |
|
| 296 | - * @return string |
|
| 297 | - */ |
|
| 298 | - public function getEtag() { |
|
| 299 | - return null; |
|
| 300 | - } |
|
| 301 | - |
|
| 302 | - /** |
|
| 303 | - * @return int |
|
| 304 | - */ |
|
| 305 | - public function getPermissions() { |
|
| 306 | - return \OCP\Constants::PERMISSION_CREATE; |
|
| 307 | - } |
|
| 308 | - |
|
| 309 | - /** |
|
| 310 | - * @return bool |
|
| 311 | - */ |
|
| 312 | - public function isReadable() { |
|
| 313 | - return false; |
|
| 314 | - } |
|
| 315 | - |
|
| 316 | - /** |
|
| 317 | - * @return bool |
|
| 318 | - */ |
|
| 319 | - public function isUpdateable() { |
|
| 320 | - return false; |
|
| 321 | - } |
|
| 322 | - |
|
| 323 | - /** |
|
| 324 | - * @return bool |
|
| 325 | - */ |
|
| 326 | - public function isDeletable() { |
|
| 327 | - return false; |
|
| 328 | - } |
|
| 329 | - |
|
| 330 | - /** |
|
| 331 | - * @return bool |
|
| 332 | - */ |
|
| 333 | - public function isShareable() { |
|
| 334 | - return false; |
|
| 335 | - } |
|
| 336 | - |
|
| 337 | - /** |
|
| 338 | - * @return Node |
|
| 339 | - * @throws \OCP\Files\NotFoundException |
|
| 340 | - */ |
|
| 341 | - public function getParent() { |
|
| 342 | - throw new NotFoundException(); |
|
| 343 | - } |
|
| 344 | - |
|
| 345 | - /** |
|
| 346 | - * @return string |
|
| 347 | - */ |
|
| 348 | - public function getName() { |
|
| 349 | - return ''; |
|
| 350 | - } |
|
| 351 | - |
|
| 352 | - /** |
|
| 353 | - * Returns a view to user's files folder |
|
| 354 | - * |
|
| 355 | - * @param string $userId user ID |
|
| 356 | - * @return \OCP\Files\Folder |
|
| 357 | - * @throws NoUserException |
|
| 358 | - * @throws NotPermittedException |
|
| 359 | - */ |
|
| 360 | - public function getUserFolder($userId) { |
|
| 361 | - $userObject = $this->userManager->get($userId); |
|
| 362 | - |
|
| 363 | - if (is_null($userObject)) { |
|
| 364 | - $this->logger->error( |
|
| 365 | - sprintf( |
|
| 366 | - 'Backends provided no user object for %s', |
|
| 367 | - $userId |
|
| 368 | - ), |
|
| 369 | - [ |
|
| 370 | - 'app' => 'files', |
|
| 371 | - ] |
|
| 372 | - ); |
|
| 373 | - throw new NoUserException('Backends provided no user object'); |
|
| 374 | - } |
|
| 375 | - |
|
| 376 | - $userId = $userObject->getUID(); |
|
| 377 | - |
|
| 378 | - if (!$this->userFolderCache->hasKey($userId)) { |
|
| 379 | - \OC\Files\Filesystem::initMountPoints($userId); |
|
| 380 | - |
|
| 381 | - try { |
|
| 382 | - $folder = $this->get('/' . $userId . '/files'); |
|
| 383 | - } catch (NotFoundException $e) { |
|
| 384 | - if (!$this->nodeExists('/' . $userId)) { |
|
| 385 | - $this->newFolder('/' . $userId); |
|
| 386 | - } |
|
| 387 | - $folder = $this->newFolder('/' . $userId . '/files'); |
|
| 388 | - } |
|
| 389 | - |
|
| 390 | - $this->userFolderCache->set($userId, $folder); |
|
| 391 | - } |
|
| 392 | - |
|
| 393 | - return $this->userFolderCache->get($userId); |
|
| 394 | - } |
|
| 395 | - |
|
| 396 | - public function clearCache() { |
|
| 397 | - $this->userFolderCache = new CappedMemoryCache(); |
|
| 398 | - } |
|
| 399 | - |
|
| 400 | - public function getUserMountCache() { |
|
| 401 | - return $this->userMountCache; |
|
| 402 | - } |
|
| 67 | + /** @var Manager */ |
|
| 68 | + private $mountManager; |
|
| 69 | + /** @var PublicEmitter */ |
|
| 70 | + private $emitter; |
|
| 71 | + /** @var null|\OC\User\User */ |
|
| 72 | + private $user; |
|
| 73 | + /** @var CappedMemoryCache */ |
|
| 74 | + private $userFolderCache; |
|
| 75 | + /** @var IUserMountCache */ |
|
| 76 | + private $userMountCache; |
|
| 77 | + /** @var ILogger */ |
|
| 78 | + private $logger; |
|
| 79 | + /** @var IUserManager */ |
|
| 80 | + private $userManager; |
|
| 81 | + |
|
| 82 | + /** |
|
| 83 | + * @param \OC\Files\Mount\Manager $manager |
|
| 84 | + * @param \OC\Files\View $view |
|
| 85 | + * @param \OC\User\User|null $user |
|
| 86 | + * @param IUserMountCache $userMountCache |
|
| 87 | + * @param ILogger $logger |
|
| 88 | + * @param IUserManager $userManager |
|
| 89 | + */ |
|
| 90 | + public function __construct($manager, |
|
| 91 | + $view, |
|
| 92 | + $user, |
|
| 93 | + IUserMountCache $userMountCache, |
|
| 94 | + ILogger $logger, |
|
| 95 | + IUserManager $userManager) { |
|
| 96 | + parent::__construct($this, $view, ''); |
|
| 97 | + $this->mountManager = $manager; |
|
| 98 | + $this->user = $user; |
|
| 99 | + $this->emitter = new PublicEmitter(); |
|
| 100 | + $this->userFolderCache = new CappedMemoryCache(); |
|
| 101 | + $this->userMountCache = $userMountCache; |
|
| 102 | + $this->logger = $logger; |
|
| 103 | + $this->userManager = $userManager; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * Get the user for which the filesystem is setup |
|
| 108 | + * |
|
| 109 | + * @return \OC\User\User |
|
| 110 | + */ |
|
| 111 | + public function getUser() { |
|
| 112 | + return $this->user; |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + /** |
|
| 116 | + * @param string $scope |
|
| 117 | + * @param string $method |
|
| 118 | + * @param callable $callback |
|
| 119 | + */ |
|
| 120 | + public function listen($scope, $method, callable $callback) { |
|
| 121 | + $this->emitter->listen($scope, $method, $callback); |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * @param string $scope optional |
|
| 126 | + * @param string $method optional |
|
| 127 | + * @param callable $callback optional |
|
| 128 | + */ |
|
| 129 | + public function removeListener($scope = null, $method = null, callable $callback = null) { |
|
| 130 | + $this->emitter->removeListener($scope, $method, $callback); |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + /** |
|
| 134 | + * @param string $scope |
|
| 135 | + * @param string $method |
|
| 136 | + * @param Node[] $arguments |
|
| 137 | + */ |
|
| 138 | + public function emit($scope, $method, $arguments = []) { |
|
| 139 | + $this->emitter->emit($scope, $method, $arguments); |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * @param \OC\Files\Storage\Storage $storage |
|
| 144 | + * @param string $mountPoint |
|
| 145 | + * @param array $arguments |
|
| 146 | + */ |
|
| 147 | + public function mount($storage, $mountPoint, $arguments = []) { |
|
| 148 | + $mount = new MountPoint($storage, $mountPoint, $arguments); |
|
| 149 | + $this->mountManager->addMount($mount); |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * @param string $mountPoint |
|
| 154 | + * @return \OC\Files\Mount\MountPoint |
|
| 155 | + */ |
|
| 156 | + public function getMount($mountPoint) { |
|
| 157 | + return $this->mountManager->find($mountPoint); |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + /** |
|
| 161 | + * @param string $mountPoint |
|
| 162 | + * @return \OC\Files\Mount\MountPoint[] |
|
| 163 | + */ |
|
| 164 | + public function getMountsIn($mountPoint) { |
|
| 165 | + return $this->mountManager->findIn($mountPoint); |
|
| 166 | + } |
|
| 167 | + |
|
| 168 | + /** |
|
| 169 | + * @param string $storageId |
|
| 170 | + * @return \OC\Files\Mount\MountPoint[] |
|
| 171 | + */ |
|
| 172 | + public function getMountByStorageId($storageId) { |
|
| 173 | + return $this->mountManager->findByStorageId($storageId); |
|
| 174 | + } |
|
| 175 | + |
|
| 176 | + /** |
|
| 177 | + * @param int $numericId |
|
| 178 | + * @return MountPoint[] |
|
| 179 | + */ |
|
| 180 | + public function getMountByNumericStorageId($numericId) { |
|
| 181 | + return $this->mountManager->findByNumericId($numericId); |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + /** |
|
| 185 | + * @param \OC\Files\Mount\MountPoint $mount |
|
| 186 | + */ |
|
| 187 | + public function unMount($mount) { |
|
| 188 | + $this->mountManager->remove($mount); |
|
| 189 | + } |
|
| 190 | + |
|
| 191 | + /** |
|
| 192 | + * @param string $path |
|
| 193 | + * @return Node |
|
| 194 | + * @throws \OCP\Files\NotPermittedException |
|
| 195 | + * @throws \OCP\Files\NotFoundException |
|
| 196 | + */ |
|
| 197 | + public function get($path) { |
|
| 198 | + $path = $this->normalizePath($path); |
|
| 199 | + if ($this->isValidPath($path)) { |
|
| 200 | + $fullPath = $this->getFullPath($path); |
|
| 201 | + $fileInfo = $this->view->getFileInfo($fullPath); |
|
| 202 | + if ($fileInfo) { |
|
| 203 | + return $this->createNode($fullPath, $fileInfo); |
|
| 204 | + } else { |
|
| 205 | + throw new NotFoundException($path); |
|
| 206 | + } |
|
| 207 | + } else { |
|
| 208 | + throw new NotPermittedException(); |
|
| 209 | + } |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + //most operations can't be done on the root |
|
| 213 | + |
|
| 214 | + /** |
|
| 215 | + * @param string $targetPath |
|
| 216 | + * @return \OC\Files\Node\Node |
|
| 217 | + * @throws \OCP\Files\NotPermittedException |
|
| 218 | + */ |
|
| 219 | + public function rename($targetPath) { |
|
| 220 | + throw new NotPermittedException(); |
|
| 221 | + } |
|
| 222 | + |
|
| 223 | + public function delete() { |
|
| 224 | + throw new NotPermittedException(); |
|
| 225 | + } |
|
| 226 | + |
|
| 227 | + /** |
|
| 228 | + * @param string $targetPath |
|
| 229 | + * @return \OC\Files\Node\Node |
|
| 230 | + * @throws \OCP\Files\NotPermittedException |
|
| 231 | + */ |
|
| 232 | + public function copy($targetPath) { |
|
| 233 | + throw new NotPermittedException(); |
|
| 234 | + } |
|
| 235 | + |
|
| 236 | + /** |
|
| 237 | + * @param int $mtime |
|
| 238 | + * @throws \OCP\Files\NotPermittedException |
|
| 239 | + */ |
|
| 240 | + public function touch($mtime = null) { |
|
| 241 | + throw new NotPermittedException(); |
|
| 242 | + } |
|
| 243 | + |
|
| 244 | + /** |
|
| 245 | + * @return \OC\Files\Storage\Storage |
|
| 246 | + * @throws \OCP\Files\NotFoundException |
|
| 247 | + */ |
|
| 248 | + public function getStorage() { |
|
| 249 | + throw new NotFoundException(); |
|
| 250 | + } |
|
| 251 | + |
|
| 252 | + /** |
|
| 253 | + * @return string |
|
| 254 | + */ |
|
| 255 | + public function getPath() { |
|
| 256 | + return '/'; |
|
| 257 | + } |
|
| 258 | + |
|
| 259 | + /** |
|
| 260 | + * @return string |
|
| 261 | + */ |
|
| 262 | + public function getInternalPath() { |
|
| 263 | + return ''; |
|
| 264 | + } |
|
| 265 | + |
|
| 266 | + /** |
|
| 267 | + * @return int |
|
| 268 | + */ |
|
| 269 | + public function getId() { |
|
| 270 | + return null; |
|
| 271 | + } |
|
| 272 | + |
|
| 273 | + /** |
|
| 274 | + * @return array |
|
| 275 | + */ |
|
| 276 | + public function stat() { |
|
| 277 | + return null; |
|
| 278 | + } |
|
| 279 | + |
|
| 280 | + /** |
|
| 281 | + * @return int |
|
| 282 | + */ |
|
| 283 | + public function getMTime() { |
|
| 284 | + return null; |
|
| 285 | + } |
|
| 286 | + |
|
| 287 | + /** |
|
| 288 | + * @param bool $includeMounts |
|
| 289 | + * @return int |
|
| 290 | + */ |
|
| 291 | + public function getSize($includeMounts = true) { |
|
| 292 | + return null; |
|
| 293 | + } |
|
| 294 | + |
|
| 295 | + /** |
|
| 296 | + * @return string |
|
| 297 | + */ |
|
| 298 | + public function getEtag() { |
|
| 299 | + return null; |
|
| 300 | + } |
|
| 301 | + |
|
| 302 | + /** |
|
| 303 | + * @return int |
|
| 304 | + */ |
|
| 305 | + public function getPermissions() { |
|
| 306 | + return \OCP\Constants::PERMISSION_CREATE; |
|
| 307 | + } |
|
| 308 | + |
|
| 309 | + /** |
|
| 310 | + * @return bool |
|
| 311 | + */ |
|
| 312 | + public function isReadable() { |
|
| 313 | + return false; |
|
| 314 | + } |
|
| 315 | + |
|
| 316 | + /** |
|
| 317 | + * @return bool |
|
| 318 | + */ |
|
| 319 | + public function isUpdateable() { |
|
| 320 | + return false; |
|
| 321 | + } |
|
| 322 | + |
|
| 323 | + /** |
|
| 324 | + * @return bool |
|
| 325 | + */ |
|
| 326 | + public function isDeletable() { |
|
| 327 | + return false; |
|
| 328 | + } |
|
| 329 | + |
|
| 330 | + /** |
|
| 331 | + * @return bool |
|
| 332 | + */ |
|
| 333 | + public function isShareable() { |
|
| 334 | + return false; |
|
| 335 | + } |
|
| 336 | + |
|
| 337 | + /** |
|
| 338 | + * @return Node |
|
| 339 | + * @throws \OCP\Files\NotFoundException |
|
| 340 | + */ |
|
| 341 | + public function getParent() { |
|
| 342 | + throw new NotFoundException(); |
|
| 343 | + } |
|
| 344 | + |
|
| 345 | + /** |
|
| 346 | + * @return string |
|
| 347 | + */ |
|
| 348 | + public function getName() { |
|
| 349 | + return ''; |
|
| 350 | + } |
|
| 351 | + |
|
| 352 | + /** |
|
| 353 | + * Returns a view to user's files folder |
|
| 354 | + * |
|
| 355 | + * @param string $userId user ID |
|
| 356 | + * @return \OCP\Files\Folder |
|
| 357 | + * @throws NoUserException |
|
| 358 | + * @throws NotPermittedException |
|
| 359 | + */ |
|
| 360 | + public function getUserFolder($userId) { |
|
| 361 | + $userObject = $this->userManager->get($userId); |
|
| 362 | + |
|
| 363 | + if (is_null($userObject)) { |
|
| 364 | + $this->logger->error( |
|
| 365 | + sprintf( |
|
| 366 | + 'Backends provided no user object for %s', |
|
| 367 | + $userId |
|
| 368 | + ), |
|
| 369 | + [ |
|
| 370 | + 'app' => 'files', |
|
| 371 | + ] |
|
| 372 | + ); |
|
| 373 | + throw new NoUserException('Backends provided no user object'); |
|
| 374 | + } |
|
| 375 | + |
|
| 376 | + $userId = $userObject->getUID(); |
|
| 377 | + |
|
| 378 | + if (!$this->userFolderCache->hasKey($userId)) { |
|
| 379 | + \OC\Files\Filesystem::initMountPoints($userId); |
|
| 380 | + |
|
| 381 | + try { |
|
| 382 | + $folder = $this->get('/' . $userId . '/files'); |
|
| 383 | + } catch (NotFoundException $e) { |
|
| 384 | + if (!$this->nodeExists('/' . $userId)) { |
|
| 385 | + $this->newFolder('/' . $userId); |
|
| 386 | + } |
|
| 387 | + $folder = $this->newFolder('/' . $userId . '/files'); |
|
| 388 | + } |
|
| 389 | + |
|
| 390 | + $this->userFolderCache->set($userId, $folder); |
|
| 391 | + } |
|
| 392 | + |
|
| 393 | + return $this->userFolderCache->get($userId); |
|
| 394 | + } |
|
| 395 | + |
|
| 396 | + public function clearCache() { |
|
| 397 | + $this->userFolderCache = new CappedMemoryCache(); |
|
| 398 | + } |
|
| 399 | + |
|
| 400 | + public function getUserMountCache() { |
|
| 401 | + return $this->userMountCache; |
|
| 402 | + } |
|
| 403 | 403 | } |
@@ -31,57 +31,57 @@ |
||
| 31 | 31 | * @since 9.0.0 |
| 32 | 32 | */ |
| 33 | 33 | interface ICachedMountInfo { |
| 34 | - /** |
|
| 35 | - * @return IUser |
|
| 36 | - * @since 9.0.0 |
|
| 37 | - */ |
|
| 38 | - public function getUser(); |
|
| 34 | + /** |
|
| 35 | + * @return IUser |
|
| 36 | + * @since 9.0.0 |
|
| 37 | + */ |
|
| 38 | + public function getUser(); |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @return int the numeric storage id of the mount |
|
| 42 | - * @since 9.0.0 |
|
| 43 | - */ |
|
| 44 | - public function getStorageId(); |
|
| 40 | + /** |
|
| 41 | + * @return int the numeric storage id of the mount |
|
| 42 | + * @since 9.0.0 |
|
| 43 | + */ |
|
| 44 | + public function getStorageId(); |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * @return int the fileid of the root of the mount |
|
| 48 | - * @since 9.0.0 |
|
| 49 | - */ |
|
| 50 | - public function getRootId(); |
|
| 46 | + /** |
|
| 47 | + * @return int the fileid of the root of the mount |
|
| 48 | + * @since 9.0.0 |
|
| 49 | + */ |
|
| 50 | + public function getRootId(); |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * @return Node the root node of the mount |
|
| 54 | - * @since 9.0.0 |
|
| 55 | - */ |
|
| 56 | - public function getMountPointNode(); |
|
| 52 | + /** |
|
| 53 | + * @return Node the root node of the mount |
|
| 54 | + * @since 9.0.0 |
|
| 55 | + */ |
|
| 56 | + public function getMountPointNode(); |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * @return string the mount point of the mount for the user |
|
| 60 | - * @since 9.0.0 |
|
| 61 | - */ |
|
| 62 | - public function getMountPoint(); |
|
| 58 | + /** |
|
| 59 | + * @return string the mount point of the mount for the user |
|
| 60 | + * @since 9.0.0 |
|
| 61 | + */ |
|
| 62 | + public function getMountPoint(); |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Get the id of the configured mount |
|
| 66 | - * |
|
| 67 | - * @return int|null mount id or null if not applicable |
|
| 68 | - * @since 9.1.0 |
|
| 69 | - */ |
|
| 70 | - public function getMountId(); |
|
| 64 | + /** |
|
| 65 | + * Get the id of the configured mount |
|
| 66 | + * |
|
| 67 | + * @return int|null mount id or null if not applicable |
|
| 68 | + * @since 9.1.0 |
|
| 69 | + */ |
|
| 70 | + public function getMountId(); |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * Get the internal path (within the storage) of the root of the mount |
|
| 74 | - * |
|
| 75 | - * @return string |
|
| 76 | - * @since 11.0.0 |
|
| 77 | - */ |
|
| 78 | - public function getRootInternalPath(); |
|
| 72 | + /** |
|
| 73 | + * Get the internal path (within the storage) of the root of the mount |
|
| 74 | + * |
|
| 75 | + * @return string |
|
| 76 | + * @since 11.0.0 |
|
| 77 | + */ |
|
| 78 | + public function getRootInternalPath(); |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * Get the class of the mount provider that this mount originates from |
|
| 82 | - * |
|
| 83 | - * @return string |
|
| 84 | - * @since 24.0.0 |
|
| 85 | - */ |
|
| 86 | - public function getMountProvider(): string; |
|
| 80 | + /** |
|
| 81 | + * Get the class of the mount provider that this mount originates from |
|
| 82 | + * |
|
| 83 | + * @return string |
|
| 84 | + * @since 24.0.0 |
|
| 85 | + */ |
|
| 86 | + public function getMountProvider(): string; |
|
| 87 | 87 | } |
@@ -29,111 +29,111 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | interface IMountPoint { |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * get complete path to the mount point |
|
| 34 | - * |
|
| 35 | - * @return string |
|
| 36 | - * @since 8.0.0 |
|
| 37 | - */ |
|
| 38 | - public function getMountPoint(); |
|
| 32 | + /** |
|
| 33 | + * get complete path to the mount point |
|
| 34 | + * |
|
| 35 | + * @return string |
|
| 36 | + * @since 8.0.0 |
|
| 37 | + */ |
|
| 38 | + public function getMountPoint(); |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Set the mountpoint |
|
| 42 | - * |
|
| 43 | - * @param string $mountPoint new mount point |
|
| 44 | - * @since 8.0.0 |
|
| 45 | - */ |
|
| 46 | - public function setMountPoint($mountPoint); |
|
| 40 | + /** |
|
| 41 | + * Set the mountpoint |
|
| 42 | + * |
|
| 43 | + * @param string $mountPoint new mount point |
|
| 44 | + * @since 8.0.0 |
|
| 45 | + */ |
|
| 46 | + public function setMountPoint($mountPoint); |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Get the storage that is mounted |
|
| 50 | - * |
|
| 51 | - * @return \OCP\Files\Storage\IStorage|null |
|
| 52 | - * @since 8.0.0 |
|
| 53 | - */ |
|
| 54 | - public function getStorage(); |
|
| 48 | + /** |
|
| 49 | + * Get the storage that is mounted |
|
| 50 | + * |
|
| 51 | + * @return \OCP\Files\Storage\IStorage|null |
|
| 52 | + * @since 8.0.0 |
|
| 53 | + */ |
|
| 54 | + public function getStorage(); |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * Get the id of the storages |
|
| 58 | - * |
|
| 59 | - * @return string |
|
| 60 | - * @since 8.0.0 |
|
| 61 | - */ |
|
| 62 | - public function getStorageId(); |
|
| 56 | + /** |
|
| 57 | + * Get the id of the storages |
|
| 58 | + * |
|
| 59 | + * @return string |
|
| 60 | + * @since 8.0.0 |
|
| 61 | + */ |
|
| 62 | + public function getStorageId(); |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * Get the id of the storages |
|
| 66 | - * |
|
| 67 | - * @return int |
|
| 68 | - * @since 9.1.0 |
|
| 69 | - */ |
|
| 70 | - public function getNumericStorageId(); |
|
| 64 | + /** |
|
| 65 | + * Get the id of the storages |
|
| 66 | + * |
|
| 67 | + * @return int |
|
| 68 | + * @since 9.1.0 |
|
| 69 | + */ |
|
| 70 | + public function getNumericStorageId(); |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * Get the path relative to the mountpoint |
|
| 74 | - * |
|
| 75 | - * @param string $path absolute path to a file or folder |
|
| 76 | - * @return string |
|
| 77 | - * @since 8.0.0 |
|
| 78 | - */ |
|
| 79 | - public function getInternalPath($path); |
|
| 72 | + /** |
|
| 73 | + * Get the path relative to the mountpoint |
|
| 74 | + * |
|
| 75 | + * @param string $path absolute path to a file or folder |
|
| 76 | + * @return string |
|
| 77 | + * @since 8.0.0 |
|
| 78 | + */ |
|
| 79 | + public function getInternalPath($path); |
|
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Apply a storage wrapper to the mounted storage |
|
| 83 | - * |
|
| 84 | - * @param callable $wrapper |
|
| 85 | - * @since 8.0.0 |
|
| 86 | - */ |
|
| 87 | - public function wrapStorage($wrapper); |
|
| 81 | + /** |
|
| 82 | + * Apply a storage wrapper to the mounted storage |
|
| 83 | + * |
|
| 84 | + * @param callable $wrapper |
|
| 85 | + * @since 8.0.0 |
|
| 86 | + */ |
|
| 87 | + public function wrapStorage($wrapper); |
|
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * Get a mount option |
|
| 91 | - * |
|
| 92 | - * @param string $name Name of the mount option to get |
|
| 93 | - * @param mixed $default Default value for the mount option |
|
| 94 | - * @return mixed |
|
| 95 | - * @since 8.0.0 |
|
| 96 | - */ |
|
| 97 | - public function getOption($name, $default); |
|
| 89 | + /** |
|
| 90 | + * Get a mount option |
|
| 91 | + * |
|
| 92 | + * @param string $name Name of the mount option to get |
|
| 93 | + * @param mixed $default Default value for the mount option |
|
| 94 | + * @return mixed |
|
| 95 | + * @since 8.0.0 |
|
| 96 | + */ |
|
| 97 | + public function getOption($name, $default); |
|
| 98 | 98 | |
| 99 | - /** |
|
| 100 | - * Get all options for the mount |
|
| 101 | - * |
|
| 102 | - * @return array |
|
| 103 | - * @since 8.1.0 |
|
| 104 | - */ |
|
| 105 | - public function getOptions(); |
|
| 99 | + /** |
|
| 100 | + * Get all options for the mount |
|
| 101 | + * |
|
| 102 | + * @return array |
|
| 103 | + * @since 8.1.0 |
|
| 104 | + */ |
|
| 105 | + public function getOptions(); |
|
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Get the file id of the root of the storage |
|
| 109 | - * |
|
| 110 | - * @return int |
|
| 111 | - * @since 9.1.0 |
|
| 112 | - */ |
|
| 113 | - public function getStorageRootId(); |
|
| 107 | + /** |
|
| 108 | + * Get the file id of the root of the storage |
|
| 109 | + * |
|
| 110 | + * @return int |
|
| 111 | + * @since 9.1.0 |
|
| 112 | + */ |
|
| 113 | + public function getStorageRootId(); |
|
| 114 | 114 | |
| 115 | - /** |
|
| 116 | - * Get the id of the configured mount |
|
| 117 | - * |
|
| 118 | - * @return int|null mount id or null if not applicable |
|
| 119 | - * @since 9.1.0 |
|
| 120 | - */ |
|
| 121 | - public function getMountId(); |
|
| 115 | + /** |
|
| 116 | + * Get the id of the configured mount |
|
| 117 | + * |
|
| 118 | + * @return int|null mount id or null if not applicable |
|
| 119 | + * @since 9.1.0 |
|
| 120 | + */ |
|
| 121 | + public function getMountId(); |
|
| 122 | 122 | |
| 123 | - /** |
|
| 124 | - * Get the type of mount point, used to distinguish things like shares and external storage |
|
| 125 | - * in the web interface |
|
| 126 | - * |
|
| 127 | - * @return string |
|
| 128 | - * @since 12.0.0 |
|
| 129 | - */ |
|
| 130 | - public function getMountType(); |
|
| 123 | + /** |
|
| 124 | + * Get the type of mount point, used to distinguish things like shares and external storage |
|
| 125 | + * in the web interface |
|
| 126 | + * |
|
| 127 | + * @return string |
|
| 128 | + * @since 12.0.0 |
|
| 129 | + */ |
|
| 130 | + public function getMountType(); |
|
| 131 | 131 | |
| 132 | - /** |
|
| 133 | - * Get the class of the mount provider that this mount originates from |
|
| 134 | - * |
|
| 135 | - * @return string |
|
| 136 | - * @since 24.0.0 |
|
| 137 | - */ |
|
| 138 | - public function getMountProvider(): string; |
|
| 132 | + /** |
|
| 133 | + * Get the class of the mount provider that this mount originates from |
|
| 134 | + * |
|
| 135 | + * @return string |
|
| 136 | + * @since 24.0.0 |
|
| 137 | + */ |
|
| 138 | + public function getMountProvider(): string; |
|
| 139 | 139 | } |
@@ -14,24 +14,24 @@ |
||
| 14 | 14 | * Auto-generated migration step: Please modify to your needs! |
| 15 | 15 | */ |
| 16 | 16 | class Version240000Date20220202150027 extends SimpleMigrationStep { |
| 17 | - /** |
|
| 18 | - * @param IOutput $output |
|
| 19 | - * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 20 | - * @param array $options |
|
| 21 | - * @return null|ISchemaWrapper |
|
| 22 | - */ |
|
| 23 | - public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 24 | - /** @var ISchemaWrapper $schema */ |
|
| 25 | - $schema = $schemaClosure(); |
|
| 17 | + /** |
|
| 18 | + * @param IOutput $output |
|
| 19 | + * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
| 20 | + * @param array $options |
|
| 21 | + * @return null|ISchemaWrapper |
|
| 22 | + */ |
|
| 23 | + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
| 24 | + /** @var ISchemaWrapper $schema */ |
|
| 25 | + $schema = $schemaClosure(); |
|
| 26 | 26 | |
| 27 | - $table = $schema->getTable('mounts'); |
|
| 28 | - if (!$table->hasColumn('mount_provider_class')) { |
|
| 29 | - $table->addColumn('mount_provider_class', Types::STRING, [ |
|
| 30 | - 'notnull' => false, |
|
| 31 | - 'length' => 128, |
|
| 32 | - ]); |
|
| 33 | - return $schema; |
|
| 34 | - } |
|
| 35 | - return null; |
|
| 36 | - } |
|
| 27 | + $table = $schema->getTable('mounts'); |
|
| 28 | + if (!$table->hasColumn('mount_provider_class')) { |
|
| 29 | + $table->addColumn('mount_provider_class', Types::STRING, [ |
|
| 30 | + 'notnull' => false, |
|
| 31 | + 'length' => 128, |
|
| 32 | + ]); |
|
| 33 | + return $schema; |
|
| 34 | + } |
|
| 35 | + return null; |
|
| 36 | + } |
|
| 37 | 37 | } |