@@ -30,62 +30,62 @@ |
||
| 30 | 30 | use OCP\Federation\ICloudId; |
| 31 | 31 | |
| 32 | 32 | class CloudId implements ICloudId { |
| 33 | - /** @var string */ |
|
| 34 | - private $id; |
|
| 35 | - /** @var string */ |
|
| 36 | - private $user; |
|
| 37 | - /** @var string */ |
|
| 38 | - private $remote; |
|
| 39 | - /** @var string|null */ |
|
| 40 | - private $displayName; |
|
| 33 | + /** @var string */ |
|
| 34 | + private $id; |
|
| 35 | + /** @var string */ |
|
| 36 | + private $user; |
|
| 37 | + /** @var string */ |
|
| 38 | + private $remote; |
|
| 39 | + /** @var string|null */ |
|
| 40 | + private $displayName; |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * CloudId constructor. |
|
| 44 | - * |
|
| 45 | - * @param string $id |
|
| 46 | - * @param string $user |
|
| 47 | - * @param string $remote |
|
| 48 | - */ |
|
| 49 | - public function __construct(string $id, string $user, string $remote, ?string $displayName = null) { |
|
| 50 | - $this->id = $id; |
|
| 51 | - $this->user = $user; |
|
| 52 | - $this->remote = $remote; |
|
| 53 | - $this->displayName = $displayName; |
|
| 54 | - } |
|
| 42 | + /** |
|
| 43 | + * CloudId constructor. |
|
| 44 | + * |
|
| 45 | + * @param string $id |
|
| 46 | + * @param string $user |
|
| 47 | + * @param string $remote |
|
| 48 | + */ |
|
| 49 | + public function __construct(string $id, string $user, string $remote, ?string $displayName = null) { |
|
| 50 | + $this->id = $id; |
|
| 51 | + $this->user = $user; |
|
| 52 | + $this->remote = $remote; |
|
| 53 | + $this->displayName = $displayName; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * The full remote cloud id |
|
| 58 | - * |
|
| 59 | - * @return string |
|
| 60 | - */ |
|
| 61 | - public function getId(): string { |
|
| 62 | - return $this->id; |
|
| 63 | - } |
|
| 56 | + /** |
|
| 57 | + * The full remote cloud id |
|
| 58 | + * |
|
| 59 | + * @return string |
|
| 60 | + */ |
|
| 61 | + public function getId(): string { |
|
| 62 | + return $this->id; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - public function getDisplayId(): string { |
|
| 66 | - if ($this->displayName) { |
|
| 67 | - $atPos = strrpos($this->getId(), '@'); |
|
| 68 | - $atHost = substr($this->getId(), $atPos); |
|
| 69 | - return $this->displayName . $atHost; |
|
| 70 | - } |
|
| 71 | - return str_replace('https://', '', str_replace('http://', '', $this->getId())); |
|
| 72 | - } |
|
| 65 | + public function getDisplayId(): string { |
|
| 66 | + if ($this->displayName) { |
|
| 67 | + $atPos = strrpos($this->getId(), '@'); |
|
| 68 | + $atHost = substr($this->getId(), $atPos); |
|
| 69 | + return $this->displayName . $atHost; |
|
| 70 | + } |
|
| 71 | + return str_replace('https://', '', str_replace('http://', '', $this->getId())); |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - /** |
|
| 75 | - * The username on the remote server |
|
| 76 | - * |
|
| 77 | - * @return string |
|
| 78 | - */ |
|
| 79 | - public function getUser(): string { |
|
| 80 | - return $this->user; |
|
| 81 | - } |
|
| 74 | + /** |
|
| 75 | + * The username on the remote server |
|
| 76 | + * |
|
| 77 | + * @return string |
|
| 78 | + */ |
|
| 79 | + public function getUser(): string { |
|
| 80 | + return $this->user; |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * The base address of the remote server |
|
| 85 | - * |
|
| 86 | - * @return string |
|
| 87 | - */ |
|
| 88 | - public function getRemote(): string { |
|
| 89 | - return $this->remote; |
|
| 90 | - } |
|
| 83 | + /** |
|
| 84 | + * The base address of the remote server |
|
| 85 | + * |
|
| 86 | + * @return string |
|
| 87 | + */ |
|
| 88 | + public function getRemote(): string { |
|
| 89 | + return $this->remote; |
|
| 90 | + } |
|
| 91 | 91 | } |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | if ($this->displayName) { |
| 67 | 67 | $atPos = strrpos($this->getId(), '@'); |
| 68 | 68 | $atHost = substr($this->getId(), $atPos); |
| 69 | - return $this->displayName . $atHost; |
|
| 69 | + return $this->displayName.$atHost; |
|
| 70 | 70 | } |
| 71 | 71 | return str_replace('https://', '', str_replace('http://', '', $this->getId())); |
| 72 | 72 | } |
@@ -34,112 +34,112 @@ |
||
| 34 | 34 | use OCP\Federation\ICloudIdManager; |
| 35 | 35 | |
| 36 | 36 | class CloudIdManager implements ICloudIdManager { |
| 37 | - /** @var IManager */ |
|
| 38 | - private $contactsManager; |
|
| 39 | - |
|
| 40 | - public function __construct(IManager $contactsManager) { |
|
| 41 | - $this->contactsManager = $contactsManager; |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * @param string $cloudId |
|
| 46 | - * @return ICloudId |
|
| 47 | - * @throws \InvalidArgumentException |
|
| 48 | - */ |
|
| 49 | - public function resolveCloudId(string $cloudId): ICloudId { |
|
| 50 | - // TODO magic here to get the url and user instead of just splitting on @ |
|
| 51 | - |
|
| 52 | - if (!$this->isValidCloudId($cloudId)) { |
|
| 53 | - throw new \InvalidArgumentException('Invalid cloud id'); |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - // Find the first character that is not allowed in user names |
|
| 57 | - $id = $this->fixRemoteURL($cloudId); |
|
| 58 | - $posSlash = strpos($id, '/'); |
|
| 59 | - $posColon = strpos($id, ':'); |
|
| 60 | - |
|
| 61 | - if ($posSlash === false && $posColon === false) { |
|
| 62 | - $invalidPos = \strlen($id); |
|
| 63 | - } elseif ($posSlash === false) { |
|
| 64 | - $invalidPos = $posColon; |
|
| 65 | - } elseif ($posColon === false) { |
|
| 66 | - $invalidPos = $posSlash; |
|
| 67 | - } else { |
|
| 68 | - $invalidPos = min($posSlash, $posColon); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - $lastValidAtPos = strrpos($id, '@', $invalidPos - strlen($id)); |
|
| 72 | - |
|
| 73 | - if ($lastValidAtPos !== false) { |
|
| 74 | - $user = substr($id, 0, $lastValidAtPos); |
|
| 75 | - $remote = substr($id, $lastValidAtPos + 1); |
|
| 76 | - if (!empty($user) && !empty($remote)) { |
|
| 77 | - return new CloudId($id, $user, $remote, $this->getDisplayNameFromContact($id)); |
|
| 78 | - } |
|
| 79 | - } |
|
| 80 | - throw new \InvalidArgumentException('Invalid cloud id'); |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - protected function getDisplayNameFromContact(string $cloudId): ?string { |
|
| 84 | - $addressBookEntries = $this->contactsManager->search($cloudId, ['CLOUD']); |
|
| 85 | - foreach ($addressBookEntries as $entry) { |
|
| 86 | - if (isset($entry['CLOUD'])) { |
|
| 87 | - foreach ($entry['CLOUD'] as $cloudID) { |
|
| 88 | - if ($cloudID === $cloudId) { |
|
| 89 | - return $entry['FN']; |
|
| 90 | - } |
|
| 91 | - } |
|
| 92 | - } |
|
| 93 | - } |
|
| 94 | - return null; |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * @param string $user |
|
| 99 | - * @param string $remote |
|
| 100 | - * @return CloudId |
|
| 101 | - */ |
|
| 102 | - public function getCloudId(string $user, string $remote): ICloudId { |
|
| 103 | - // TODO check what the correct url is for remote (asking the remote) |
|
| 104 | - $fixedRemote = $this->fixRemoteURL($remote); |
|
| 105 | - if (strpos($fixedRemote, 'http://') === 0) { |
|
| 106 | - $host = substr($fixedRemote, strlen('http://')); |
|
| 107 | - } elseif (strpos($fixedRemote, 'https://') === 0) { |
|
| 108 | - $host = substr($fixedRemote, strlen('https://')); |
|
| 109 | - } else { |
|
| 110 | - $host = $fixedRemote; |
|
| 111 | - } |
|
| 112 | - $id = $user . '@' . $remote; |
|
| 113 | - return new CloudId($id, $user, $fixedRemote, $this->getDisplayNameFromContact($id)); |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - /** |
|
| 117 | - * Strips away a potential file names and trailing slashes: |
|
| 118 | - * - http://localhost |
|
| 119 | - * - http://localhost/ |
|
| 120 | - * - http://localhost/index.php |
|
| 121 | - * - http://localhost/index.php/s/{shareToken} |
|
| 122 | - * |
|
| 123 | - * all return: http://localhost |
|
| 124 | - * |
|
| 125 | - * @param string $remote |
|
| 126 | - * @return string |
|
| 127 | - */ |
|
| 128 | - protected function fixRemoteURL(string $remote): string { |
|
| 129 | - $remote = str_replace('\\', '/', $remote); |
|
| 130 | - if ($fileNamePosition = strpos($remote, '/index.php')) { |
|
| 131 | - $remote = substr($remote, 0, $fileNamePosition); |
|
| 132 | - } |
|
| 133 | - $remote = rtrim($remote, '/'); |
|
| 134 | - |
|
| 135 | - return $remote; |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - /** |
|
| 139 | - * @param string $cloudId |
|
| 140 | - * @return bool |
|
| 141 | - */ |
|
| 142 | - public function isValidCloudId(string $cloudId): bool { |
|
| 143 | - return strpos($cloudId, '@') !== false; |
|
| 144 | - } |
|
| 37 | + /** @var IManager */ |
|
| 38 | + private $contactsManager; |
|
| 39 | + |
|
| 40 | + public function __construct(IManager $contactsManager) { |
|
| 41 | + $this->contactsManager = $contactsManager; |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * @param string $cloudId |
|
| 46 | + * @return ICloudId |
|
| 47 | + * @throws \InvalidArgumentException |
|
| 48 | + */ |
|
| 49 | + public function resolveCloudId(string $cloudId): ICloudId { |
|
| 50 | + // TODO magic here to get the url and user instead of just splitting on @ |
|
| 51 | + |
|
| 52 | + if (!$this->isValidCloudId($cloudId)) { |
|
| 53 | + throw new \InvalidArgumentException('Invalid cloud id'); |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + // Find the first character that is not allowed in user names |
|
| 57 | + $id = $this->fixRemoteURL($cloudId); |
|
| 58 | + $posSlash = strpos($id, '/'); |
|
| 59 | + $posColon = strpos($id, ':'); |
|
| 60 | + |
|
| 61 | + if ($posSlash === false && $posColon === false) { |
|
| 62 | + $invalidPos = \strlen($id); |
|
| 63 | + } elseif ($posSlash === false) { |
|
| 64 | + $invalidPos = $posColon; |
|
| 65 | + } elseif ($posColon === false) { |
|
| 66 | + $invalidPos = $posSlash; |
|
| 67 | + } else { |
|
| 68 | + $invalidPos = min($posSlash, $posColon); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + $lastValidAtPos = strrpos($id, '@', $invalidPos - strlen($id)); |
|
| 72 | + |
|
| 73 | + if ($lastValidAtPos !== false) { |
|
| 74 | + $user = substr($id, 0, $lastValidAtPos); |
|
| 75 | + $remote = substr($id, $lastValidAtPos + 1); |
|
| 76 | + if (!empty($user) && !empty($remote)) { |
|
| 77 | + return new CloudId($id, $user, $remote, $this->getDisplayNameFromContact($id)); |
|
| 78 | + } |
|
| 79 | + } |
|
| 80 | + throw new \InvalidArgumentException('Invalid cloud id'); |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + protected function getDisplayNameFromContact(string $cloudId): ?string { |
|
| 84 | + $addressBookEntries = $this->contactsManager->search($cloudId, ['CLOUD']); |
|
| 85 | + foreach ($addressBookEntries as $entry) { |
|
| 86 | + if (isset($entry['CLOUD'])) { |
|
| 87 | + foreach ($entry['CLOUD'] as $cloudID) { |
|
| 88 | + if ($cloudID === $cloudId) { |
|
| 89 | + return $entry['FN']; |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + return null; |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * @param string $user |
|
| 99 | + * @param string $remote |
|
| 100 | + * @return CloudId |
|
| 101 | + */ |
|
| 102 | + public function getCloudId(string $user, string $remote): ICloudId { |
|
| 103 | + // TODO check what the correct url is for remote (asking the remote) |
|
| 104 | + $fixedRemote = $this->fixRemoteURL($remote); |
|
| 105 | + if (strpos($fixedRemote, 'http://') === 0) { |
|
| 106 | + $host = substr($fixedRemote, strlen('http://')); |
|
| 107 | + } elseif (strpos($fixedRemote, 'https://') === 0) { |
|
| 108 | + $host = substr($fixedRemote, strlen('https://')); |
|
| 109 | + } else { |
|
| 110 | + $host = $fixedRemote; |
|
| 111 | + } |
|
| 112 | + $id = $user . '@' . $remote; |
|
| 113 | + return new CloudId($id, $user, $fixedRemote, $this->getDisplayNameFromContact($id)); |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + /** |
|
| 117 | + * Strips away a potential file names and trailing slashes: |
|
| 118 | + * - http://localhost |
|
| 119 | + * - http://localhost/ |
|
| 120 | + * - http://localhost/index.php |
|
| 121 | + * - http://localhost/index.php/s/{shareToken} |
|
| 122 | + * |
|
| 123 | + * all return: http://localhost |
|
| 124 | + * |
|
| 125 | + * @param string $remote |
|
| 126 | + * @return string |
|
| 127 | + */ |
|
| 128 | + protected function fixRemoteURL(string $remote): string { |
|
| 129 | + $remote = str_replace('\\', '/', $remote); |
|
| 130 | + if ($fileNamePosition = strpos($remote, '/index.php')) { |
|
| 131 | + $remote = substr($remote, 0, $fileNamePosition); |
|
| 132 | + } |
|
| 133 | + $remote = rtrim($remote, '/'); |
|
| 134 | + |
|
| 135 | + return $remote; |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + /** |
|
| 139 | + * @param string $cloudId |
|
| 140 | + * @return bool |
|
| 141 | + */ |
|
| 142 | + public function isValidCloudId(string $cloudId): bool { |
|
| 143 | + return strpos($cloudId, '@') !== false; |
|
| 144 | + } |
|
| 145 | 145 | } |
@@ -109,7 +109,7 @@ |
||
| 109 | 109 | } else { |
| 110 | 110 | $host = $fixedRemote; |
| 111 | 111 | } |
| 112 | - $id = $user . '@' . $remote; |
|
| 112 | + $id = $user.'@'.$remote; |
|
| 113 | 113 | return new CloudId($id, $user, $fixedRemote, $this->getDisplayNameFromContact($id)); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -249,2048 +249,2048 @@ |
||
| 249 | 249 | */ |
| 250 | 250 | class Server extends ServerContainer implements IServerContainer { |
| 251 | 251 | |
| 252 | - /** @var string */ |
|
| 253 | - private $webRoot; |
|
| 254 | - |
|
| 255 | - /** |
|
| 256 | - * @param string $webRoot |
|
| 257 | - * @param \OC\Config $config |
|
| 258 | - */ |
|
| 259 | - public function __construct($webRoot, \OC\Config $config) { |
|
| 260 | - parent::__construct(); |
|
| 261 | - $this->webRoot = $webRoot; |
|
| 262 | - |
|
| 263 | - // To find out if we are running from CLI or not |
|
| 264 | - $this->registerParameter('isCLI', \OC::$CLI); |
|
| 265 | - $this->registerParameter('serverRoot', \OC::$SERVERROOT); |
|
| 266 | - |
|
| 267 | - $this->registerService(ContainerInterface::class, function (ContainerInterface $c) { |
|
| 268 | - return $c; |
|
| 269 | - }); |
|
| 270 | - $this->registerService(\OCP\IServerContainer::class, function (ContainerInterface $c) { |
|
| 271 | - return $c; |
|
| 272 | - }); |
|
| 273 | - |
|
| 274 | - $this->registerAlias(\OCP\Calendar\IManager::class, \OC\Calendar\Manager::class); |
|
| 275 | - /** @deprecated 19.0.0 */ |
|
| 276 | - $this->registerDeprecatedAlias('CalendarManager', \OC\Calendar\Manager::class); |
|
| 277 | - |
|
| 278 | - $this->registerAlias(\OCP\Calendar\Resource\IManager::class, \OC\Calendar\Resource\Manager::class); |
|
| 279 | - /** @deprecated 19.0.0 */ |
|
| 280 | - $this->registerDeprecatedAlias('CalendarResourceBackendManager', \OC\Calendar\Resource\Manager::class); |
|
| 281 | - |
|
| 282 | - $this->registerAlias(\OCP\Calendar\Room\IManager::class, \OC\Calendar\Room\Manager::class); |
|
| 283 | - /** @deprecated 19.0.0 */ |
|
| 284 | - $this->registerDeprecatedAlias('CalendarRoomBackendManager', \OC\Calendar\Room\Manager::class); |
|
| 285 | - |
|
| 286 | - $this->registerAlias(\OCP\Contacts\IManager::class, \OC\ContactsManager::class); |
|
| 287 | - /** @deprecated 19.0.0 */ |
|
| 288 | - $this->registerDeprecatedAlias('ContactsManager', \OCP\Contacts\IManager::class); |
|
| 289 | - |
|
| 290 | - $this->registerAlias(\OCP\DirectEditing\IManager::class, \OC\DirectEditing\Manager::class); |
|
| 291 | - |
|
| 292 | - $this->registerAlias(IActionFactory::class, ActionFactory::class); |
|
| 293 | - |
|
| 294 | - $this->registerService(View::class, function (Server $c) { |
|
| 295 | - return new View(); |
|
| 296 | - }, false); |
|
| 297 | - |
|
| 298 | - $this->registerService(IPreview::class, function (ContainerInterface $c) { |
|
| 299 | - return new PreviewManager( |
|
| 300 | - $c->get(\OCP\IConfig::class), |
|
| 301 | - $c->get(IRootFolder::class), |
|
| 302 | - new \OC\Preview\Storage\Root( |
|
| 303 | - $c->get(IRootFolder::class), |
|
| 304 | - $c->get(SystemConfig::class) |
|
| 305 | - ), |
|
| 306 | - $c->get(SymfonyAdapter::class), |
|
| 307 | - $c->get(GeneratorHelper::class), |
|
| 308 | - $c->get(ISession::class)->get('user_id') |
|
| 309 | - ); |
|
| 310 | - }); |
|
| 311 | - /** @deprecated 19.0.0 */ |
|
| 312 | - $this->registerDeprecatedAlias('PreviewManager', IPreview::class); |
|
| 313 | - |
|
| 314 | - $this->registerService(\OC\Preview\Watcher::class, function (ContainerInterface $c) { |
|
| 315 | - return new \OC\Preview\Watcher( |
|
| 316 | - new \OC\Preview\Storage\Root( |
|
| 317 | - $c->get(IRootFolder::class), |
|
| 318 | - $c->get(SystemConfig::class) |
|
| 319 | - ) |
|
| 320 | - ); |
|
| 321 | - }); |
|
| 322 | - |
|
| 323 | - $this->registerService(\OCP\Encryption\IManager::class, function (Server $c) { |
|
| 324 | - $view = new View(); |
|
| 325 | - $util = new Encryption\Util( |
|
| 326 | - $view, |
|
| 327 | - $c->get(IUserManager::class), |
|
| 328 | - $c->get(IGroupManager::class), |
|
| 329 | - $c->get(\OCP\IConfig::class) |
|
| 330 | - ); |
|
| 331 | - return new Encryption\Manager( |
|
| 332 | - $c->get(\OCP\IConfig::class), |
|
| 333 | - $c->get(ILogger::class), |
|
| 334 | - $c->getL10N('core'), |
|
| 335 | - new View(), |
|
| 336 | - $util, |
|
| 337 | - new ArrayCache() |
|
| 338 | - ); |
|
| 339 | - }); |
|
| 340 | - /** @deprecated 19.0.0 */ |
|
| 341 | - $this->registerDeprecatedAlias('EncryptionManager', \OCP\Encryption\IManager::class); |
|
| 342 | - |
|
| 343 | - /** @deprecated 21.0.0 */ |
|
| 344 | - $this->registerDeprecatedAlias('EncryptionFileHelper', IFile::class); |
|
| 345 | - $this->registerService(IFile::class, function (ContainerInterface $c) { |
|
| 346 | - $util = new Encryption\Util( |
|
| 347 | - new View(), |
|
| 348 | - $c->get(IUserManager::class), |
|
| 349 | - $c->get(IGroupManager::class), |
|
| 350 | - $c->get(\OCP\IConfig::class) |
|
| 351 | - ); |
|
| 352 | - return new Encryption\File( |
|
| 353 | - $util, |
|
| 354 | - $c->get(IRootFolder::class), |
|
| 355 | - $c->get(\OCP\Share\IManager::class) |
|
| 356 | - ); |
|
| 357 | - }); |
|
| 358 | - |
|
| 359 | - /** @deprecated 21.0.0 */ |
|
| 360 | - $this->registerDeprecatedAlias('EncryptionKeyStorage', IStorage::class); |
|
| 361 | - $this->registerService(IStorage::class, function (ContainerInterface $c) { |
|
| 362 | - $view = new View(); |
|
| 363 | - $util = new Encryption\Util( |
|
| 364 | - $view, |
|
| 365 | - $c->get(IUserManager::class), |
|
| 366 | - $c->get(IGroupManager::class), |
|
| 367 | - $c->get(\OCP\IConfig::class) |
|
| 368 | - ); |
|
| 369 | - |
|
| 370 | - return new Encryption\Keys\Storage( |
|
| 371 | - $view, |
|
| 372 | - $util, |
|
| 373 | - $c->get(ICrypto::class), |
|
| 374 | - $c->get(\OCP\IConfig::class) |
|
| 375 | - ); |
|
| 376 | - }); |
|
| 377 | - /** @deprecated 20.0.0 */ |
|
| 378 | - $this->registerDeprecatedAlias('TagMapper', TagMapper::class); |
|
| 379 | - |
|
| 380 | - $this->registerAlias(\OCP\ITagManager::class, TagManager::class); |
|
| 381 | - /** @deprecated 19.0.0 */ |
|
| 382 | - $this->registerDeprecatedAlias('TagManager', \OCP\ITagManager::class); |
|
| 383 | - |
|
| 384 | - $this->registerService('SystemTagManagerFactory', function (ContainerInterface $c) { |
|
| 385 | - /** @var \OCP\IConfig $config */ |
|
| 386 | - $config = $c->get(\OCP\IConfig::class); |
|
| 387 | - $factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class); |
|
| 388 | - return new $factoryClass($this); |
|
| 389 | - }); |
|
| 390 | - $this->registerService(ISystemTagManager::class, function (ContainerInterface $c) { |
|
| 391 | - return $c->get('SystemTagManagerFactory')->getManager(); |
|
| 392 | - }); |
|
| 393 | - /** @deprecated 19.0.0 */ |
|
| 394 | - $this->registerDeprecatedAlias('SystemTagManager', ISystemTagManager::class); |
|
| 395 | - |
|
| 396 | - $this->registerService(ISystemTagObjectMapper::class, function (ContainerInterface $c) { |
|
| 397 | - return $c->get('SystemTagManagerFactory')->getObjectMapper(); |
|
| 398 | - }); |
|
| 399 | - $this->registerService('RootFolder', function (ContainerInterface $c) { |
|
| 400 | - $manager = \OC\Files\Filesystem::getMountManager(null); |
|
| 401 | - $view = new View(); |
|
| 402 | - $root = new Root( |
|
| 403 | - $manager, |
|
| 404 | - $view, |
|
| 405 | - null, |
|
| 406 | - $c->get(IUserMountCache::class), |
|
| 407 | - $this->get(ILogger::class), |
|
| 408 | - $this->get(IUserManager::class) |
|
| 409 | - ); |
|
| 410 | - |
|
| 411 | - $previewConnector = new \OC\Preview\WatcherConnector( |
|
| 412 | - $root, |
|
| 413 | - $c->get(SystemConfig::class) |
|
| 414 | - ); |
|
| 415 | - $previewConnector->connectWatcher(); |
|
| 416 | - |
|
| 417 | - return $root; |
|
| 418 | - }); |
|
| 419 | - $this->registerService(HookConnector::class, function (ContainerInterface $c) { |
|
| 420 | - return new HookConnector( |
|
| 421 | - $c->get(IRootFolder::class), |
|
| 422 | - new View(), |
|
| 423 | - $c->get(\OC\EventDispatcher\SymfonyAdapter::class), |
|
| 424 | - $c->get(IEventDispatcher::class) |
|
| 425 | - ); |
|
| 426 | - }); |
|
| 427 | - |
|
| 428 | - /** @deprecated 19.0.0 */ |
|
| 429 | - $this->registerDeprecatedAlias('SystemTagObjectMapper', ISystemTagObjectMapper::class); |
|
| 430 | - |
|
| 431 | - $this->registerService(IRootFolder::class, function (ContainerInterface $c) { |
|
| 432 | - return new LazyRoot(function () use ($c) { |
|
| 433 | - return $c->get('RootFolder'); |
|
| 434 | - }); |
|
| 435 | - }); |
|
| 436 | - /** @deprecated 19.0.0 */ |
|
| 437 | - $this->registerDeprecatedAlias('LazyRootFolder', IRootFolder::class); |
|
| 438 | - |
|
| 439 | - /** @deprecated 19.0.0 */ |
|
| 440 | - $this->registerDeprecatedAlias('UserManager', \OC\User\Manager::class); |
|
| 441 | - $this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class); |
|
| 442 | - |
|
| 443 | - $this->registerService(\OCP\IGroupManager::class, function (ContainerInterface $c) { |
|
| 444 | - $groupManager = new \OC\Group\Manager($this->get(IUserManager::class), $c->get(SymfonyAdapter::class), $this->get(ILogger::class)); |
|
| 445 | - $groupManager->listen('\OC\Group', 'preCreate', function ($gid) { |
|
| 446 | - /** @var IEventDispatcher $dispatcher */ |
|
| 447 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 448 | - $dispatcher->dispatchTyped(new BeforeGroupCreatedEvent($gid)); |
|
| 449 | - }); |
|
| 450 | - $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $group) { |
|
| 451 | - /** @var IEventDispatcher $dispatcher */ |
|
| 452 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 453 | - $dispatcher->dispatchTyped(new GroupCreatedEvent($group)); |
|
| 454 | - }); |
|
| 455 | - $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) { |
|
| 456 | - /** @var IEventDispatcher $dispatcher */ |
|
| 457 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 458 | - $dispatcher->dispatchTyped(new BeforeGroupDeletedEvent($group)); |
|
| 459 | - }); |
|
| 460 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) { |
|
| 461 | - /** @var IEventDispatcher $dispatcher */ |
|
| 462 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 463 | - $dispatcher->dispatchTyped(new GroupDeletedEvent($group)); |
|
| 464 | - }); |
|
| 465 | - $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 466 | - /** @var IEventDispatcher $dispatcher */ |
|
| 467 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 468 | - $dispatcher->dispatchTyped(new BeforeUserAddedEvent($group, $user)); |
|
| 469 | - }); |
|
| 470 | - $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 471 | - /** @var IEventDispatcher $dispatcher */ |
|
| 472 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 473 | - $dispatcher->dispatchTyped(new UserAddedEvent($group, $user)); |
|
| 474 | - }); |
|
| 475 | - $groupManager->listen('\OC\Group', 'preRemoveUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 476 | - /** @var IEventDispatcher $dispatcher */ |
|
| 477 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 478 | - $dispatcher->dispatchTyped(new BeforeUserRemovedEvent($group, $user)); |
|
| 479 | - }); |
|
| 480 | - $groupManager->listen('\OC\Group', 'postRemoveUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 481 | - /** @var IEventDispatcher $dispatcher */ |
|
| 482 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 483 | - $dispatcher->dispatchTyped(new UserRemovedEvent($group, $user)); |
|
| 484 | - }); |
|
| 485 | - return $groupManager; |
|
| 486 | - }); |
|
| 487 | - /** @deprecated 19.0.0 */ |
|
| 488 | - $this->registerDeprecatedAlias('GroupManager', \OCP\IGroupManager::class); |
|
| 489 | - |
|
| 490 | - $this->registerService(Store::class, function (ContainerInterface $c) { |
|
| 491 | - $session = $c->get(ISession::class); |
|
| 492 | - if (\OC::$server->get(SystemConfig::class)->getValue('installed', false)) { |
|
| 493 | - $tokenProvider = $c->get(IProvider::class); |
|
| 494 | - } else { |
|
| 495 | - $tokenProvider = null; |
|
| 496 | - } |
|
| 497 | - $logger = $c->get(LoggerInterface::class); |
|
| 498 | - return new Store($session, $logger, $tokenProvider); |
|
| 499 | - }); |
|
| 500 | - $this->registerAlias(IStore::class, Store::class); |
|
| 501 | - $this->registerAlias(IProvider::class, Authentication\Token\Manager::class); |
|
| 502 | - |
|
| 503 | - $this->registerService(\OC\User\Session::class, function (Server $c) { |
|
| 504 | - $manager = $c->get(IUserManager::class); |
|
| 505 | - $session = new \OC\Session\Memory(''); |
|
| 506 | - $timeFactory = new TimeFactory(); |
|
| 507 | - // Token providers might require a working database. This code |
|
| 508 | - // might however be called when ownCloud is not yet setup. |
|
| 509 | - if (\OC::$server->get(SystemConfig::class)->getValue('installed', false)) { |
|
| 510 | - $defaultTokenProvider = $c->get(IProvider::class); |
|
| 511 | - } else { |
|
| 512 | - $defaultTokenProvider = null; |
|
| 513 | - } |
|
| 514 | - |
|
| 515 | - $legacyDispatcher = $c->get(SymfonyAdapter::class); |
|
| 516 | - |
|
| 517 | - $userSession = new \OC\User\Session( |
|
| 518 | - $manager, |
|
| 519 | - $session, |
|
| 520 | - $timeFactory, |
|
| 521 | - $defaultTokenProvider, |
|
| 522 | - $c->get(\OCP\IConfig::class), |
|
| 523 | - $c->get(ISecureRandom::class), |
|
| 524 | - $c->getLockdownManager(), |
|
| 525 | - $c->get(ILogger::class), |
|
| 526 | - $c->get(IEventDispatcher::class) |
|
| 527 | - ); |
|
| 528 | - $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { |
|
| 529 | - \OC_Hook::emit('OC_User', 'pre_createUser', ['run' => true, 'uid' => $uid, 'password' => $password]); |
|
| 530 | - |
|
| 531 | - /** @var IEventDispatcher $dispatcher */ |
|
| 532 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 533 | - $dispatcher->dispatchTyped(new BeforeUserCreatedEvent($uid, $password)); |
|
| 534 | - }); |
|
| 535 | - $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) { |
|
| 536 | - /** @var \OC\User\User $user */ |
|
| 537 | - \OC_Hook::emit('OC_User', 'post_createUser', ['uid' => $user->getUID(), 'password' => $password]); |
|
| 538 | - }); |
|
| 539 | - $userSession->listen('\OC\User', 'preDelete', function ($user) use ($legacyDispatcher) { |
|
| 540 | - /** @var \OC\User\User $user */ |
|
| 541 | - \OC_Hook::emit('OC_User', 'pre_deleteUser', ['run' => true, 'uid' => $user->getUID()]); |
|
| 542 | - $legacyDispatcher->dispatch('OCP\IUser::preDelete', new GenericEvent($user)); |
|
| 543 | - |
|
| 544 | - /** @var IEventDispatcher $dispatcher */ |
|
| 545 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 546 | - $dispatcher->dispatchTyped(new BeforeUserDeletedEvent($user)); |
|
| 547 | - }); |
|
| 548 | - $userSession->listen('\OC\User', 'postDelete', function ($user) { |
|
| 549 | - /** @var \OC\User\User $user */ |
|
| 550 | - \OC_Hook::emit('OC_User', 'post_deleteUser', ['uid' => $user->getUID()]); |
|
| 551 | - |
|
| 552 | - /** @var IEventDispatcher $dispatcher */ |
|
| 553 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 554 | - $dispatcher->dispatchTyped(new UserDeletedEvent($user)); |
|
| 555 | - }); |
|
| 556 | - $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) { |
|
| 557 | - /** @var \OC\User\User $user */ |
|
| 558 | - \OC_Hook::emit('OC_User', 'pre_setPassword', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword]); |
|
| 559 | - |
|
| 560 | - /** @var IEventDispatcher $dispatcher */ |
|
| 561 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 562 | - $dispatcher->dispatchTyped(new BeforePasswordUpdatedEvent($user, $password, $recoveryPassword)); |
|
| 563 | - }); |
|
| 564 | - $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) { |
|
| 565 | - /** @var \OC\User\User $user */ |
|
| 566 | - \OC_Hook::emit('OC_User', 'post_setPassword', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword]); |
|
| 567 | - |
|
| 568 | - /** @var IEventDispatcher $dispatcher */ |
|
| 569 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 570 | - $dispatcher->dispatchTyped(new PasswordUpdatedEvent($user, $password, $recoveryPassword)); |
|
| 571 | - }); |
|
| 572 | - $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) { |
|
| 573 | - \OC_Hook::emit('OC_User', 'pre_login', ['run' => true, 'uid' => $uid, 'password' => $password]); |
|
| 574 | - |
|
| 575 | - /** @var IEventDispatcher $dispatcher */ |
|
| 576 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 577 | - $dispatcher->dispatchTyped(new BeforeUserLoggedInEvent($uid, $password)); |
|
| 578 | - }); |
|
| 579 | - $userSession->listen('\OC\User', 'postLogin', function ($user, $loginName, $password, $isTokenLogin) { |
|
| 580 | - /** @var \OC\User\User $user */ |
|
| 581 | - \OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $user->getUID(), 'loginName' => $loginName, 'password' => $password, 'isTokenLogin' => $isTokenLogin]); |
|
| 582 | - |
|
| 583 | - /** @var IEventDispatcher $dispatcher */ |
|
| 584 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 585 | - $dispatcher->dispatchTyped(new UserLoggedInEvent($user, $password, $isTokenLogin)); |
|
| 586 | - }); |
|
| 587 | - $userSession->listen('\OC\User', 'preRememberedLogin', function ($uid) { |
|
| 588 | - /** @var IEventDispatcher $dispatcher */ |
|
| 589 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 590 | - $dispatcher->dispatchTyped(new BeforeUserLoggedInWithCookieEvent($uid)); |
|
| 591 | - }); |
|
| 592 | - $userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) { |
|
| 593 | - /** @var \OC\User\User $user */ |
|
| 594 | - \OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $user->getUID(), 'password' => $password]); |
|
| 595 | - |
|
| 596 | - /** @var IEventDispatcher $dispatcher */ |
|
| 597 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 598 | - $dispatcher->dispatchTyped(new UserLoggedInWithCookieEvent($user, $password)); |
|
| 599 | - }); |
|
| 600 | - $userSession->listen('\OC\User', 'logout', function ($user) { |
|
| 601 | - \OC_Hook::emit('OC_User', 'logout', []); |
|
| 602 | - |
|
| 603 | - /** @var IEventDispatcher $dispatcher */ |
|
| 604 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 605 | - $dispatcher->dispatchTyped(new BeforeUserLoggedOutEvent($user)); |
|
| 606 | - }); |
|
| 607 | - $userSession->listen('\OC\User', 'postLogout', function ($user) { |
|
| 608 | - /** @var IEventDispatcher $dispatcher */ |
|
| 609 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 610 | - $dispatcher->dispatchTyped(new UserLoggedOutEvent($user)); |
|
| 611 | - }); |
|
| 612 | - $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) { |
|
| 613 | - /** @var \OC\User\User $user */ |
|
| 614 | - \OC_Hook::emit('OC_User', 'changeUser', ['run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue]); |
|
| 615 | - |
|
| 616 | - /** @var IEventDispatcher $dispatcher */ |
|
| 617 | - $dispatcher = $this->get(IEventDispatcher::class); |
|
| 618 | - $dispatcher->dispatchTyped(new UserChangedEvent($user, $feature, $value, $oldValue)); |
|
| 619 | - }); |
|
| 620 | - return $userSession; |
|
| 621 | - }); |
|
| 622 | - $this->registerAlias(\OCP\IUserSession::class, \OC\User\Session::class); |
|
| 623 | - /** @deprecated 19.0.0 */ |
|
| 624 | - $this->registerDeprecatedAlias('UserSession', \OC\User\Session::class); |
|
| 625 | - |
|
| 626 | - $this->registerAlias(\OCP\Authentication\TwoFactorAuth\IRegistry::class, \OC\Authentication\TwoFactorAuth\Registry::class); |
|
| 627 | - |
|
| 628 | - $this->registerAlias(INavigationManager::class, \OC\NavigationManager::class); |
|
| 629 | - /** @deprecated 19.0.0 */ |
|
| 630 | - $this->registerDeprecatedAlias('NavigationManager', INavigationManager::class); |
|
| 631 | - |
|
| 632 | - /** @deprecated 19.0.0 */ |
|
| 633 | - $this->registerDeprecatedAlias('AllConfig', \OC\AllConfig::class); |
|
| 634 | - $this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class); |
|
| 635 | - |
|
| 636 | - $this->registerService(\OC\SystemConfig::class, function ($c) use ($config) { |
|
| 637 | - return new \OC\SystemConfig($config); |
|
| 638 | - }); |
|
| 639 | - /** @deprecated 19.0.0 */ |
|
| 640 | - $this->registerDeprecatedAlias('SystemConfig', \OC\SystemConfig::class); |
|
| 641 | - |
|
| 642 | - /** @deprecated 19.0.0 */ |
|
| 643 | - $this->registerDeprecatedAlias('AppConfig', \OC\AppConfig::class); |
|
| 644 | - $this->registerAlias(IAppConfig::class, \OC\AppConfig::class); |
|
| 645 | - |
|
| 646 | - $this->registerService(IFactory::class, function (Server $c) { |
|
| 647 | - return new \OC\L10N\Factory( |
|
| 648 | - $c->get(\OCP\IConfig::class), |
|
| 649 | - $c->getRequest(), |
|
| 650 | - $c->get(IUserSession::class), |
|
| 651 | - \OC::$SERVERROOT |
|
| 652 | - ); |
|
| 653 | - }); |
|
| 654 | - /** @deprecated 19.0.0 */ |
|
| 655 | - $this->registerDeprecatedAlias('L10NFactory', IFactory::class); |
|
| 656 | - |
|
| 657 | - $this->registerAlias(IURLGenerator::class, URLGenerator::class); |
|
| 658 | - /** @deprecated 19.0.0 */ |
|
| 659 | - $this->registerDeprecatedAlias('URLGenerator', IURLGenerator::class); |
|
| 660 | - |
|
| 661 | - /** @deprecated 19.0.0 */ |
|
| 662 | - $this->registerDeprecatedAlias('AppFetcher', AppFetcher::class); |
|
| 663 | - /** @deprecated 19.0.0 */ |
|
| 664 | - $this->registerDeprecatedAlias('CategoryFetcher', CategoryFetcher::class); |
|
| 665 | - |
|
| 666 | - $this->registerService(ICache::class, function ($c) { |
|
| 667 | - return new Cache\File(); |
|
| 668 | - }); |
|
| 669 | - /** @deprecated 19.0.0 */ |
|
| 670 | - $this->registerDeprecatedAlias('UserCache', ICache::class); |
|
| 671 | - |
|
| 672 | - $this->registerService(Factory::class, function (Server $c) { |
|
| 673 | - $arrayCacheFactory = new \OC\Memcache\Factory('', $c->get(ILogger::class), |
|
| 674 | - ArrayCache::class, |
|
| 675 | - ArrayCache::class, |
|
| 676 | - ArrayCache::class |
|
| 677 | - ); |
|
| 678 | - /** @var \OCP\IConfig $config */ |
|
| 679 | - $config = $c->get(\OCP\IConfig::class); |
|
| 680 | - |
|
| 681 | - if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) { |
|
| 682 | - $v = \OC_App::getAppVersions(); |
|
| 683 | - $v['core'] = implode(',', \OC_Util::getVersion()); |
|
| 684 | - $version = implode(',', $v); |
|
| 685 | - $instanceId = \OC_Util::getInstanceId(); |
|
| 686 | - $path = \OC::$SERVERROOT; |
|
| 687 | - $prefix = md5($instanceId . '-' . $version . '-' . $path); |
|
| 688 | - return new \OC\Memcache\Factory($prefix, $c->get(ILogger::class), |
|
| 689 | - $config->getSystemValue('memcache.local', null), |
|
| 690 | - $config->getSystemValue('memcache.distributed', null), |
|
| 691 | - $config->getSystemValue('memcache.locking', null) |
|
| 692 | - ); |
|
| 693 | - } |
|
| 694 | - return $arrayCacheFactory; |
|
| 695 | - }); |
|
| 696 | - /** @deprecated 19.0.0 */ |
|
| 697 | - $this->registerDeprecatedAlias('MemCacheFactory', Factory::class); |
|
| 698 | - $this->registerAlias(ICacheFactory::class, Factory::class); |
|
| 699 | - |
|
| 700 | - $this->registerService('RedisFactory', function (Server $c) { |
|
| 701 | - $systemConfig = $c->get(SystemConfig::class); |
|
| 702 | - return new RedisFactory($systemConfig); |
|
| 703 | - }); |
|
| 704 | - |
|
| 705 | - $this->registerService(\OCP\Activity\IManager::class, function (Server $c) { |
|
| 706 | - $l10n = $this->get(IFactory::class)->get('lib'); |
|
| 707 | - return new \OC\Activity\Manager( |
|
| 708 | - $c->getRequest(), |
|
| 709 | - $c->get(IUserSession::class), |
|
| 710 | - $c->get(\OCP\IConfig::class), |
|
| 711 | - $c->get(IValidator::class), |
|
| 712 | - $l10n |
|
| 713 | - ); |
|
| 714 | - }); |
|
| 715 | - /** @deprecated 19.0.0 */ |
|
| 716 | - $this->registerDeprecatedAlias('ActivityManager', \OCP\Activity\IManager::class); |
|
| 717 | - |
|
| 718 | - $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) { |
|
| 719 | - return new \OC\Activity\EventMerger( |
|
| 720 | - $c->getL10N('lib') |
|
| 721 | - ); |
|
| 722 | - }); |
|
| 723 | - $this->registerAlias(IValidator::class, Validator::class); |
|
| 724 | - |
|
| 725 | - $this->registerService(AvatarManager::class, function (Server $c) { |
|
| 726 | - return new AvatarManager( |
|
| 727 | - $c->get(\OC\User\Manager::class), |
|
| 728 | - $c->getAppDataDir('avatar'), |
|
| 729 | - $c->getL10N('lib'), |
|
| 730 | - $c->get(ILogger::class), |
|
| 731 | - $c->get(\OCP\IConfig::class) |
|
| 732 | - ); |
|
| 733 | - }); |
|
| 734 | - $this->registerAlias(IAvatarManager::class, AvatarManager::class); |
|
| 735 | - /** @deprecated 19.0.0 */ |
|
| 736 | - $this->registerDeprecatedAlias('AvatarManager', AvatarManager::class); |
|
| 737 | - |
|
| 738 | - $this->registerAlias(\OCP\Support\CrashReport\IRegistry::class, \OC\Support\CrashReport\Registry::class); |
|
| 739 | - $this->registerAlias(\OCP\Support\Subscription\IRegistry::class, \OC\Support\Subscription\Registry::class); |
|
| 740 | - |
|
| 741 | - $this->registerService(\OC\Log::class, function (Server $c) { |
|
| 742 | - $logType = $c->get(AllConfig::class)->getSystemValue('log_type', 'file'); |
|
| 743 | - $factory = new LogFactory($c, $this->get(SystemConfig::class)); |
|
| 744 | - $logger = $factory->get($logType); |
|
| 745 | - $registry = $c->get(\OCP\Support\CrashReport\IRegistry::class); |
|
| 746 | - |
|
| 747 | - return new Log($logger, $this->get(SystemConfig::class), null, $registry); |
|
| 748 | - }); |
|
| 749 | - $this->registerAlias(ILogger::class, \OC\Log::class); |
|
| 750 | - /** @deprecated 19.0.0 */ |
|
| 751 | - $this->registerDeprecatedAlias('Logger', \OC\Log::class); |
|
| 752 | - // PSR-3 logger |
|
| 753 | - $this->registerAlias(LoggerInterface::class, PsrLoggerAdapter::class); |
|
| 754 | - |
|
| 755 | - $this->registerService(ILogFactory::class, function (Server $c) { |
|
| 756 | - return new LogFactory($c, $this->get(SystemConfig::class)); |
|
| 757 | - }); |
|
| 758 | - |
|
| 759 | - $this->registerAlias(IJobList::class, \OC\BackgroundJob\JobList::class); |
|
| 760 | - /** @deprecated 19.0.0 */ |
|
| 761 | - $this->registerDeprecatedAlias('JobList', IJobList::class); |
|
| 762 | - |
|
| 763 | - $this->registerService(Router::class, function (Server $c) { |
|
| 764 | - $cacheFactory = $c->get(ICacheFactory::class); |
|
| 765 | - $logger = $c->get(ILogger::class); |
|
| 766 | - if ($cacheFactory->isLocalCacheAvailable()) { |
|
| 767 | - $router = new \OC\Route\CachingRouter($cacheFactory->createLocal('route'), $logger); |
|
| 768 | - } else { |
|
| 769 | - $router = new \OC\Route\Router($logger); |
|
| 770 | - } |
|
| 771 | - return $router; |
|
| 772 | - }); |
|
| 773 | - $this->registerAlias(IRouter::class, Router::class); |
|
| 774 | - /** @deprecated 19.0.0 */ |
|
| 775 | - $this->registerDeprecatedAlias('Router', IRouter::class); |
|
| 776 | - |
|
| 777 | - $this->registerAlias(ISearch::class, Search::class); |
|
| 778 | - /** @deprecated 19.0.0 */ |
|
| 779 | - $this->registerDeprecatedAlias('Search', ISearch::class); |
|
| 780 | - |
|
| 781 | - $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) { |
|
| 782 | - return new \OC\Security\RateLimiting\Backend\MemoryCache( |
|
| 783 | - $this->get(ICacheFactory::class), |
|
| 784 | - new \OC\AppFramework\Utility\TimeFactory() |
|
| 785 | - ); |
|
| 786 | - }); |
|
| 787 | - |
|
| 788 | - $this->registerAlias(\OCP\Security\ISecureRandom::class, SecureRandom::class); |
|
| 789 | - /** @deprecated 19.0.0 */ |
|
| 790 | - $this->registerDeprecatedAlias('SecureRandom', \OCP\Security\ISecureRandom::class); |
|
| 791 | - |
|
| 792 | - $this->registerAlias(ICrypto::class, Crypto::class); |
|
| 793 | - /** @deprecated 19.0.0 */ |
|
| 794 | - $this->registerDeprecatedAlias('Crypto', ICrypto::class); |
|
| 795 | - |
|
| 796 | - $this->registerAlias(IHasher::class, Hasher::class); |
|
| 797 | - /** @deprecated 19.0.0 */ |
|
| 798 | - $this->registerDeprecatedAlias('Hasher', IHasher::class); |
|
| 799 | - |
|
| 800 | - $this->registerAlias(ICredentialsManager::class, CredentialsManager::class); |
|
| 801 | - /** @deprecated 19.0.0 */ |
|
| 802 | - $this->registerDeprecatedAlias('CredentialsManager', ICredentialsManager::class); |
|
| 803 | - |
|
| 804 | - $this->registerService(IDBConnection::class, function (Server $c) { |
|
| 805 | - $systemConfig = $c->get(SystemConfig::class); |
|
| 806 | - $factory = new \OC\DB\ConnectionFactory($systemConfig); |
|
| 807 | - $type = $systemConfig->getValue('dbtype', 'sqlite'); |
|
| 808 | - if (!$factory->isValidType($type)) { |
|
| 809 | - throw new \OC\DatabaseException('Invalid database type'); |
|
| 810 | - } |
|
| 811 | - $connectionParams = $factory->createConnectionParams(); |
|
| 812 | - $connection = $factory->getConnection($type, $connectionParams); |
|
| 813 | - $connection->getConfiguration()->setSQLLogger($c->getQueryLogger()); |
|
| 814 | - return $connection; |
|
| 815 | - }); |
|
| 816 | - /** @deprecated 19.0.0 */ |
|
| 817 | - $this->registerDeprecatedAlias('DatabaseConnection', IDBConnection::class); |
|
| 818 | - |
|
| 819 | - $this->registerAlias(ICertificateManager::class, CertificateManager::class); |
|
| 820 | - $this->registerAlias(IClientService::class, ClientService::class); |
|
| 821 | - $this->registerDeprecatedAlias('HttpClientService', IClientService::class); |
|
| 822 | - $this->registerService(IEventLogger::class, function (ContainerInterface $c) { |
|
| 823 | - $eventLogger = new EventLogger(); |
|
| 824 | - if ($c->get(SystemConfig::class)->getValue('debug', false)) { |
|
| 825 | - // In debug mode, module is being activated by default |
|
| 826 | - $eventLogger->activate(); |
|
| 827 | - } |
|
| 828 | - return $eventLogger; |
|
| 829 | - }); |
|
| 830 | - /** @deprecated 19.0.0 */ |
|
| 831 | - $this->registerDeprecatedAlias('EventLogger', IEventLogger::class); |
|
| 832 | - |
|
| 833 | - $this->registerService(IQueryLogger::class, function (ContainerInterface $c) { |
|
| 834 | - $queryLogger = new QueryLogger(); |
|
| 835 | - if ($c->get(SystemConfig::class)->getValue('debug', false)) { |
|
| 836 | - // In debug mode, module is being activated by default |
|
| 837 | - $queryLogger->activate(); |
|
| 838 | - } |
|
| 839 | - return $queryLogger; |
|
| 840 | - }); |
|
| 841 | - /** @deprecated 19.0.0 */ |
|
| 842 | - $this->registerDeprecatedAlias('QueryLogger', IQueryLogger::class); |
|
| 843 | - |
|
| 844 | - /** @deprecated 19.0.0 */ |
|
| 845 | - $this->registerDeprecatedAlias('TempManager', TempManager::class); |
|
| 846 | - $this->registerAlias(ITempManager::class, TempManager::class); |
|
| 847 | - |
|
| 848 | - $this->registerService(AppManager::class, function (ContainerInterface $c) { |
|
| 849 | - // TODO: use auto-wiring |
|
| 850 | - return new \OC\App\AppManager( |
|
| 851 | - $c->get(IUserSession::class), |
|
| 852 | - $c->get(\OCP\IConfig::class), |
|
| 853 | - $c->get(\OC\AppConfig::class), |
|
| 854 | - $c->get(IGroupManager::class), |
|
| 855 | - $c->get(ICacheFactory::class), |
|
| 856 | - $c->get(SymfonyAdapter::class), |
|
| 857 | - $c->get(ILogger::class) |
|
| 858 | - ); |
|
| 859 | - }); |
|
| 860 | - /** @deprecated 19.0.0 */ |
|
| 861 | - $this->registerDeprecatedAlias('AppManager', AppManager::class); |
|
| 862 | - $this->registerAlias(IAppManager::class, AppManager::class); |
|
| 863 | - |
|
| 864 | - $this->registerAlias(IDateTimeZone::class, DateTimeZone::class); |
|
| 865 | - /** @deprecated 19.0.0 */ |
|
| 866 | - $this->registerDeprecatedAlias('DateTimeZone', IDateTimeZone::class); |
|
| 867 | - |
|
| 868 | - $this->registerService(IDateTimeFormatter::class, function (Server $c) { |
|
| 869 | - $language = $c->get(\OCP\IConfig::class)->getUserValue($c->get(ISession::class)->get('user_id'), 'core', 'lang', null); |
|
| 870 | - |
|
| 871 | - return new DateTimeFormatter( |
|
| 872 | - $c->get(IDateTimeZone::class)->getTimeZone(), |
|
| 873 | - $c->getL10N('lib', $language) |
|
| 874 | - ); |
|
| 875 | - }); |
|
| 876 | - /** @deprecated 19.0.0 */ |
|
| 877 | - $this->registerDeprecatedAlias('DateTimeFormatter', IDateTimeFormatter::class); |
|
| 878 | - |
|
| 879 | - $this->registerService(IUserMountCache::class, function (ContainerInterface $c) { |
|
| 880 | - $mountCache = new UserMountCache( |
|
| 881 | - $c->get(IDBConnection::class), |
|
| 882 | - $c->get(IUserManager::class), |
|
| 883 | - $c->get(ILogger::class) |
|
| 884 | - ); |
|
| 885 | - $listener = new UserMountCacheListener($mountCache); |
|
| 886 | - $listener->listen($c->get(IUserManager::class)); |
|
| 887 | - return $mountCache; |
|
| 888 | - }); |
|
| 889 | - /** @deprecated 19.0.0 */ |
|
| 890 | - $this->registerDeprecatedAlias('UserMountCache', IUserMountCache::class); |
|
| 891 | - |
|
| 892 | - $this->registerService(IMountProviderCollection::class, function (ContainerInterface $c) { |
|
| 893 | - $loader = \OC\Files\Filesystem::getLoader(); |
|
| 894 | - $mountCache = $c->get(IUserMountCache::class); |
|
| 895 | - $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); |
|
| 896 | - |
|
| 897 | - // builtin providers |
|
| 898 | - |
|
| 899 | - $config = $c->get(\OCP\IConfig::class); |
|
| 900 | - $logger = $c->get(ILogger::class); |
|
| 901 | - $manager->registerProvider(new CacheMountProvider($config)); |
|
| 902 | - $manager->registerHomeProvider(new LocalHomeMountProvider()); |
|
| 903 | - $manager->registerHomeProvider(new ObjectHomeMountProvider($config)); |
|
| 904 | - $manager->registerRootProvider(new ObjectStorePreviewCacheMountProvider($logger, $config)); |
|
| 905 | - |
|
| 906 | - return $manager; |
|
| 907 | - }); |
|
| 908 | - /** @deprecated 19.0.0 */ |
|
| 909 | - $this->registerDeprecatedAlias('MountConfigManager', IMountProviderCollection::class); |
|
| 910 | - |
|
| 911 | - /** @deprecated 20.0.0 */ |
|
| 912 | - $this->registerDeprecatedAlias('IniWrapper', IniGetWrapper::class); |
|
| 913 | - $this->registerService(IBus::class, function (ContainerInterface $c) { |
|
| 914 | - $busClass = $c->get(\OCP\IConfig::class)->getSystemValue('commandbus'); |
|
| 915 | - if ($busClass) { |
|
| 916 | - [$app, $class] = explode('::', $busClass, 2); |
|
| 917 | - if ($c->get(IAppManager::class)->isInstalled($app)) { |
|
| 918 | - \OC_App::loadApp($app); |
|
| 919 | - return $c->get($class); |
|
| 920 | - } else { |
|
| 921 | - throw new ServiceUnavailableException("The app providing the command bus ($app) is not enabled"); |
|
| 922 | - } |
|
| 923 | - } else { |
|
| 924 | - $jobList = $c->get(IJobList::class); |
|
| 925 | - return new CronBus($jobList); |
|
| 926 | - } |
|
| 927 | - }); |
|
| 928 | - $this->registerDeprecatedAlias('AsyncCommandBus', IBus::class); |
|
| 929 | - /** @deprecated 20.0.0 */ |
|
| 930 | - $this->registerDeprecatedAlias('TrustedDomainHelper', TrustedDomainHelper::class); |
|
| 931 | - /** @deprecated 19.0.0 */ |
|
| 932 | - $this->registerDeprecatedAlias('Throttler', Throttler::class); |
|
| 933 | - $this->registerService('IntegrityCodeChecker', function (ContainerInterface $c) { |
|
| 934 | - // IConfig and IAppManager requires a working database. This code |
|
| 935 | - // might however be called when ownCloud is not yet setup. |
|
| 936 | - if (\OC::$server->get(SystemConfig::class)->getValue('installed', false)) { |
|
| 937 | - $config = $c->get(\OCP\IConfig::class); |
|
| 938 | - $appManager = $c->get(IAppManager::class); |
|
| 939 | - } else { |
|
| 940 | - $config = null; |
|
| 941 | - $appManager = null; |
|
| 942 | - } |
|
| 943 | - |
|
| 944 | - return new Checker( |
|
| 945 | - new EnvironmentHelper(), |
|
| 946 | - new FileAccessHelper(), |
|
| 947 | - new AppLocator(), |
|
| 948 | - $config, |
|
| 949 | - $c->get(ICacheFactory::class), |
|
| 950 | - $appManager, |
|
| 951 | - $c->get(ITempManager::class), |
|
| 952 | - $c->get(IMimeTypeDetector::class) |
|
| 953 | - ); |
|
| 954 | - }); |
|
| 955 | - $this->registerService(\OCP\IRequest::class, function (ContainerInterface $c) { |
|
| 956 | - if (isset($this['urlParams'])) { |
|
| 957 | - $urlParams = $this['urlParams']; |
|
| 958 | - } else { |
|
| 959 | - $urlParams = []; |
|
| 960 | - } |
|
| 961 | - |
|
| 962 | - if (defined('PHPUNIT_RUN') && PHPUNIT_RUN |
|
| 963 | - && in_array('fakeinput', stream_get_wrappers()) |
|
| 964 | - ) { |
|
| 965 | - $stream = 'fakeinput://data'; |
|
| 966 | - } else { |
|
| 967 | - $stream = 'php://input'; |
|
| 968 | - } |
|
| 969 | - |
|
| 970 | - return new Request( |
|
| 971 | - [ |
|
| 972 | - 'get' => $_GET, |
|
| 973 | - 'post' => $_POST, |
|
| 974 | - 'files' => $_FILES, |
|
| 975 | - 'server' => $_SERVER, |
|
| 976 | - 'env' => $_ENV, |
|
| 977 | - 'cookies' => $_COOKIE, |
|
| 978 | - 'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD'])) |
|
| 979 | - ? $_SERVER['REQUEST_METHOD'] |
|
| 980 | - : '', |
|
| 981 | - 'urlParams' => $urlParams, |
|
| 982 | - ], |
|
| 983 | - $this->get(ISecureRandom::class), |
|
| 984 | - $this->get(\OCP\IConfig::class), |
|
| 985 | - $this->get(CsrfTokenManager::class), |
|
| 986 | - $stream |
|
| 987 | - ); |
|
| 988 | - }); |
|
| 989 | - /** @deprecated 19.0.0 */ |
|
| 990 | - $this->registerDeprecatedAlias('Request', \OCP\IRequest::class); |
|
| 991 | - |
|
| 992 | - $this->registerService(IMailer::class, function (Server $c) { |
|
| 993 | - return new Mailer( |
|
| 994 | - $c->get(\OCP\IConfig::class), |
|
| 995 | - $c->get(ILogger::class), |
|
| 996 | - $c->get(Defaults::class), |
|
| 997 | - $c->get(IURLGenerator::class), |
|
| 998 | - $c->getL10N('lib'), |
|
| 999 | - $c->get(IEventDispatcher::class), |
|
| 1000 | - $c->get(IFactory::class) |
|
| 1001 | - ); |
|
| 1002 | - }); |
|
| 1003 | - /** @deprecated 19.0.0 */ |
|
| 1004 | - $this->registerDeprecatedAlias('Mailer', IMailer::class); |
|
| 1005 | - |
|
| 1006 | - $this->registerService('LDAPProvider', function (ContainerInterface $c) { |
|
| 1007 | - $config = $c->get(\OCP\IConfig::class); |
|
| 1008 | - $factoryClass = $config->getSystemValue('ldapProviderFactory', null); |
|
| 1009 | - if (is_null($factoryClass)) { |
|
| 1010 | - throw new \Exception('ldapProviderFactory not set'); |
|
| 1011 | - } |
|
| 1012 | - /** @var \OCP\LDAP\ILDAPProviderFactory $factory */ |
|
| 1013 | - $factory = new $factoryClass($this); |
|
| 1014 | - return $factory->getLDAPProvider(); |
|
| 1015 | - }); |
|
| 1016 | - $this->registerService(ILockingProvider::class, function (ContainerInterface $c) { |
|
| 1017 | - $ini = $c->get(IniGetWrapper::class); |
|
| 1018 | - $config = $c->get(\OCP\IConfig::class); |
|
| 1019 | - $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); |
|
| 1020 | - if ($config->getSystemValue('filelocking.enabled', true) or (defined('PHPUNIT_RUN') && PHPUNIT_RUN)) { |
|
| 1021 | - /** @var \OC\Memcache\Factory $memcacheFactory */ |
|
| 1022 | - $memcacheFactory = $c->get(ICacheFactory::class); |
|
| 1023 | - $memcache = $memcacheFactory->createLocking('lock'); |
|
| 1024 | - if (!($memcache instanceof \OC\Memcache\NullCache)) { |
|
| 1025 | - return new MemcacheLockingProvider($memcache, $ttl); |
|
| 1026 | - } |
|
| 1027 | - return new DBLockingProvider( |
|
| 1028 | - $c->get(IDBConnection::class), |
|
| 1029 | - $c->get(ILogger::class), |
|
| 1030 | - new TimeFactory(), |
|
| 1031 | - $ttl, |
|
| 1032 | - !\OC::$CLI |
|
| 1033 | - ); |
|
| 1034 | - } |
|
| 1035 | - return new NoopLockingProvider(); |
|
| 1036 | - }); |
|
| 1037 | - /** @deprecated 19.0.0 */ |
|
| 1038 | - $this->registerDeprecatedAlias('LockingProvider', ILockingProvider::class); |
|
| 1039 | - |
|
| 1040 | - $this->registerAlias(IMountManager::class, \OC\Files\Mount\Manager::class); |
|
| 1041 | - /** @deprecated 19.0.0 */ |
|
| 1042 | - $this->registerDeprecatedAlias('MountManager', IMountManager::class); |
|
| 1043 | - |
|
| 1044 | - $this->registerService(IMimeTypeDetector::class, function (ContainerInterface $c) { |
|
| 1045 | - return new \OC\Files\Type\Detection( |
|
| 1046 | - $c->get(IURLGenerator::class), |
|
| 1047 | - $c->get(ILogger::class), |
|
| 1048 | - \OC::$configDir, |
|
| 1049 | - \OC::$SERVERROOT . '/resources/config/' |
|
| 1050 | - ); |
|
| 1051 | - }); |
|
| 1052 | - /** @deprecated 19.0.0 */ |
|
| 1053 | - $this->registerDeprecatedAlias('MimeTypeDetector', IMimeTypeDetector::class); |
|
| 1054 | - |
|
| 1055 | - $this->registerAlias(IMimeTypeLoader::class, Loader::class); |
|
| 1056 | - /** @deprecated 19.0.0 */ |
|
| 1057 | - $this->registerDeprecatedAlias('MimeTypeLoader', IMimeTypeLoader::class); |
|
| 1058 | - $this->registerService(BundleFetcher::class, function () { |
|
| 1059 | - return new BundleFetcher($this->getL10N('lib')); |
|
| 1060 | - }); |
|
| 1061 | - $this->registerAlias(\OCP\Notification\IManager::class, Manager::class); |
|
| 1062 | - /** @deprecated 19.0.0 */ |
|
| 1063 | - $this->registerDeprecatedAlias('NotificationManager', \OCP\Notification\IManager::class); |
|
| 1064 | - |
|
| 1065 | - $this->registerService(CapabilitiesManager::class, function (ContainerInterface $c) { |
|
| 1066 | - $manager = new CapabilitiesManager($c->get(ILogger::class)); |
|
| 1067 | - $manager->registerCapability(function () use ($c) { |
|
| 1068 | - return new \OC\OCS\CoreCapabilities($c->get(\OCP\IConfig::class)); |
|
| 1069 | - }); |
|
| 1070 | - $manager->registerCapability(function () use ($c) { |
|
| 1071 | - return $c->get(\OC\Security\Bruteforce\Capabilities::class); |
|
| 1072 | - }); |
|
| 1073 | - return $manager; |
|
| 1074 | - }); |
|
| 1075 | - /** @deprecated 19.0.0 */ |
|
| 1076 | - $this->registerDeprecatedAlias('CapabilitiesManager', CapabilitiesManager::class); |
|
| 1077 | - |
|
| 1078 | - $this->registerService(ICommentsManager::class, function (Server $c) { |
|
| 1079 | - $config = $c->get(\OCP\IConfig::class); |
|
| 1080 | - $factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class); |
|
| 1081 | - /** @var \OCP\Comments\ICommentsManagerFactory $factory */ |
|
| 1082 | - $factory = new $factoryClass($this); |
|
| 1083 | - $manager = $factory->getManager(); |
|
| 1084 | - |
|
| 1085 | - $manager->registerDisplayNameResolver('user', function ($id) use ($c) { |
|
| 1086 | - $manager = $c->get(IUserManager::class); |
|
| 1087 | - $user = $manager->get($id); |
|
| 1088 | - if (is_null($user)) { |
|
| 1089 | - $l = $c->getL10N('core'); |
|
| 1090 | - $displayName = $l->t('Unknown user'); |
|
| 1091 | - } else { |
|
| 1092 | - $displayName = $user->getDisplayName(); |
|
| 1093 | - } |
|
| 1094 | - return $displayName; |
|
| 1095 | - }); |
|
| 1096 | - |
|
| 1097 | - return $manager; |
|
| 1098 | - }); |
|
| 1099 | - /** @deprecated 19.0.0 */ |
|
| 1100 | - $this->registerDeprecatedAlias('CommentsManager', ICommentsManager::class); |
|
| 1101 | - |
|
| 1102 | - $this->registerAlias(\OC_Defaults::class, 'ThemingDefaults'); |
|
| 1103 | - $this->registerService('ThemingDefaults', function (Server $c) { |
|
| 1104 | - /* |
|
| 252 | + /** @var string */ |
|
| 253 | + private $webRoot; |
|
| 254 | + |
|
| 255 | + /** |
|
| 256 | + * @param string $webRoot |
|
| 257 | + * @param \OC\Config $config |
|
| 258 | + */ |
|
| 259 | + public function __construct($webRoot, \OC\Config $config) { |
|
| 260 | + parent::__construct(); |
|
| 261 | + $this->webRoot = $webRoot; |
|
| 262 | + |
|
| 263 | + // To find out if we are running from CLI or not |
|
| 264 | + $this->registerParameter('isCLI', \OC::$CLI); |
|
| 265 | + $this->registerParameter('serverRoot', \OC::$SERVERROOT); |
|
| 266 | + |
|
| 267 | + $this->registerService(ContainerInterface::class, function (ContainerInterface $c) { |
|
| 268 | + return $c; |
|
| 269 | + }); |
|
| 270 | + $this->registerService(\OCP\IServerContainer::class, function (ContainerInterface $c) { |
|
| 271 | + return $c; |
|
| 272 | + }); |
|
| 273 | + |
|
| 274 | + $this->registerAlias(\OCP\Calendar\IManager::class, \OC\Calendar\Manager::class); |
|
| 275 | + /** @deprecated 19.0.0 */ |
|
| 276 | + $this->registerDeprecatedAlias('CalendarManager', \OC\Calendar\Manager::class); |
|
| 277 | + |
|
| 278 | + $this->registerAlias(\OCP\Calendar\Resource\IManager::class, \OC\Calendar\Resource\Manager::class); |
|
| 279 | + /** @deprecated 19.0.0 */ |
|
| 280 | + $this->registerDeprecatedAlias('CalendarResourceBackendManager', \OC\Calendar\Resource\Manager::class); |
|
| 281 | + |
|
| 282 | + $this->registerAlias(\OCP\Calendar\Room\IManager::class, \OC\Calendar\Room\Manager::class); |
|
| 283 | + /** @deprecated 19.0.0 */ |
|
| 284 | + $this->registerDeprecatedAlias('CalendarRoomBackendManager', \OC\Calendar\Room\Manager::class); |
|
| 285 | + |
|
| 286 | + $this->registerAlias(\OCP\Contacts\IManager::class, \OC\ContactsManager::class); |
|
| 287 | + /** @deprecated 19.0.0 */ |
|
| 288 | + $this->registerDeprecatedAlias('ContactsManager', \OCP\Contacts\IManager::class); |
|
| 289 | + |
|
| 290 | + $this->registerAlias(\OCP\DirectEditing\IManager::class, \OC\DirectEditing\Manager::class); |
|
| 291 | + |
|
| 292 | + $this->registerAlias(IActionFactory::class, ActionFactory::class); |
|
| 293 | + |
|
| 294 | + $this->registerService(View::class, function (Server $c) { |
|
| 295 | + return new View(); |
|
| 296 | + }, false); |
|
| 297 | + |
|
| 298 | + $this->registerService(IPreview::class, function (ContainerInterface $c) { |
|
| 299 | + return new PreviewManager( |
|
| 300 | + $c->get(\OCP\IConfig::class), |
|
| 301 | + $c->get(IRootFolder::class), |
|
| 302 | + new \OC\Preview\Storage\Root( |
|
| 303 | + $c->get(IRootFolder::class), |
|
| 304 | + $c->get(SystemConfig::class) |
|
| 305 | + ), |
|
| 306 | + $c->get(SymfonyAdapter::class), |
|
| 307 | + $c->get(GeneratorHelper::class), |
|
| 308 | + $c->get(ISession::class)->get('user_id') |
|
| 309 | + ); |
|
| 310 | + }); |
|
| 311 | + /** @deprecated 19.0.0 */ |
|
| 312 | + $this->registerDeprecatedAlias('PreviewManager', IPreview::class); |
|
| 313 | + |
|
| 314 | + $this->registerService(\OC\Preview\Watcher::class, function (ContainerInterface $c) { |
|
| 315 | + return new \OC\Preview\Watcher( |
|
| 316 | + new \OC\Preview\Storage\Root( |
|
| 317 | + $c->get(IRootFolder::class), |
|
| 318 | + $c->get(SystemConfig::class) |
|
| 319 | + ) |
|
| 320 | + ); |
|
| 321 | + }); |
|
| 322 | + |
|
| 323 | + $this->registerService(\OCP\Encryption\IManager::class, function (Server $c) { |
|
| 324 | + $view = new View(); |
|
| 325 | + $util = new Encryption\Util( |
|
| 326 | + $view, |
|
| 327 | + $c->get(IUserManager::class), |
|
| 328 | + $c->get(IGroupManager::class), |
|
| 329 | + $c->get(\OCP\IConfig::class) |
|
| 330 | + ); |
|
| 331 | + return new Encryption\Manager( |
|
| 332 | + $c->get(\OCP\IConfig::class), |
|
| 333 | + $c->get(ILogger::class), |
|
| 334 | + $c->getL10N('core'), |
|
| 335 | + new View(), |
|
| 336 | + $util, |
|
| 337 | + new ArrayCache() |
|
| 338 | + ); |
|
| 339 | + }); |
|
| 340 | + /** @deprecated 19.0.0 */ |
|
| 341 | + $this->registerDeprecatedAlias('EncryptionManager', \OCP\Encryption\IManager::class); |
|
| 342 | + |
|
| 343 | + /** @deprecated 21.0.0 */ |
|
| 344 | + $this->registerDeprecatedAlias('EncryptionFileHelper', IFile::class); |
|
| 345 | + $this->registerService(IFile::class, function (ContainerInterface $c) { |
|
| 346 | + $util = new Encryption\Util( |
|
| 347 | + new View(), |
|
| 348 | + $c->get(IUserManager::class), |
|
| 349 | + $c->get(IGroupManager::class), |
|
| 350 | + $c->get(\OCP\IConfig::class) |
|
| 351 | + ); |
|
| 352 | + return new Encryption\File( |
|
| 353 | + $util, |
|
| 354 | + $c->get(IRootFolder::class), |
|
| 355 | + $c->get(\OCP\Share\IManager::class) |
|
| 356 | + ); |
|
| 357 | + }); |
|
| 358 | + |
|
| 359 | + /** @deprecated 21.0.0 */ |
|
| 360 | + $this->registerDeprecatedAlias('EncryptionKeyStorage', IStorage::class); |
|
| 361 | + $this->registerService(IStorage::class, function (ContainerInterface $c) { |
|
| 362 | + $view = new View(); |
|
| 363 | + $util = new Encryption\Util( |
|
| 364 | + $view, |
|
| 365 | + $c->get(IUserManager::class), |
|
| 366 | + $c->get(IGroupManager::class), |
|
| 367 | + $c->get(\OCP\IConfig::class) |
|
| 368 | + ); |
|
| 369 | + |
|
| 370 | + return new Encryption\Keys\Storage( |
|
| 371 | + $view, |
|
| 372 | + $util, |
|
| 373 | + $c->get(ICrypto::class), |
|
| 374 | + $c->get(\OCP\IConfig::class) |
|
| 375 | + ); |
|
| 376 | + }); |
|
| 377 | + /** @deprecated 20.0.0 */ |
|
| 378 | + $this->registerDeprecatedAlias('TagMapper', TagMapper::class); |
|
| 379 | + |
|
| 380 | + $this->registerAlias(\OCP\ITagManager::class, TagManager::class); |
|
| 381 | + /** @deprecated 19.0.0 */ |
|
| 382 | + $this->registerDeprecatedAlias('TagManager', \OCP\ITagManager::class); |
|
| 383 | + |
|
| 384 | + $this->registerService('SystemTagManagerFactory', function (ContainerInterface $c) { |
|
| 385 | + /** @var \OCP\IConfig $config */ |
|
| 386 | + $config = $c->get(\OCP\IConfig::class); |
|
| 387 | + $factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class); |
|
| 388 | + return new $factoryClass($this); |
|
| 389 | + }); |
|
| 390 | + $this->registerService(ISystemTagManager::class, function (ContainerInterface $c) { |
|
| 391 | + return $c->get('SystemTagManagerFactory')->getManager(); |
|
| 392 | + }); |
|
| 393 | + /** @deprecated 19.0.0 */ |
|
| 394 | + $this->registerDeprecatedAlias('SystemTagManager', ISystemTagManager::class); |
|
| 395 | + |
|
| 396 | + $this->registerService(ISystemTagObjectMapper::class, function (ContainerInterface $c) { |
|
| 397 | + return $c->get('SystemTagManagerFactory')->getObjectMapper(); |
|
| 398 | + }); |
|
| 399 | + $this->registerService('RootFolder', function (ContainerInterface $c) { |
|
| 400 | + $manager = \OC\Files\Filesystem::getMountManager(null); |
|
| 401 | + $view = new View(); |
|
| 402 | + $root = new Root( |
|
| 403 | + $manager, |
|
| 404 | + $view, |
|
| 405 | + null, |
|
| 406 | + $c->get(IUserMountCache::class), |
|
| 407 | + $this->get(ILogger::class), |
|
| 408 | + $this->get(IUserManager::class) |
|
| 409 | + ); |
|
| 410 | + |
|
| 411 | + $previewConnector = new \OC\Preview\WatcherConnector( |
|
| 412 | + $root, |
|
| 413 | + $c->get(SystemConfig::class) |
|
| 414 | + ); |
|
| 415 | + $previewConnector->connectWatcher(); |
|
| 416 | + |
|
| 417 | + return $root; |
|
| 418 | + }); |
|
| 419 | + $this->registerService(HookConnector::class, function (ContainerInterface $c) { |
|
| 420 | + return new HookConnector( |
|
| 421 | + $c->get(IRootFolder::class), |
|
| 422 | + new View(), |
|
| 423 | + $c->get(\OC\EventDispatcher\SymfonyAdapter::class), |
|
| 424 | + $c->get(IEventDispatcher::class) |
|
| 425 | + ); |
|
| 426 | + }); |
|
| 427 | + |
|
| 428 | + /** @deprecated 19.0.0 */ |
|
| 429 | + $this->registerDeprecatedAlias('SystemTagObjectMapper', ISystemTagObjectMapper::class); |
|
| 430 | + |
|
| 431 | + $this->registerService(IRootFolder::class, function (ContainerInterface $c) { |
|
| 432 | + return new LazyRoot(function () use ($c) { |
|
| 433 | + return $c->get('RootFolder'); |
|
| 434 | + }); |
|
| 435 | + }); |
|
| 436 | + /** @deprecated 19.0.0 */ |
|
| 437 | + $this->registerDeprecatedAlias('LazyRootFolder', IRootFolder::class); |
|
| 438 | + |
|
| 439 | + /** @deprecated 19.0.0 */ |
|
| 440 | + $this->registerDeprecatedAlias('UserManager', \OC\User\Manager::class); |
|
| 441 | + $this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class); |
|
| 442 | + |
|
| 443 | + $this->registerService(\OCP\IGroupManager::class, function (ContainerInterface $c) { |
|
| 444 | + $groupManager = new \OC\Group\Manager($this->get(IUserManager::class), $c->get(SymfonyAdapter::class), $this->get(ILogger::class)); |
|
| 445 | + $groupManager->listen('\OC\Group', 'preCreate', function ($gid) { |
|
| 446 | + /** @var IEventDispatcher $dispatcher */ |
|
| 447 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 448 | + $dispatcher->dispatchTyped(new BeforeGroupCreatedEvent($gid)); |
|
| 449 | + }); |
|
| 450 | + $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $group) { |
|
| 451 | + /** @var IEventDispatcher $dispatcher */ |
|
| 452 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 453 | + $dispatcher->dispatchTyped(new GroupCreatedEvent($group)); |
|
| 454 | + }); |
|
| 455 | + $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) { |
|
| 456 | + /** @var IEventDispatcher $dispatcher */ |
|
| 457 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 458 | + $dispatcher->dispatchTyped(new BeforeGroupDeletedEvent($group)); |
|
| 459 | + }); |
|
| 460 | + $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) { |
|
| 461 | + /** @var IEventDispatcher $dispatcher */ |
|
| 462 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 463 | + $dispatcher->dispatchTyped(new GroupDeletedEvent($group)); |
|
| 464 | + }); |
|
| 465 | + $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 466 | + /** @var IEventDispatcher $dispatcher */ |
|
| 467 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 468 | + $dispatcher->dispatchTyped(new BeforeUserAddedEvent($group, $user)); |
|
| 469 | + }); |
|
| 470 | + $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 471 | + /** @var IEventDispatcher $dispatcher */ |
|
| 472 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 473 | + $dispatcher->dispatchTyped(new UserAddedEvent($group, $user)); |
|
| 474 | + }); |
|
| 475 | + $groupManager->listen('\OC\Group', 'preRemoveUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 476 | + /** @var IEventDispatcher $dispatcher */ |
|
| 477 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 478 | + $dispatcher->dispatchTyped(new BeforeUserRemovedEvent($group, $user)); |
|
| 479 | + }); |
|
| 480 | + $groupManager->listen('\OC\Group', 'postRemoveUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 481 | + /** @var IEventDispatcher $dispatcher */ |
|
| 482 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 483 | + $dispatcher->dispatchTyped(new UserRemovedEvent($group, $user)); |
|
| 484 | + }); |
|
| 485 | + return $groupManager; |
|
| 486 | + }); |
|
| 487 | + /** @deprecated 19.0.0 */ |
|
| 488 | + $this->registerDeprecatedAlias('GroupManager', \OCP\IGroupManager::class); |
|
| 489 | + |
|
| 490 | + $this->registerService(Store::class, function (ContainerInterface $c) { |
|
| 491 | + $session = $c->get(ISession::class); |
|
| 492 | + if (\OC::$server->get(SystemConfig::class)->getValue('installed', false)) { |
|
| 493 | + $tokenProvider = $c->get(IProvider::class); |
|
| 494 | + } else { |
|
| 495 | + $tokenProvider = null; |
|
| 496 | + } |
|
| 497 | + $logger = $c->get(LoggerInterface::class); |
|
| 498 | + return new Store($session, $logger, $tokenProvider); |
|
| 499 | + }); |
|
| 500 | + $this->registerAlias(IStore::class, Store::class); |
|
| 501 | + $this->registerAlias(IProvider::class, Authentication\Token\Manager::class); |
|
| 502 | + |
|
| 503 | + $this->registerService(\OC\User\Session::class, function (Server $c) { |
|
| 504 | + $manager = $c->get(IUserManager::class); |
|
| 505 | + $session = new \OC\Session\Memory(''); |
|
| 506 | + $timeFactory = new TimeFactory(); |
|
| 507 | + // Token providers might require a working database. This code |
|
| 508 | + // might however be called when ownCloud is not yet setup. |
|
| 509 | + if (\OC::$server->get(SystemConfig::class)->getValue('installed', false)) { |
|
| 510 | + $defaultTokenProvider = $c->get(IProvider::class); |
|
| 511 | + } else { |
|
| 512 | + $defaultTokenProvider = null; |
|
| 513 | + } |
|
| 514 | + |
|
| 515 | + $legacyDispatcher = $c->get(SymfonyAdapter::class); |
|
| 516 | + |
|
| 517 | + $userSession = new \OC\User\Session( |
|
| 518 | + $manager, |
|
| 519 | + $session, |
|
| 520 | + $timeFactory, |
|
| 521 | + $defaultTokenProvider, |
|
| 522 | + $c->get(\OCP\IConfig::class), |
|
| 523 | + $c->get(ISecureRandom::class), |
|
| 524 | + $c->getLockdownManager(), |
|
| 525 | + $c->get(ILogger::class), |
|
| 526 | + $c->get(IEventDispatcher::class) |
|
| 527 | + ); |
|
| 528 | + $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { |
|
| 529 | + \OC_Hook::emit('OC_User', 'pre_createUser', ['run' => true, 'uid' => $uid, 'password' => $password]); |
|
| 530 | + |
|
| 531 | + /** @var IEventDispatcher $dispatcher */ |
|
| 532 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 533 | + $dispatcher->dispatchTyped(new BeforeUserCreatedEvent($uid, $password)); |
|
| 534 | + }); |
|
| 535 | + $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) { |
|
| 536 | + /** @var \OC\User\User $user */ |
|
| 537 | + \OC_Hook::emit('OC_User', 'post_createUser', ['uid' => $user->getUID(), 'password' => $password]); |
|
| 538 | + }); |
|
| 539 | + $userSession->listen('\OC\User', 'preDelete', function ($user) use ($legacyDispatcher) { |
|
| 540 | + /** @var \OC\User\User $user */ |
|
| 541 | + \OC_Hook::emit('OC_User', 'pre_deleteUser', ['run' => true, 'uid' => $user->getUID()]); |
|
| 542 | + $legacyDispatcher->dispatch('OCP\IUser::preDelete', new GenericEvent($user)); |
|
| 543 | + |
|
| 544 | + /** @var IEventDispatcher $dispatcher */ |
|
| 545 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 546 | + $dispatcher->dispatchTyped(new BeforeUserDeletedEvent($user)); |
|
| 547 | + }); |
|
| 548 | + $userSession->listen('\OC\User', 'postDelete', function ($user) { |
|
| 549 | + /** @var \OC\User\User $user */ |
|
| 550 | + \OC_Hook::emit('OC_User', 'post_deleteUser', ['uid' => $user->getUID()]); |
|
| 551 | + |
|
| 552 | + /** @var IEventDispatcher $dispatcher */ |
|
| 553 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 554 | + $dispatcher->dispatchTyped(new UserDeletedEvent($user)); |
|
| 555 | + }); |
|
| 556 | + $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) { |
|
| 557 | + /** @var \OC\User\User $user */ |
|
| 558 | + \OC_Hook::emit('OC_User', 'pre_setPassword', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword]); |
|
| 559 | + |
|
| 560 | + /** @var IEventDispatcher $dispatcher */ |
|
| 561 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 562 | + $dispatcher->dispatchTyped(new BeforePasswordUpdatedEvent($user, $password, $recoveryPassword)); |
|
| 563 | + }); |
|
| 564 | + $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) { |
|
| 565 | + /** @var \OC\User\User $user */ |
|
| 566 | + \OC_Hook::emit('OC_User', 'post_setPassword', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword]); |
|
| 567 | + |
|
| 568 | + /** @var IEventDispatcher $dispatcher */ |
|
| 569 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 570 | + $dispatcher->dispatchTyped(new PasswordUpdatedEvent($user, $password, $recoveryPassword)); |
|
| 571 | + }); |
|
| 572 | + $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) { |
|
| 573 | + \OC_Hook::emit('OC_User', 'pre_login', ['run' => true, 'uid' => $uid, 'password' => $password]); |
|
| 574 | + |
|
| 575 | + /** @var IEventDispatcher $dispatcher */ |
|
| 576 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 577 | + $dispatcher->dispatchTyped(new BeforeUserLoggedInEvent($uid, $password)); |
|
| 578 | + }); |
|
| 579 | + $userSession->listen('\OC\User', 'postLogin', function ($user, $loginName, $password, $isTokenLogin) { |
|
| 580 | + /** @var \OC\User\User $user */ |
|
| 581 | + \OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $user->getUID(), 'loginName' => $loginName, 'password' => $password, 'isTokenLogin' => $isTokenLogin]); |
|
| 582 | + |
|
| 583 | + /** @var IEventDispatcher $dispatcher */ |
|
| 584 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 585 | + $dispatcher->dispatchTyped(new UserLoggedInEvent($user, $password, $isTokenLogin)); |
|
| 586 | + }); |
|
| 587 | + $userSession->listen('\OC\User', 'preRememberedLogin', function ($uid) { |
|
| 588 | + /** @var IEventDispatcher $dispatcher */ |
|
| 589 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 590 | + $dispatcher->dispatchTyped(new BeforeUserLoggedInWithCookieEvent($uid)); |
|
| 591 | + }); |
|
| 592 | + $userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) { |
|
| 593 | + /** @var \OC\User\User $user */ |
|
| 594 | + \OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $user->getUID(), 'password' => $password]); |
|
| 595 | + |
|
| 596 | + /** @var IEventDispatcher $dispatcher */ |
|
| 597 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 598 | + $dispatcher->dispatchTyped(new UserLoggedInWithCookieEvent($user, $password)); |
|
| 599 | + }); |
|
| 600 | + $userSession->listen('\OC\User', 'logout', function ($user) { |
|
| 601 | + \OC_Hook::emit('OC_User', 'logout', []); |
|
| 602 | + |
|
| 603 | + /** @var IEventDispatcher $dispatcher */ |
|
| 604 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 605 | + $dispatcher->dispatchTyped(new BeforeUserLoggedOutEvent($user)); |
|
| 606 | + }); |
|
| 607 | + $userSession->listen('\OC\User', 'postLogout', function ($user) { |
|
| 608 | + /** @var IEventDispatcher $dispatcher */ |
|
| 609 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 610 | + $dispatcher->dispatchTyped(new UserLoggedOutEvent($user)); |
|
| 611 | + }); |
|
| 612 | + $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) { |
|
| 613 | + /** @var \OC\User\User $user */ |
|
| 614 | + \OC_Hook::emit('OC_User', 'changeUser', ['run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue]); |
|
| 615 | + |
|
| 616 | + /** @var IEventDispatcher $dispatcher */ |
|
| 617 | + $dispatcher = $this->get(IEventDispatcher::class); |
|
| 618 | + $dispatcher->dispatchTyped(new UserChangedEvent($user, $feature, $value, $oldValue)); |
|
| 619 | + }); |
|
| 620 | + return $userSession; |
|
| 621 | + }); |
|
| 622 | + $this->registerAlias(\OCP\IUserSession::class, \OC\User\Session::class); |
|
| 623 | + /** @deprecated 19.0.0 */ |
|
| 624 | + $this->registerDeprecatedAlias('UserSession', \OC\User\Session::class); |
|
| 625 | + |
|
| 626 | + $this->registerAlias(\OCP\Authentication\TwoFactorAuth\IRegistry::class, \OC\Authentication\TwoFactorAuth\Registry::class); |
|
| 627 | + |
|
| 628 | + $this->registerAlias(INavigationManager::class, \OC\NavigationManager::class); |
|
| 629 | + /** @deprecated 19.0.0 */ |
|
| 630 | + $this->registerDeprecatedAlias('NavigationManager', INavigationManager::class); |
|
| 631 | + |
|
| 632 | + /** @deprecated 19.0.0 */ |
|
| 633 | + $this->registerDeprecatedAlias('AllConfig', \OC\AllConfig::class); |
|
| 634 | + $this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class); |
|
| 635 | + |
|
| 636 | + $this->registerService(\OC\SystemConfig::class, function ($c) use ($config) { |
|
| 637 | + return new \OC\SystemConfig($config); |
|
| 638 | + }); |
|
| 639 | + /** @deprecated 19.0.0 */ |
|
| 640 | + $this->registerDeprecatedAlias('SystemConfig', \OC\SystemConfig::class); |
|
| 641 | + |
|
| 642 | + /** @deprecated 19.0.0 */ |
|
| 643 | + $this->registerDeprecatedAlias('AppConfig', \OC\AppConfig::class); |
|
| 644 | + $this->registerAlias(IAppConfig::class, \OC\AppConfig::class); |
|
| 645 | + |
|
| 646 | + $this->registerService(IFactory::class, function (Server $c) { |
|
| 647 | + return new \OC\L10N\Factory( |
|
| 648 | + $c->get(\OCP\IConfig::class), |
|
| 649 | + $c->getRequest(), |
|
| 650 | + $c->get(IUserSession::class), |
|
| 651 | + \OC::$SERVERROOT |
|
| 652 | + ); |
|
| 653 | + }); |
|
| 654 | + /** @deprecated 19.0.0 */ |
|
| 655 | + $this->registerDeprecatedAlias('L10NFactory', IFactory::class); |
|
| 656 | + |
|
| 657 | + $this->registerAlias(IURLGenerator::class, URLGenerator::class); |
|
| 658 | + /** @deprecated 19.0.0 */ |
|
| 659 | + $this->registerDeprecatedAlias('URLGenerator', IURLGenerator::class); |
|
| 660 | + |
|
| 661 | + /** @deprecated 19.0.0 */ |
|
| 662 | + $this->registerDeprecatedAlias('AppFetcher', AppFetcher::class); |
|
| 663 | + /** @deprecated 19.0.0 */ |
|
| 664 | + $this->registerDeprecatedAlias('CategoryFetcher', CategoryFetcher::class); |
|
| 665 | + |
|
| 666 | + $this->registerService(ICache::class, function ($c) { |
|
| 667 | + return new Cache\File(); |
|
| 668 | + }); |
|
| 669 | + /** @deprecated 19.0.0 */ |
|
| 670 | + $this->registerDeprecatedAlias('UserCache', ICache::class); |
|
| 671 | + |
|
| 672 | + $this->registerService(Factory::class, function (Server $c) { |
|
| 673 | + $arrayCacheFactory = new \OC\Memcache\Factory('', $c->get(ILogger::class), |
|
| 674 | + ArrayCache::class, |
|
| 675 | + ArrayCache::class, |
|
| 676 | + ArrayCache::class |
|
| 677 | + ); |
|
| 678 | + /** @var \OCP\IConfig $config */ |
|
| 679 | + $config = $c->get(\OCP\IConfig::class); |
|
| 680 | + |
|
| 681 | + if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) { |
|
| 682 | + $v = \OC_App::getAppVersions(); |
|
| 683 | + $v['core'] = implode(',', \OC_Util::getVersion()); |
|
| 684 | + $version = implode(',', $v); |
|
| 685 | + $instanceId = \OC_Util::getInstanceId(); |
|
| 686 | + $path = \OC::$SERVERROOT; |
|
| 687 | + $prefix = md5($instanceId . '-' . $version . '-' . $path); |
|
| 688 | + return new \OC\Memcache\Factory($prefix, $c->get(ILogger::class), |
|
| 689 | + $config->getSystemValue('memcache.local', null), |
|
| 690 | + $config->getSystemValue('memcache.distributed', null), |
|
| 691 | + $config->getSystemValue('memcache.locking', null) |
|
| 692 | + ); |
|
| 693 | + } |
|
| 694 | + return $arrayCacheFactory; |
|
| 695 | + }); |
|
| 696 | + /** @deprecated 19.0.0 */ |
|
| 697 | + $this->registerDeprecatedAlias('MemCacheFactory', Factory::class); |
|
| 698 | + $this->registerAlias(ICacheFactory::class, Factory::class); |
|
| 699 | + |
|
| 700 | + $this->registerService('RedisFactory', function (Server $c) { |
|
| 701 | + $systemConfig = $c->get(SystemConfig::class); |
|
| 702 | + return new RedisFactory($systemConfig); |
|
| 703 | + }); |
|
| 704 | + |
|
| 705 | + $this->registerService(\OCP\Activity\IManager::class, function (Server $c) { |
|
| 706 | + $l10n = $this->get(IFactory::class)->get('lib'); |
|
| 707 | + return new \OC\Activity\Manager( |
|
| 708 | + $c->getRequest(), |
|
| 709 | + $c->get(IUserSession::class), |
|
| 710 | + $c->get(\OCP\IConfig::class), |
|
| 711 | + $c->get(IValidator::class), |
|
| 712 | + $l10n |
|
| 713 | + ); |
|
| 714 | + }); |
|
| 715 | + /** @deprecated 19.0.0 */ |
|
| 716 | + $this->registerDeprecatedAlias('ActivityManager', \OCP\Activity\IManager::class); |
|
| 717 | + |
|
| 718 | + $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) { |
|
| 719 | + return new \OC\Activity\EventMerger( |
|
| 720 | + $c->getL10N('lib') |
|
| 721 | + ); |
|
| 722 | + }); |
|
| 723 | + $this->registerAlias(IValidator::class, Validator::class); |
|
| 724 | + |
|
| 725 | + $this->registerService(AvatarManager::class, function (Server $c) { |
|
| 726 | + return new AvatarManager( |
|
| 727 | + $c->get(\OC\User\Manager::class), |
|
| 728 | + $c->getAppDataDir('avatar'), |
|
| 729 | + $c->getL10N('lib'), |
|
| 730 | + $c->get(ILogger::class), |
|
| 731 | + $c->get(\OCP\IConfig::class) |
|
| 732 | + ); |
|
| 733 | + }); |
|
| 734 | + $this->registerAlias(IAvatarManager::class, AvatarManager::class); |
|
| 735 | + /** @deprecated 19.0.0 */ |
|
| 736 | + $this->registerDeprecatedAlias('AvatarManager', AvatarManager::class); |
|
| 737 | + |
|
| 738 | + $this->registerAlias(\OCP\Support\CrashReport\IRegistry::class, \OC\Support\CrashReport\Registry::class); |
|
| 739 | + $this->registerAlias(\OCP\Support\Subscription\IRegistry::class, \OC\Support\Subscription\Registry::class); |
|
| 740 | + |
|
| 741 | + $this->registerService(\OC\Log::class, function (Server $c) { |
|
| 742 | + $logType = $c->get(AllConfig::class)->getSystemValue('log_type', 'file'); |
|
| 743 | + $factory = new LogFactory($c, $this->get(SystemConfig::class)); |
|
| 744 | + $logger = $factory->get($logType); |
|
| 745 | + $registry = $c->get(\OCP\Support\CrashReport\IRegistry::class); |
|
| 746 | + |
|
| 747 | + return new Log($logger, $this->get(SystemConfig::class), null, $registry); |
|
| 748 | + }); |
|
| 749 | + $this->registerAlias(ILogger::class, \OC\Log::class); |
|
| 750 | + /** @deprecated 19.0.0 */ |
|
| 751 | + $this->registerDeprecatedAlias('Logger', \OC\Log::class); |
|
| 752 | + // PSR-3 logger |
|
| 753 | + $this->registerAlias(LoggerInterface::class, PsrLoggerAdapter::class); |
|
| 754 | + |
|
| 755 | + $this->registerService(ILogFactory::class, function (Server $c) { |
|
| 756 | + return new LogFactory($c, $this->get(SystemConfig::class)); |
|
| 757 | + }); |
|
| 758 | + |
|
| 759 | + $this->registerAlias(IJobList::class, \OC\BackgroundJob\JobList::class); |
|
| 760 | + /** @deprecated 19.0.0 */ |
|
| 761 | + $this->registerDeprecatedAlias('JobList', IJobList::class); |
|
| 762 | + |
|
| 763 | + $this->registerService(Router::class, function (Server $c) { |
|
| 764 | + $cacheFactory = $c->get(ICacheFactory::class); |
|
| 765 | + $logger = $c->get(ILogger::class); |
|
| 766 | + if ($cacheFactory->isLocalCacheAvailable()) { |
|
| 767 | + $router = new \OC\Route\CachingRouter($cacheFactory->createLocal('route'), $logger); |
|
| 768 | + } else { |
|
| 769 | + $router = new \OC\Route\Router($logger); |
|
| 770 | + } |
|
| 771 | + return $router; |
|
| 772 | + }); |
|
| 773 | + $this->registerAlias(IRouter::class, Router::class); |
|
| 774 | + /** @deprecated 19.0.0 */ |
|
| 775 | + $this->registerDeprecatedAlias('Router', IRouter::class); |
|
| 776 | + |
|
| 777 | + $this->registerAlias(ISearch::class, Search::class); |
|
| 778 | + /** @deprecated 19.0.0 */ |
|
| 779 | + $this->registerDeprecatedAlias('Search', ISearch::class); |
|
| 780 | + |
|
| 781 | + $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) { |
|
| 782 | + return new \OC\Security\RateLimiting\Backend\MemoryCache( |
|
| 783 | + $this->get(ICacheFactory::class), |
|
| 784 | + new \OC\AppFramework\Utility\TimeFactory() |
|
| 785 | + ); |
|
| 786 | + }); |
|
| 787 | + |
|
| 788 | + $this->registerAlias(\OCP\Security\ISecureRandom::class, SecureRandom::class); |
|
| 789 | + /** @deprecated 19.0.0 */ |
|
| 790 | + $this->registerDeprecatedAlias('SecureRandom', \OCP\Security\ISecureRandom::class); |
|
| 791 | + |
|
| 792 | + $this->registerAlias(ICrypto::class, Crypto::class); |
|
| 793 | + /** @deprecated 19.0.0 */ |
|
| 794 | + $this->registerDeprecatedAlias('Crypto', ICrypto::class); |
|
| 795 | + |
|
| 796 | + $this->registerAlias(IHasher::class, Hasher::class); |
|
| 797 | + /** @deprecated 19.0.0 */ |
|
| 798 | + $this->registerDeprecatedAlias('Hasher', IHasher::class); |
|
| 799 | + |
|
| 800 | + $this->registerAlias(ICredentialsManager::class, CredentialsManager::class); |
|
| 801 | + /** @deprecated 19.0.0 */ |
|
| 802 | + $this->registerDeprecatedAlias('CredentialsManager', ICredentialsManager::class); |
|
| 803 | + |
|
| 804 | + $this->registerService(IDBConnection::class, function (Server $c) { |
|
| 805 | + $systemConfig = $c->get(SystemConfig::class); |
|
| 806 | + $factory = new \OC\DB\ConnectionFactory($systemConfig); |
|
| 807 | + $type = $systemConfig->getValue('dbtype', 'sqlite'); |
|
| 808 | + if (!$factory->isValidType($type)) { |
|
| 809 | + throw new \OC\DatabaseException('Invalid database type'); |
|
| 810 | + } |
|
| 811 | + $connectionParams = $factory->createConnectionParams(); |
|
| 812 | + $connection = $factory->getConnection($type, $connectionParams); |
|
| 813 | + $connection->getConfiguration()->setSQLLogger($c->getQueryLogger()); |
|
| 814 | + return $connection; |
|
| 815 | + }); |
|
| 816 | + /** @deprecated 19.0.0 */ |
|
| 817 | + $this->registerDeprecatedAlias('DatabaseConnection', IDBConnection::class); |
|
| 818 | + |
|
| 819 | + $this->registerAlias(ICertificateManager::class, CertificateManager::class); |
|
| 820 | + $this->registerAlias(IClientService::class, ClientService::class); |
|
| 821 | + $this->registerDeprecatedAlias('HttpClientService', IClientService::class); |
|
| 822 | + $this->registerService(IEventLogger::class, function (ContainerInterface $c) { |
|
| 823 | + $eventLogger = new EventLogger(); |
|
| 824 | + if ($c->get(SystemConfig::class)->getValue('debug', false)) { |
|
| 825 | + // In debug mode, module is being activated by default |
|
| 826 | + $eventLogger->activate(); |
|
| 827 | + } |
|
| 828 | + return $eventLogger; |
|
| 829 | + }); |
|
| 830 | + /** @deprecated 19.0.0 */ |
|
| 831 | + $this->registerDeprecatedAlias('EventLogger', IEventLogger::class); |
|
| 832 | + |
|
| 833 | + $this->registerService(IQueryLogger::class, function (ContainerInterface $c) { |
|
| 834 | + $queryLogger = new QueryLogger(); |
|
| 835 | + if ($c->get(SystemConfig::class)->getValue('debug', false)) { |
|
| 836 | + // In debug mode, module is being activated by default |
|
| 837 | + $queryLogger->activate(); |
|
| 838 | + } |
|
| 839 | + return $queryLogger; |
|
| 840 | + }); |
|
| 841 | + /** @deprecated 19.0.0 */ |
|
| 842 | + $this->registerDeprecatedAlias('QueryLogger', IQueryLogger::class); |
|
| 843 | + |
|
| 844 | + /** @deprecated 19.0.0 */ |
|
| 845 | + $this->registerDeprecatedAlias('TempManager', TempManager::class); |
|
| 846 | + $this->registerAlias(ITempManager::class, TempManager::class); |
|
| 847 | + |
|
| 848 | + $this->registerService(AppManager::class, function (ContainerInterface $c) { |
|
| 849 | + // TODO: use auto-wiring |
|
| 850 | + return new \OC\App\AppManager( |
|
| 851 | + $c->get(IUserSession::class), |
|
| 852 | + $c->get(\OCP\IConfig::class), |
|
| 853 | + $c->get(\OC\AppConfig::class), |
|
| 854 | + $c->get(IGroupManager::class), |
|
| 855 | + $c->get(ICacheFactory::class), |
|
| 856 | + $c->get(SymfonyAdapter::class), |
|
| 857 | + $c->get(ILogger::class) |
|
| 858 | + ); |
|
| 859 | + }); |
|
| 860 | + /** @deprecated 19.0.0 */ |
|
| 861 | + $this->registerDeprecatedAlias('AppManager', AppManager::class); |
|
| 862 | + $this->registerAlias(IAppManager::class, AppManager::class); |
|
| 863 | + |
|
| 864 | + $this->registerAlias(IDateTimeZone::class, DateTimeZone::class); |
|
| 865 | + /** @deprecated 19.0.0 */ |
|
| 866 | + $this->registerDeprecatedAlias('DateTimeZone', IDateTimeZone::class); |
|
| 867 | + |
|
| 868 | + $this->registerService(IDateTimeFormatter::class, function (Server $c) { |
|
| 869 | + $language = $c->get(\OCP\IConfig::class)->getUserValue($c->get(ISession::class)->get('user_id'), 'core', 'lang', null); |
|
| 870 | + |
|
| 871 | + return new DateTimeFormatter( |
|
| 872 | + $c->get(IDateTimeZone::class)->getTimeZone(), |
|
| 873 | + $c->getL10N('lib', $language) |
|
| 874 | + ); |
|
| 875 | + }); |
|
| 876 | + /** @deprecated 19.0.0 */ |
|
| 877 | + $this->registerDeprecatedAlias('DateTimeFormatter', IDateTimeFormatter::class); |
|
| 878 | + |
|
| 879 | + $this->registerService(IUserMountCache::class, function (ContainerInterface $c) { |
|
| 880 | + $mountCache = new UserMountCache( |
|
| 881 | + $c->get(IDBConnection::class), |
|
| 882 | + $c->get(IUserManager::class), |
|
| 883 | + $c->get(ILogger::class) |
|
| 884 | + ); |
|
| 885 | + $listener = new UserMountCacheListener($mountCache); |
|
| 886 | + $listener->listen($c->get(IUserManager::class)); |
|
| 887 | + return $mountCache; |
|
| 888 | + }); |
|
| 889 | + /** @deprecated 19.0.0 */ |
|
| 890 | + $this->registerDeprecatedAlias('UserMountCache', IUserMountCache::class); |
|
| 891 | + |
|
| 892 | + $this->registerService(IMountProviderCollection::class, function (ContainerInterface $c) { |
|
| 893 | + $loader = \OC\Files\Filesystem::getLoader(); |
|
| 894 | + $mountCache = $c->get(IUserMountCache::class); |
|
| 895 | + $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); |
|
| 896 | + |
|
| 897 | + // builtin providers |
|
| 898 | + |
|
| 899 | + $config = $c->get(\OCP\IConfig::class); |
|
| 900 | + $logger = $c->get(ILogger::class); |
|
| 901 | + $manager->registerProvider(new CacheMountProvider($config)); |
|
| 902 | + $manager->registerHomeProvider(new LocalHomeMountProvider()); |
|
| 903 | + $manager->registerHomeProvider(new ObjectHomeMountProvider($config)); |
|
| 904 | + $manager->registerRootProvider(new ObjectStorePreviewCacheMountProvider($logger, $config)); |
|
| 905 | + |
|
| 906 | + return $manager; |
|
| 907 | + }); |
|
| 908 | + /** @deprecated 19.0.0 */ |
|
| 909 | + $this->registerDeprecatedAlias('MountConfigManager', IMountProviderCollection::class); |
|
| 910 | + |
|
| 911 | + /** @deprecated 20.0.0 */ |
|
| 912 | + $this->registerDeprecatedAlias('IniWrapper', IniGetWrapper::class); |
|
| 913 | + $this->registerService(IBus::class, function (ContainerInterface $c) { |
|
| 914 | + $busClass = $c->get(\OCP\IConfig::class)->getSystemValue('commandbus'); |
|
| 915 | + if ($busClass) { |
|
| 916 | + [$app, $class] = explode('::', $busClass, 2); |
|
| 917 | + if ($c->get(IAppManager::class)->isInstalled($app)) { |
|
| 918 | + \OC_App::loadApp($app); |
|
| 919 | + return $c->get($class); |
|
| 920 | + } else { |
|
| 921 | + throw new ServiceUnavailableException("The app providing the command bus ($app) is not enabled"); |
|
| 922 | + } |
|
| 923 | + } else { |
|
| 924 | + $jobList = $c->get(IJobList::class); |
|
| 925 | + return new CronBus($jobList); |
|
| 926 | + } |
|
| 927 | + }); |
|
| 928 | + $this->registerDeprecatedAlias('AsyncCommandBus', IBus::class); |
|
| 929 | + /** @deprecated 20.0.0 */ |
|
| 930 | + $this->registerDeprecatedAlias('TrustedDomainHelper', TrustedDomainHelper::class); |
|
| 931 | + /** @deprecated 19.0.0 */ |
|
| 932 | + $this->registerDeprecatedAlias('Throttler', Throttler::class); |
|
| 933 | + $this->registerService('IntegrityCodeChecker', function (ContainerInterface $c) { |
|
| 934 | + // IConfig and IAppManager requires a working database. This code |
|
| 935 | + // might however be called when ownCloud is not yet setup. |
|
| 936 | + if (\OC::$server->get(SystemConfig::class)->getValue('installed', false)) { |
|
| 937 | + $config = $c->get(\OCP\IConfig::class); |
|
| 938 | + $appManager = $c->get(IAppManager::class); |
|
| 939 | + } else { |
|
| 940 | + $config = null; |
|
| 941 | + $appManager = null; |
|
| 942 | + } |
|
| 943 | + |
|
| 944 | + return new Checker( |
|
| 945 | + new EnvironmentHelper(), |
|
| 946 | + new FileAccessHelper(), |
|
| 947 | + new AppLocator(), |
|
| 948 | + $config, |
|
| 949 | + $c->get(ICacheFactory::class), |
|
| 950 | + $appManager, |
|
| 951 | + $c->get(ITempManager::class), |
|
| 952 | + $c->get(IMimeTypeDetector::class) |
|
| 953 | + ); |
|
| 954 | + }); |
|
| 955 | + $this->registerService(\OCP\IRequest::class, function (ContainerInterface $c) { |
|
| 956 | + if (isset($this['urlParams'])) { |
|
| 957 | + $urlParams = $this['urlParams']; |
|
| 958 | + } else { |
|
| 959 | + $urlParams = []; |
|
| 960 | + } |
|
| 961 | + |
|
| 962 | + if (defined('PHPUNIT_RUN') && PHPUNIT_RUN |
|
| 963 | + && in_array('fakeinput', stream_get_wrappers()) |
|
| 964 | + ) { |
|
| 965 | + $stream = 'fakeinput://data'; |
|
| 966 | + } else { |
|
| 967 | + $stream = 'php://input'; |
|
| 968 | + } |
|
| 969 | + |
|
| 970 | + return new Request( |
|
| 971 | + [ |
|
| 972 | + 'get' => $_GET, |
|
| 973 | + 'post' => $_POST, |
|
| 974 | + 'files' => $_FILES, |
|
| 975 | + 'server' => $_SERVER, |
|
| 976 | + 'env' => $_ENV, |
|
| 977 | + 'cookies' => $_COOKIE, |
|
| 978 | + 'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD'])) |
|
| 979 | + ? $_SERVER['REQUEST_METHOD'] |
|
| 980 | + : '', |
|
| 981 | + 'urlParams' => $urlParams, |
|
| 982 | + ], |
|
| 983 | + $this->get(ISecureRandom::class), |
|
| 984 | + $this->get(\OCP\IConfig::class), |
|
| 985 | + $this->get(CsrfTokenManager::class), |
|
| 986 | + $stream |
|
| 987 | + ); |
|
| 988 | + }); |
|
| 989 | + /** @deprecated 19.0.0 */ |
|
| 990 | + $this->registerDeprecatedAlias('Request', \OCP\IRequest::class); |
|
| 991 | + |
|
| 992 | + $this->registerService(IMailer::class, function (Server $c) { |
|
| 993 | + return new Mailer( |
|
| 994 | + $c->get(\OCP\IConfig::class), |
|
| 995 | + $c->get(ILogger::class), |
|
| 996 | + $c->get(Defaults::class), |
|
| 997 | + $c->get(IURLGenerator::class), |
|
| 998 | + $c->getL10N('lib'), |
|
| 999 | + $c->get(IEventDispatcher::class), |
|
| 1000 | + $c->get(IFactory::class) |
|
| 1001 | + ); |
|
| 1002 | + }); |
|
| 1003 | + /** @deprecated 19.0.0 */ |
|
| 1004 | + $this->registerDeprecatedAlias('Mailer', IMailer::class); |
|
| 1005 | + |
|
| 1006 | + $this->registerService('LDAPProvider', function (ContainerInterface $c) { |
|
| 1007 | + $config = $c->get(\OCP\IConfig::class); |
|
| 1008 | + $factoryClass = $config->getSystemValue('ldapProviderFactory', null); |
|
| 1009 | + if (is_null($factoryClass)) { |
|
| 1010 | + throw new \Exception('ldapProviderFactory not set'); |
|
| 1011 | + } |
|
| 1012 | + /** @var \OCP\LDAP\ILDAPProviderFactory $factory */ |
|
| 1013 | + $factory = new $factoryClass($this); |
|
| 1014 | + return $factory->getLDAPProvider(); |
|
| 1015 | + }); |
|
| 1016 | + $this->registerService(ILockingProvider::class, function (ContainerInterface $c) { |
|
| 1017 | + $ini = $c->get(IniGetWrapper::class); |
|
| 1018 | + $config = $c->get(\OCP\IConfig::class); |
|
| 1019 | + $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); |
|
| 1020 | + if ($config->getSystemValue('filelocking.enabled', true) or (defined('PHPUNIT_RUN') && PHPUNIT_RUN)) { |
|
| 1021 | + /** @var \OC\Memcache\Factory $memcacheFactory */ |
|
| 1022 | + $memcacheFactory = $c->get(ICacheFactory::class); |
|
| 1023 | + $memcache = $memcacheFactory->createLocking('lock'); |
|
| 1024 | + if (!($memcache instanceof \OC\Memcache\NullCache)) { |
|
| 1025 | + return new MemcacheLockingProvider($memcache, $ttl); |
|
| 1026 | + } |
|
| 1027 | + return new DBLockingProvider( |
|
| 1028 | + $c->get(IDBConnection::class), |
|
| 1029 | + $c->get(ILogger::class), |
|
| 1030 | + new TimeFactory(), |
|
| 1031 | + $ttl, |
|
| 1032 | + !\OC::$CLI |
|
| 1033 | + ); |
|
| 1034 | + } |
|
| 1035 | + return new NoopLockingProvider(); |
|
| 1036 | + }); |
|
| 1037 | + /** @deprecated 19.0.0 */ |
|
| 1038 | + $this->registerDeprecatedAlias('LockingProvider', ILockingProvider::class); |
|
| 1039 | + |
|
| 1040 | + $this->registerAlias(IMountManager::class, \OC\Files\Mount\Manager::class); |
|
| 1041 | + /** @deprecated 19.0.0 */ |
|
| 1042 | + $this->registerDeprecatedAlias('MountManager', IMountManager::class); |
|
| 1043 | + |
|
| 1044 | + $this->registerService(IMimeTypeDetector::class, function (ContainerInterface $c) { |
|
| 1045 | + return new \OC\Files\Type\Detection( |
|
| 1046 | + $c->get(IURLGenerator::class), |
|
| 1047 | + $c->get(ILogger::class), |
|
| 1048 | + \OC::$configDir, |
|
| 1049 | + \OC::$SERVERROOT . '/resources/config/' |
|
| 1050 | + ); |
|
| 1051 | + }); |
|
| 1052 | + /** @deprecated 19.0.0 */ |
|
| 1053 | + $this->registerDeprecatedAlias('MimeTypeDetector', IMimeTypeDetector::class); |
|
| 1054 | + |
|
| 1055 | + $this->registerAlias(IMimeTypeLoader::class, Loader::class); |
|
| 1056 | + /** @deprecated 19.0.0 */ |
|
| 1057 | + $this->registerDeprecatedAlias('MimeTypeLoader', IMimeTypeLoader::class); |
|
| 1058 | + $this->registerService(BundleFetcher::class, function () { |
|
| 1059 | + return new BundleFetcher($this->getL10N('lib')); |
|
| 1060 | + }); |
|
| 1061 | + $this->registerAlias(\OCP\Notification\IManager::class, Manager::class); |
|
| 1062 | + /** @deprecated 19.0.0 */ |
|
| 1063 | + $this->registerDeprecatedAlias('NotificationManager', \OCP\Notification\IManager::class); |
|
| 1064 | + |
|
| 1065 | + $this->registerService(CapabilitiesManager::class, function (ContainerInterface $c) { |
|
| 1066 | + $manager = new CapabilitiesManager($c->get(ILogger::class)); |
|
| 1067 | + $manager->registerCapability(function () use ($c) { |
|
| 1068 | + return new \OC\OCS\CoreCapabilities($c->get(\OCP\IConfig::class)); |
|
| 1069 | + }); |
|
| 1070 | + $manager->registerCapability(function () use ($c) { |
|
| 1071 | + return $c->get(\OC\Security\Bruteforce\Capabilities::class); |
|
| 1072 | + }); |
|
| 1073 | + return $manager; |
|
| 1074 | + }); |
|
| 1075 | + /** @deprecated 19.0.0 */ |
|
| 1076 | + $this->registerDeprecatedAlias('CapabilitiesManager', CapabilitiesManager::class); |
|
| 1077 | + |
|
| 1078 | + $this->registerService(ICommentsManager::class, function (Server $c) { |
|
| 1079 | + $config = $c->get(\OCP\IConfig::class); |
|
| 1080 | + $factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class); |
|
| 1081 | + /** @var \OCP\Comments\ICommentsManagerFactory $factory */ |
|
| 1082 | + $factory = new $factoryClass($this); |
|
| 1083 | + $manager = $factory->getManager(); |
|
| 1084 | + |
|
| 1085 | + $manager->registerDisplayNameResolver('user', function ($id) use ($c) { |
|
| 1086 | + $manager = $c->get(IUserManager::class); |
|
| 1087 | + $user = $manager->get($id); |
|
| 1088 | + if (is_null($user)) { |
|
| 1089 | + $l = $c->getL10N('core'); |
|
| 1090 | + $displayName = $l->t('Unknown user'); |
|
| 1091 | + } else { |
|
| 1092 | + $displayName = $user->getDisplayName(); |
|
| 1093 | + } |
|
| 1094 | + return $displayName; |
|
| 1095 | + }); |
|
| 1096 | + |
|
| 1097 | + return $manager; |
|
| 1098 | + }); |
|
| 1099 | + /** @deprecated 19.0.0 */ |
|
| 1100 | + $this->registerDeprecatedAlias('CommentsManager', ICommentsManager::class); |
|
| 1101 | + |
|
| 1102 | + $this->registerAlias(\OC_Defaults::class, 'ThemingDefaults'); |
|
| 1103 | + $this->registerService('ThemingDefaults', function (Server $c) { |
|
| 1104 | + /* |
|
| 1105 | 1105 | * Dark magic for autoloader. |
| 1106 | 1106 | * If we do a class_exists it will try to load the class which will |
| 1107 | 1107 | * make composer cache the result. Resulting in errors when enabling |
| 1108 | 1108 | * the theming app. |
| 1109 | 1109 | */ |
| 1110 | - $prefixes = \OC::$composerAutoloader->getPrefixesPsr4(); |
|
| 1111 | - if (isset($prefixes['OCA\\Theming\\'])) { |
|
| 1112 | - $classExists = true; |
|
| 1113 | - } else { |
|
| 1114 | - $classExists = false; |
|
| 1115 | - } |
|
| 1116 | - |
|
| 1117 | - if ($classExists && $c->get(\OCP\IConfig::class)->getSystemValue('installed', false) && $c->get(IAppManager::class)->isInstalled('theming') && $c->getTrustedDomainHelper()->isTrustedDomain($c->getRequest()->getInsecureServerHost())) { |
|
| 1118 | - return new ThemingDefaults( |
|
| 1119 | - $c->get(\OCP\IConfig::class), |
|
| 1120 | - $c->getL10N('theming'), |
|
| 1121 | - $c->get(IURLGenerator::class), |
|
| 1122 | - $c->get(ICacheFactory::class), |
|
| 1123 | - new Util($c->get(\OCP\IConfig::class), $this->get(IAppManager::class), $c->getAppDataDir('theming')), |
|
| 1124 | - new ImageManager( |
|
| 1125 | - $c->get(\OCP\IConfig::class), |
|
| 1126 | - $c->getAppDataDir('theming'), |
|
| 1127 | - $c->get(IURLGenerator::class), |
|
| 1128 | - $this->get(ICacheFactory::class), |
|
| 1129 | - $this->get(ILogger::class), |
|
| 1130 | - $this->get(ITempManager::class) |
|
| 1131 | - ), |
|
| 1132 | - $c->get(IAppManager::class), |
|
| 1133 | - $c->get(INavigationManager::class) |
|
| 1134 | - ); |
|
| 1135 | - } |
|
| 1136 | - return new \OC_Defaults(); |
|
| 1137 | - }); |
|
| 1138 | - $this->registerService(JSCombiner::class, function (Server $c) { |
|
| 1139 | - return new JSCombiner( |
|
| 1140 | - $c->getAppDataDir('js'), |
|
| 1141 | - $c->get(IURLGenerator::class), |
|
| 1142 | - $this->get(ICacheFactory::class), |
|
| 1143 | - $c->get(SystemConfig::class), |
|
| 1144 | - $c->get(ILogger::class) |
|
| 1145 | - ); |
|
| 1146 | - }); |
|
| 1147 | - $this->registerAlias(\OCP\EventDispatcher\IEventDispatcher::class, \OC\EventDispatcher\EventDispatcher::class); |
|
| 1148 | - /** @deprecated 19.0.0 */ |
|
| 1149 | - $this->registerDeprecatedAlias('EventDispatcher', \OC\EventDispatcher\SymfonyAdapter::class); |
|
| 1150 | - $this->registerAlias(EventDispatcherInterface::class, \OC\EventDispatcher\SymfonyAdapter::class); |
|
| 1151 | - |
|
| 1152 | - $this->registerService('CryptoWrapper', function (ContainerInterface $c) { |
|
| 1153 | - // FIXME: Instantiiated here due to cyclic dependency |
|
| 1154 | - $request = new Request( |
|
| 1155 | - [ |
|
| 1156 | - 'get' => $_GET, |
|
| 1157 | - 'post' => $_POST, |
|
| 1158 | - 'files' => $_FILES, |
|
| 1159 | - 'server' => $_SERVER, |
|
| 1160 | - 'env' => $_ENV, |
|
| 1161 | - 'cookies' => $_COOKIE, |
|
| 1162 | - 'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD'])) |
|
| 1163 | - ? $_SERVER['REQUEST_METHOD'] |
|
| 1164 | - : null, |
|
| 1165 | - ], |
|
| 1166 | - $c->get(ISecureRandom::class), |
|
| 1167 | - $c->get(\OCP\IConfig::class) |
|
| 1168 | - ); |
|
| 1169 | - |
|
| 1170 | - return new CryptoWrapper( |
|
| 1171 | - $c->get(\OCP\IConfig::class), |
|
| 1172 | - $c->get(ICrypto::class), |
|
| 1173 | - $c->get(ISecureRandom::class), |
|
| 1174 | - $request |
|
| 1175 | - ); |
|
| 1176 | - }); |
|
| 1177 | - /** @deprecated 19.0.0 */ |
|
| 1178 | - $this->registerDeprecatedAlias('CsrfTokenManager', CsrfTokenManager::class); |
|
| 1179 | - $this->registerService(SessionStorage::class, function (ContainerInterface $c) { |
|
| 1180 | - return new SessionStorage($c->get(ISession::class)); |
|
| 1181 | - }); |
|
| 1182 | - $this->registerAlias(\OCP\Security\IContentSecurityPolicyManager::class, ContentSecurityPolicyManager::class); |
|
| 1183 | - /** @deprecated 19.0.0 */ |
|
| 1184 | - $this->registerDeprecatedAlias('ContentSecurityPolicyManager', ContentSecurityPolicyManager::class); |
|
| 1185 | - |
|
| 1186 | - $this->registerService(\OCP\Share\IManager::class, function (IServerContainer $c) { |
|
| 1187 | - $config = $c->get(\OCP\IConfig::class); |
|
| 1188 | - $factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class); |
|
| 1189 | - /** @var \OCP\Share\IProviderFactory $factory */ |
|
| 1190 | - $factory = new $factoryClass($this); |
|
| 1191 | - |
|
| 1192 | - $manager = new \OC\Share20\Manager( |
|
| 1193 | - $c->get(ILogger::class), |
|
| 1194 | - $c->get(\OCP\IConfig::class), |
|
| 1195 | - $c->get(ISecureRandom::class), |
|
| 1196 | - $c->get(IHasher::class), |
|
| 1197 | - $c->get(IMountManager::class), |
|
| 1198 | - $c->get(IGroupManager::class), |
|
| 1199 | - $c->getL10N('lib'), |
|
| 1200 | - $c->get(IFactory::class), |
|
| 1201 | - $factory, |
|
| 1202 | - $c->get(IUserManager::class), |
|
| 1203 | - $c->get(IRootFolder::class), |
|
| 1204 | - $c->get(SymfonyAdapter::class), |
|
| 1205 | - $c->get(IMailer::class), |
|
| 1206 | - $c->get(IURLGenerator::class), |
|
| 1207 | - $c->get('ThemingDefaults'), |
|
| 1208 | - $c->get(IEventDispatcher::class) |
|
| 1209 | - ); |
|
| 1210 | - |
|
| 1211 | - return $manager; |
|
| 1212 | - }); |
|
| 1213 | - /** @deprecated 19.0.0 */ |
|
| 1214 | - $this->registerDeprecatedAlias('ShareManager', \OCP\Share\IManager::class); |
|
| 1215 | - |
|
| 1216 | - $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function (Server $c) { |
|
| 1217 | - $instance = new Collaboration\Collaborators\Search($c); |
|
| 1218 | - |
|
| 1219 | - // register default plugins |
|
| 1220 | - $instance->registerPlugin(['shareType' => 'SHARE_TYPE_USER', 'class' => UserPlugin::class]); |
|
| 1221 | - $instance->registerPlugin(['shareType' => 'SHARE_TYPE_GROUP', 'class' => GroupPlugin::class]); |
|
| 1222 | - $instance->registerPlugin(['shareType' => 'SHARE_TYPE_EMAIL', 'class' => MailPlugin::class]); |
|
| 1223 | - $instance->registerPlugin(['shareType' => 'SHARE_TYPE_REMOTE', 'class' => RemotePlugin::class]); |
|
| 1224 | - $instance->registerPlugin(['shareType' => 'SHARE_TYPE_REMOTE_GROUP', 'class' => RemoteGroupPlugin::class]); |
|
| 1225 | - |
|
| 1226 | - return $instance; |
|
| 1227 | - }); |
|
| 1228 | - /** @deprecated 19.0.0 */ |
|
| 1229 | - $this->registerDeprecatedAlias('CollaboratorSearch', \OCP\Collaboration\Collaborators\ISearch::class); |
|
| 1230 | - $this->registerAlias(\OCP\Collaboration\Collaborators\ISearchResult::class, \OC\Collaboration\Collaborators\SearchResult::class); |
|
| 1231 | - |
|
| 1232 | - $this->registerAlias(\OCP\Collaboration\AutoComplete\IManager::class, \OC\Collaboration\AutoComplete\Manager::class); |
|
| 1233 | - |
|
| 1234 | - $this->registerAlias(\OCP\Collaboration\Resources\IProviderManager::class, \OC\Collaboration\Resources\ProviderManager::class); |
|
| 1235 | - $this->registerAlias(\OCP\Collaboration\Resources\IManager::class, \OC\Collaboration\Resources\Manager::class); |
|
| 1236 | - |
|
| 1237 | - $this->registerDeprecatedAlias('SettingsManager', \OC\Settings\Manager::class); |
|
| 1238 | - $this->registerAlias(\OCP\Settings\IManager::class, \OC\Settings\Manager::class); |
|
| 1239 | - $this->registerService(\OC\Files\AppData\Factory::class, function (ContainerInterface $c) { |
|
| 1240 | - return new \OC\Files\AppData\Factory( |
|
| 1241 | - $c->get(IRootFolder::class), |
|
| 1242 | - $c->get(SystemConfig::class) |
|
| 1243 | - ); |
|
| 1244 | - }); |
|
| 1245 | - |
|
| 1246 | - $this->registerService('LockdownManager', function (ContainerInterface $c) { |
|
| 1247 | - return new LockdownManager(function () use ($c) { |
|
| 1248 | - return $c->get(ISession::class); |
|
| 1249 | - }); |
|
| 1250 | - }); |
|
| 1251 | - |
|
| 1252 | - $this->registerService(\OCP\OCS\IDiscoveryService::class, function (ContainerInterface $c) { |
|
| 1253 | - return new DiscoveryService( |
|
| 1254 | - $c->get(ICacheFactory::class), |
|
| 1255 | - $c->get(IClientService::class) |
|
| 1256 | - ); |
|
| 1257 | - }); |
|
| 1258 | - |
|
| 1259 | - $this->registerService(ICloudIdManager::class, function (ContainerInterface $c) { |
|
| 1260 | - return new CloudIdManager($c->get(\OCP\Contacts\IManager::class)); |
|
| 1261 | - }); |
|
| 1262 | - |
|
| 1263 | - $this->registerAlias(\OCP\GlobalScale\IConfig::class, \OC\GlobalScale\Config::class); |
|
| 1264 | - |
|
| 1265 | - $this->registerService(ICloudFederationProviderManager::class, function (ContainerInterface $c) { |
|
| 1266 | - return new CloudFederationProviderManager( |
|
| 1267 | - $c->get(IAppManager::class), |
|
| 1268 | - $c->get(IClientService::class), |
|
| 1269 | - $c->get(ICloudIdManager::class), |
|
| 1270 | - $c->get(ILogger::class) |
|
| 1271 | - ); |
|
| 1272 | - }); |
|
| 1273 | - |
|
| 1274 | - $this->registerService(ICloudFederationFactory::class, function (Server $c) { |
|
| 1275 | - return new CloudFederationFactory(); |
|
| 1276 | - }); |
|
| 1277 | - |
|
| 1278 | - $this->registerAlias(\OCP\AppFramework\Utility\IControllerMethodReflector::class, \OC\AppFramework\Utility\ControllerMethodReflector::class); |
|
| 1279 | - /** @deprecated 19.0.0 */ |
|
| 1280 | - $this->registerDeprecatedAlias('ControllerMethodReflector', \OCP\AppFramework\Utility\IControllerMethodReflector::class); |
|
| 1281 | - |
|
| 1282 | - $this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class); |
|
| 1283 | - /** @deprecated 19.0.0 */ |
|
| 1284 | - $this->registerDeprecatedAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class); |
|
| 1285 | - |
|
| 1286 | - $this->registerService(Defaults::class, function (Server $c) { |
|
| 1287 | - return new Defaults( |
|
| 1288 | - $c->getThemingDefaults() |
|
| 1289 | - ); |
|
| 1290 | - }); |
|
| 1291 | - /** @deprecated 19.0.0 */ |
|
| 1292 | - $this->registerDeprecatedAlias('Defaults', \OCP\Defaults::class); |
|
| 1293 | - |
|
| 1294 | - $this->registerService(\OCP\ISession::class, function (ContainerInterface $c) { |
|
| 1295 | - return $c->get(\OCP\IUserSession::class)->getSession(); |
|
| 1296 | - }, false); |
|
| 1297 | - |
|
| 1298 | - $this->registerService(IShareHelper::class, function (ContainerInterface $c) { |
|
| 1299 | - return new ShareHelper( |
|
| 1300 | - $c->get(\OCP\Share\IManager::class) |
|
| 1301 | - ); |
|
| 1302 | - }); |
|
| 1303 | - |
|
| 1304 | - $this->registerService(Installer::class, function (ContainerInterface $c) { |
|
| 1305 | - return new Installer( |
|
| 1306 | - $c->get(AppFetcher::class), |
|
| 1307 | - $c->get(IClientService::class), |
|
| 1308 | - $c->get(ITempManager::class), |
|
| 1309 | - $c->get(ILogger::class), |
|
| 1310 | - $c->get(\OCP\IConfig::class), |
|
| 1311 | - \OC::$CLI |
|
| 1312 | - ); |
|
| 1313 | - }); |
|
| 1314 | - |
|
| 1315 | - $this->registerService(IApiFactory::class, function (ContainerInterface $c) { |
|
| 1316 | - return new ApiFactory($c->get(IClientService::class)); |
|
| 1317 | - }); |
|
| 1318 | - |
|
| 1319 | - $this->registerService(IInstanceFactory::class, function (ContainerInterface $c) { |
|
| 1320 | - $memcacheFactory = $c->get(ICacheFactory::class); |
|
| 1321 | - return new InstanceFactory($memcacheFactory->createLocal('remoteinstance.'), $c->get(IClientService::class)); |
|
| 1322 | - }); |
|
| 1323 | - |
|
| 1324 | - $this->registerAlias(IContactsStore::class, ContactsStore::class); |
|
| 1325 | - $this->registerAlias(IAccountManager::class, AccountManager::class); |
|
| 1326 | - |
|
| 1327 | - $this->registerAlias(IStorageFactory::class, StorageFactory::class); |
|
| 1328 | - |
|
| 1329 | - $this->registerAlias(IDashboardManager::class, DashboardManager::class); |
|
| 1330 | - $this->registerAlias(\OCP\Dashboard\IManager::class, \OC\Dashboard\Manager::class); |
|
| 1331 | - $this->registerAlias(IFullTextSearchManager::class, FullTextSearchManager::class); |
|
| 1332 | - |
|
| 1333 | - $this->registerAlias(ISubAdmin::class, SubAdmin::class); |
|
| 1334 | - |
|
| 1335 | - $this->registerAlias(IInitialStateService::class, InitialStateService::class); |
|
| 1336 | - |
|
| 1337 | - $this->registerAlias(\OCP\UserStatus\IManager::class, \OC\UserStatus\Manager::class); |
|
| 1338 | - |
|
| 1339 | - $this->connectDispatcher(); |
|
| 1340 | - } |
|
| 1341 | - |
|
| 1342 | - public function boot() { |
|
| 1343 | - /** @var HookConnector $hookConnector */ |
|
| 1344 | - $hookConnector = $this->get(HookConnector::class); |
|
| 1345 | - $hookConnector->viewToNode(); |
|
| 1346 | - } |
|
| 1347 | - |
|
| 1348 | - /** |
|
| 1349 | - * @return \OCP\Calendar\IManager |
|
| 1350 | - * @deprecated 20.0.0 |
|
| 1351 | - */ |
|
| 1352 | - public function getCalendarManager() { |
|
| 1353 | - return $this->get(\OC\Calendar\Manager::class); |
|
| 1354 | - } |
|
| 1355 | - |
|
| 1356 | - /** |
|
| 1357 | - * @return \OCP\Calendar\Resource\IManager |
|
| 1358 | - * @deprecated 20.0.0 |
|
| 1359 | - */ |
|
| 1360 | - public function getCalendarResourceBackendManager() { |
|
| 1361 | - return $this->get(\OC\Calendar\Resource\Manager::class); |
|
| 1362 | - } |
|
| 1363 | - |
|
| 1364 | - /** |
|
| 1365 | - * @return \OCP\Calendar\Room\IManager |
|
| 1366 | - * @deprecated 20.0.0 |
|
| 1367 | - */ |
|
| 1368 | - public function getCalendarRoomBackendManager() { |
|
| 1369 | - return $this->get(\OC\Calendar\Room\Manager::class); |
|
| 1370 | - } |
|
| 1371 | - |
|
| 1372 | - private function connectDispatcher() { |
|
| 1373 | - $dispatcher = $this->get(SymfonyAdapter::class); |
|
| 1374 | - |
|
| 1375 | - // Delete avatar on user deletion |
|
| 1376 | - $dispatcher->addListener('OCP\IUser::preDelete', function (GenericEvent $e) { |
|
| 1377 | - $logger = $this->get(ILogger::class); |
|
| 1378 | - $manager = $this->getAvatarManager(); |
|
| 1379 | - /** @var IUser $user */ |
|
| 1380 | - $user = $e->getSubject(); |
|
| 1381 | - |
|
| 1382 | - try { |
|
| 1383 | - $avatar = $manager->getAvatar($user->getUID()); |
|
| 1384 | - $avatar->remove(); |
|
| 1385 | - } catch (NotFoundException $e) { |
|
| 1386 | - // no avatar to remove |
|
| 1387 | - } catch (\Exception $e) { |
|
| 1388 | - // Ignore exceptions |
|
| 1389 | - $logger->info('Could not cleanup avatar of ' . $user->getUID()); |
|
| 1390 | - } |
|
| 1391 | - }); |
|
| 1392 | - |
|
| 1393 | - $dispatcher->addListener('OCP\IUser::changeUser', function (GenericEvent $e) { |
|
| 1394 | - $manager = $this->getAvatarManager(); |
|
| 1395 | - /** @var IUser $user */ |
|
| 1396 | - $user = $e->getSubject(); |
|
| 1397 | - $feature = $e->getArgument('feature'); |
|
| 1398 | - $oldValue = $e->getArgument('oldValue'); |
|
| 1399 | - $value = $e->getArgument('value'); |
|
| 1400 | - |
|
| 1401 | - // We only change the avatar on display name changes |
|
| 1402 | - if ($feature !== 'displayName') { |
|
| 1403 | - return; |
|
| 1404 | - } |
|
| 1405 | - |
|
| 1406 | - try { |
|
| 1407 | - $avatar = $manager->getAvatar($user->getUID()); |
|
| 1408 | - $avatar->userChanged($feature, $oldValue, $value); |
|
| 1409 | - } catch (NotFoundException $e) { |
|
| 1410 | - // no avatar to remove |
|
| 1411 | - } |
|
| 1412 | - }); |
|
| 1413 | - |
|
| 1414 | - /** @var IEventDispatcher $eventDispatched */ |
|
| 1415 | - $eventDispatched = $this->get(IEventDispatcher::class); |
|
| 1416 | - $eventDispatched->addServiceListener(LoginFailed::class, LoginFailedListener::class); |
|
| 1417 | - $eventDispatched->addServiceListener(PostLoginEvent::class, UserLoggedInListener::class); |
|
| 1418 | - } |
|
| 1419 | - |
|
| 1420 | - /** |
|
| 1421 | - * @return \OCP\Contacts\IManager |
|
| 1422 | - * @deprecated 20.0.0 |
|
| 1423 | - */ |
|
| 1424 | - public function getContactsManager() { |
|
| 1425 | - return $this->get(\OCP\Contacts\IManager::class); |
|
| 1426 | - } |
|
| 1427 | - |
|
| 1428 | - /** |
|
| 1429 | - * @return \OC\Encryption\Manager |
|
| 1430 | - * @deprecated 20.0.0 |
|
| 1431 | - */ |
|
| 1432 | - public function getEncryptionManager() { |
|
| 1433 | - return $this->get(\OCP\Encryption\IManager::class); |
|
| 1434 | - } |
|
| 1435 | - |
|
| 1436 | - /** |
|
| 1437 | - * @return \OC\Encryption\File |
|
| 1438 | - * @deprecated 20.0.0 |
|
| 1439 | - */ |
|
| 1440 | - public function getEncryptionFilesHelper() { |
|
| 1441 | - return $this->get(IFile::class); |
|
| 1442 | - } |
|
| 1443 | - |
|
| 1444 | - /** |
|
| 1445 | - * @return \OCP\Encryption\Keys\IStorage |
|
| 1446 | - * @deprecated 20.0.0 |
|
| 1447 | - */ |
|
| 1448 | - public function getEncryptionKeyStorage() { |
|
| 1449 | - return $this->get(IStorage::class); |
|
| 1450 | - } |
|
| 1451 | - |
|
| 1452 | - /** |
|
| 1453 | - * The current request object holding all information about the request |
|
| 1454 | - * currently being processed is returned from this method. |
|
| 1455 | - * In case the current execution was not initiated by a web request null is returned |
|
| 1456 | - * |
|
| 1457 | - * @return \OCP\IRequest |
|
| 1458 | - * @deprecated 20.0.0 |
|
| 1459 | - */ |
|
| 1460 | - public function getRequest() { |
|
| 1461 | - return $this->get(IRequest::class); |
|
| 1462 | - } |
|
| 1463 | - |
|
| 1464 | - /** |
|
| 1465 | - * Returns the preview manager which can create preview images for a given file |
|
| 1466 | - * |
|
| 1467 | - * @return IPreview |
|
| 1468 | - * @deprecated 20.0.0 |
|
| 1469 | - */ |
|
| 1470 | - public function getPreviewManager() { |
|
| 1471 | - return $this->get(IPreview::class); |
|
| 1472 | - } |
|
| 1473 | - |
|
| 1474 | - /** |
|
| 1475 | - * Returns the tag manager which can get and set tags for different object types |
|
| 1476 | - * |
|
| 1477 | - * @see \OCP\ITagManager::load() |
|
| 1478 | - * @return ITagManager |
|
| 1479 | - * @deprecated 20.0.0 |
|
| 1480 | - */ |
|
| 1481 | - public function getTagManager() { |
|
| 1482 | - return $this->get(ITagManager::class); |
|
| 1483 | - } |
|
| 1484 | - |
|
| 1485 | - /** |
|
| 1486 | - * Returns the system-tag manager |
|
| 1487 | - * |
|
| 1488 | - * @return ISystemTagManager |
|
| 1489 | - * |
|
| 1490 | - * @since 9.0.0 |
|
| 1491 | - * @deprecated 20.0.0 |
|
| 1492 | - */ |
|
| 1493 | - public function getSystemTagManager() { |
|
| 1494 | - return $this->get(ISystemTagManager::class); |
|
| 1495 | - } |
|
| 1496 | - |
|
| 1497 | - /** |
|
| 1498 | - * Returns the system-tag object mapper |
|
| 1499 | - * |
|
| 1500 | - * @return ISystemTagObjectMapper |
|
| 1501 | - * |
|
| 1502 | - * @since 9.0.0 |
|
| 1503 | - * @deprecated 20.0.0 |
|
| 1504 | - */ |
|
| 1505 | - public function getSystemTagObjectMapper() { |
|
| 1506 | - return $this->get(ISystemTagObjectMapper::class); |
|
| 1507 | - } |
|
| 1508 | - |
|
| 1509 | - /** |
|
| 1510 | - * Returns the avatar manager, used for avatar functionality |
|
| 1511 | - * |
|
| 1512 | - * @return IAvatarManager |
|
| 1513 | - * @deprecated 20.0.0 |
|
| 1514 | - */ |
|
| 1515 | - public function getAvatarManager() { |
|
| 1516 | - return $this->get(IAvatarManager::class); |
|
| 1517 | - } |
|
| 1518 | - |
|
| 1519 | - /** |
|
| 1520 | - * Returns the root folder of ownCloud's data directory |
|
| 1521 | - * |
|
| 1522 | - * @return IRootFolder |
|
| 1523 | - * @deprecated 20.0.0 |
|
| 1524 | - */ |
|
| 1525 | - public function getRootFolder() { |
|
| 1526 | - return $this->get(IRootFolder::class); |
|
| 1527 | - } |
|
| 1528 | - |
|
| 1529 | - /** |
|
| 1530 | - * Returns the root folder of ownCloud's data directory |
|
| 1531 | - * This is the lazy variant so this gets only initialized once it |
|
| 1532 | - * is actually used. |
|
| 1533 | - * |
|
| 1534 | - * @return IRootFolder |
|
| 1535 | - * @deprecated 20.0.0 |
|
| 1536 | - */ |
|
| 1537 | - public function getLazyRootFolder() { |
|
| 1538 | - return $this->get(IRootFolder::class); |
|
| 1539 | - } |
|
| 1540 | - |
|
| 1541 | - /** |
|
| 1542 | - * Returns a view to ownCloud's files folder |
|
| 1543 | - * |
|
| 1544 | - * @param string $userId user ID |
|
| 1545 | - * @return \OCP\Files\Folder|null |
|
| 1546 | - * @deprecated 20.0.0 |
|
| 1547 | - */ |
|
| 1548 | - public function getUserFolder($userId = null) { |
|
| 1549 | - if ($userId === null) { |
|
| 1550 | - $user = $this->get(IUserSession::class)->getUser(); |
|
| 1551 | - if (!$user) { |
|
| 1552 | - return null; |
|
| 1553 | - } |
|
| 1554 | - $userId = $user->getUID(); |
|
| 1555 | - } |
|
| 1556 | - $root = $this->get(IRootFolder::class); |
|
| 1557 | - return $root->getUserFolder($userId); |
|
| 1558 | - } |
|
| 1559 | - |
|
| 1560 | - /** |
|
| 1561 | - * @return \OC\User\Manager |
|
| 1562 | - * @deprecated 20.0.0 |
|
| 1563 | - */ |
|
| 1564 | - public function getUserManager() { |
|
| 1565 | - return $this->get(IUserManager::class); |
|
| 1566 | - } |
|
| 1567 | - |
|
| 1568 | - /** |
|
| 1569 | - * @return \OC\Group\Manager |
|
| 1570 | - * @deprecated 20.0.0 |
|
| 1571 | - */ |
|
| 1572 | - public function getGroupManager() { |
|
| 1573 | - return $this->get(IGroupManager::class); |
|
| 1574 | - } |
|
| 1575 | - |
|
| 1576 | - /** |
|
| 1577 | - * @return \OC\User\Session |
|
| 1578 | - * @deprecated 20.0.0 |
|
| 1579 | - */ |
|
| 1580 | - public function getUserSession() { |
|
| 1581 | - return $this->get(IUserSession::class); |
|
| 1582 | - } |
|
| 1583 | - |
|
| 1584 | - /** |
|
| 1585 | - * @return \OCP\ISession |
|
| 1586 | - * @deprecated 20.0.0 |
|
| 1587 | - */ |
|
| 1588 | - public function getSession() { |
|
| 1589 | - return $this->get(IUserSession::class)->getSession(); |
|
| 1590 | - } |
|
| 1591 | - |
|
| 1592 | - /** |
|
| 1593 | - * @param \OCP\ISession $session |
|
| 1594 | - */ |
|
| 1595 | - public function setSession(\OCP\ISession $session) { |
|
| 1596 | - $this->get(SessionStorage::class)->setSession($session); |
|
| 1597 | - $this->get(IUserSession::class)->setSession($session); |
|
| 1598 | - $this->get(Store::class)->setSession($session); |
|
| 1599 | - } |
|
| 1600 | - |
|
| 1601 | - /** |
|
| 1602 | - * @return \OC\Authentication\TwoFactorAuth\Manager |
|
| 1603 | - * @deprecated 20.0.0 |
|
| 1604 | - */ |
|
| 1605 | - public function getTwoFactorAuthManager() { |
|
| 1606 | - return $this->get(\OC\Authentication\TwoFactorAuth\Manager::class); |
|
| 1607 | - } |
|
| 1608 | - |
|
| 1609 | - /** |
|
| 1610 | - * @return \OC\NavigationManager |
|
| 1611 | - * @deprecated 20.0.0 |
|
| 1612 | - */ |
|
| 1613 | - public function getNavigationManager() { |
|
| 1614 | - return $this->get(INavigationManager::class); |
|
| 1615 | - } |
|
| 1616 | - |
|
| 1617 | - /** |
|
| 1618 | - * @return \OCP\IConfig |
|
| 1619 | - * @deprecated 20.0.0 |
|
| 1620 | - */ |
|
| 1621 | - public function getConfig() { |
|
| 1622 | - return $this->get(AllConfig::class); |
|
| 1623 | - } |
|
| 1624 | - |
|
| 1625 | - /** |
|
| 1626 | - * @return \OC\SystemConfig |
|
| 1627 | - * @deprecated 20.0.0 |
|
| 1628 | - */ |
|
| 1629 | - public function getSystemConfig() { |
|
| 1630 | - return $this->get(SystemConfig::class); |
|
| 1631 | - } |
|
| 1632 | - |
|
| 1633 | - /** |
|
| 1634 | - * Returns the app config manager |
|
| 1635 | - * |
|
| 1636 | - * @return IAppConfig |
|
| 1637 | - * @deprecated 20.0.0 |
|
| 1638 | - */ |
|
| 1639 | - public function getAppConfig() { |
|
| 1640 | - return $this->get(IAppConfig::class); |
|
| 1641 | - } |
|
| 1642 | - |
|
| 1643 | - /** |
|
| 1644 | - * @return IFactory |
|
| 1645 | - * @deprecated 20.0.0 |
|
| 1646 | - */ |
|
| 1647 | - public function getL10NFactory() { |
|
| 1648 | - return $this->get(IFactory::class); |
|
| 1649 | - } |
|
| 1650 | - |
|
| 1651 | - /** |
|
| 1652 | - * get an L10N instance |
|
| 1653 | - * |
|
| 1654 | - * @param string $app appid |
|
| 1655 | - * @param string $lang |
|
| 1656 | - * @return IL10N |
|
| 1657 | - * @deprecated 20.0.0 |
|
| 1658 | - */ |
|
| 1659 | - public function getL10N($app, $lang = null) { |
|
| 1660 | - return $this->get(IFactory::class)->get($app, $lang); |
|
| 1661 | - } |
|
| 1662 | - |
|
| 1663 | - /** |
|
| 1664 | - * @return IURLGenerator |
|
| 1665 | - * @deprecated 20.0.0 |
|
| 1666 | - */ |
|
| 1667 | - public function getURLGenerator() { |
|
| 1668 | - return $this->get(IURLGenerator::class); |
|
| 1669 | - } |
|
| 1670 | - |
|
| 1671 | - /** |
|
| 1672 | - * @return AppFetcher |
|
| 1673 | - * @deprecated 20.0.0 |
|
| 1674 | - */ |
|
| 1675 | - public function getAppFetcher() { |
|
| 1676 | - return $this->get(AppFetcher::class); |
|
| 1677 | - } |
|
| 1678 | - |
|
| 1679 | - /** |
|
| 1680 | - * Returns an ICache instance. Since 8.1.0 it returns a fake cache. Use |
|
| 1681 | - * getMemCacheFactory() instead. |
|
| 1682 | - * |
|
| 1683 | - * @return ICache |
|
| 1684 | - * @deprecated 8.1.0 use getMemCacheFactory to obtain a proper cache |
|
| 1685 | - */ |
|
| 1686 | - public function getCache() { |
|
| 1687 | - return $this->get(ICache::class); |
|
| 1688 | - } |
|
| 1689 | - |
|
| 1690 | - /** |
|
| 1691 | - * Returns an \OCP\CacheFactory instance |
|
| 1692 | - * |
|
| 1693 | - * @return \OCP\ICacheFactory |
|
| 1694 | - * @deprecated 20.0.0 |
|
| 1695 | - */ |
|
| 1696 | - public function getMemCacheFactory() { |
|
| 1697 | - return $this->get(ICacheFactory::class); |
|
| 1698 | - } |
|
| 1699 | - |
|
| 1700 | - /** |
|
| 1701 | - * Returns an \OC\RedisFactory instance |
|
| 1702 | - * |
|
| 1703 | - * @return \OC\RedisFactory |
|
| 1704 | - * @deprecated 20.0.0 |
|
| 1705 | - */ |
|
| 1706 | - public function getGetRedisFactory() { |
|
| 1707 | - return $this->get('RedisFactory'); |
|
| 1708 | - } |
|
| 1709 | - |
|
| 1710 | - |
|
| 1711 | - /** |
|
| 1712 | - * Returns the current session |
|
| 1713 | - * |
|
| 1714 | - * @return \OCP\IDBConnection |
|
| 1715 | - * @deprecated 20.0.0 |
|
| 1716 | - */ |
|
| 1717 | - public function getDatabaseConnection() { |
|
| 1718 | - return $this->get(IDBConnection::class); |
|
| 1719 | - } |
|
| 1720 | - |
|
| 1721 | - /** |
|
| 1722 | - * Returns the activity manager |
|
| 1723 | - * |
|
| 1724 | - * @return \OCP\Activity\IManager |
|
| 1725 | - * @deprecated 20.0.0 |
|
| 1726 | - */ |
|
| 1727 | - public function getActivityManager() { |
|
| 1728 | - return $this->get(\OCP\Activity\IManager::class); |
|
| 1729 | - } |
|
| 1730 | - |
|
| 1731 | - /** |
|
| 1732 | - * Returns an job list for controlling background jobs |
|
| 1733 | - * |
|
| 1734 | - * @return IJobList |
|
| 1735 | - * @deprecated 20.0.0 |
|
| 1736 | - */ |
|
| 1737 | - public function getJobList() { |
|
| 1738 | - return $this->get(IJobList::class); |
|
| 1739 | - } |
|
| 1740 | - |
|
| 1741 | - /** |
|
| 1742 | - * Returns a logger instance |
|
| 1743 | - * |
|
| 1744 | - * @return ILogger |
|
| 1745 | - * @deprecated 20.0.0 |
|
| 1746 | - */ |
|
| 1747 | - public function getLogger() { |
|
| 1748 | - return $this->get(ILogger::class); |
|
| 1749 | - } |
|
| 1750 | - |
|
| 1751 | - /** |
|
| 1752 | - * @return ILogFactory |
|
| 1753 | - * @throws \OCP\AppFramework\QueryException |
|
| 1754 | - * @deprecated 20.0.0 |
|
| 1755 | - */ |
|
| 1756 | - public function getLogFactory() { |
|
| 1757 | - return $this->get(ILogFactory::class); |
|
| 1758 | - } |
|
| 1759 | - |
|
| 1760 | - /** |
|
| 1761 | - * Returns a router for generating and matching urls |
|
| 1762 | - * |
|
| 1763 | - * @return IRouter |
|
| 1764 | - * @deprecated 20.0.0 |
|
| 1765 | - */ |
|
| 1766 | - public function getRouter() { |
|
| 1767 | - return $this->get(IRouter::class); |
|
| 1768 | - } |
|
| 1769 | - |
|
| 1770 | - /** |
|
| 1771 | - * Returns a search instance |
|
| 1772 | - * |
|
| 1773 | - * @return ISearch |
|
| 1774 | - * @deprecated 20.0.0 |
|
| 1775 | - */ |
|
| 1776 | - public function getSearch() { |
|
| 1777 | - return $this->get(ISearch::class); |
|
| 1778 | - } |
|
| 1779 | - |
|
| 1780 | - /** |
|
| 1781 | - * Returns a SecureRandom instance |
|
| 1782 | - * |
|
| 1783 | - * @return \OCP\Security\ISecureRandom |
|
| 1784 | - * @deprecated 20.0.0 |
|
| 1785 | - */ |
|
| 1786 | - public function getSecureRandom() { |
|
| 1787 | - return $this->get(ISecureRandom::class); |
|
| 1788 | - } |
|
| 1789 | - |
|
| 1790 | - /** |
|
| 1791 | - * Returns a Crypto instance |
|
| 1792 | - * |
|
| 1793 | - * @return ICrypto |
|
| 1794 | - * @deprecated 20.0.0 |
|
| 1795 | - */ |
|
| 1796 | - public function getCrypto() { |
|
| 1797 | - return $this->get(ICrypto::class); |
|
| 1798 | - } |
|
| 1799 | - |
|
| 1800 | - /** |
|
| 1801 | - * Returns a Hasher instance |
|
| 1802 | - * |
|
| 1803 | - * @return IHasher |
|
| 1804 | - * @deprecated 20.0.0 |
|
| 1805 | - */ |
|
| 1806 | - public function getHasher() { |
|
| 1807 | - return $this->get(IHasher::class); |
|
| 1808 | - } |
|
| 1809 | - |
|
| 1810 | - /** |
|
| 1811 | - * Returns a CredentialsManager instance |
|
| 1812 | - * |
|
| 1813 | - * @return ICredentialsManager |
|
| 1814 | - * @deprecated 20.0.0 |
|
| 1815 | - */ |
|
| 1816 | - public function getCredentialsManager() { |
|
| 1817 | - return $this->get(ICredentialsManager::class); |
|
| 1818 | - } |
|
| 1819 | - |
|
| 1820 | - /** |
|
| 1821 | - * Get the certificate manager |
|
| 1822 | - * |
|
| 1823 | - * @return \OCP\ICertificateManager |
|
| 1824 | - */ |
|
| 1825 | - public function getCertificateManager() { |
|
| 1826 | - return $this->get(ICertificateManager::class); |
|
| 1827 | - } |
|
| 1828 | - |
|
| 1829 | - /** |
|
| 1830 | - * Returns an instance of the HTTP client service |
|
| 1831 | - * |
|
| 1832 | - * @return IClientService |
|
| 1833 | - * @deprecated 20.0.0 |
|
| 1834 | - */ |
|
| 1835 | - public function getHTTPClientService() { |
|
| 1836 | - return $this->get(IClientService::class); |
|
| 1837 | - } |
|
| 1838 | - |
|
| 1839 | - /** |
|
| 1840 | - * Create a new event source |
|
| 1841 | - * |
|
| 1842 | - * @return \OCP\IEventSource |
|
| 1843 | - * @deprecated 20.0.0 |
|
| 1844 | - */ |
|
| 1845 | - public function createEventSource() { |
|
| 1846 | - return new \OC_EventSource(); |
|
| 1847 | - } |
|
| 1848 | - |
|
| 1849 | - /** |
|
| 1850 | - * Get the active event logger |
|
| 1851 | - * |
|
| 1852 | - * The returned logger only logs data when debug mode is enabled |
|
| 1853 | - * |
|
| 1854 | - * @return IEventLogger |
|
| 1855 | - * @deprecated 20.0.0 |
|
| 1856 | - */ |
|
| 1857 | - public function getEventLogger() { |
|
| 1858 | - return $this->get(IEventLogger::class); |
|
| 1859 | - } |
|
| 1860 | - |
|
| 1861 | - /** |
|
| 1862 | - * Get the active query logger |
|
| 1863 | - * |
|
| 1864 | - * The returned logger only logs data when debug mode is enabled |
|
| 1865 | - * |
|
| 1866 | - * @return IQueryLogger |
|
| 1867 | - * @deprecated 20.0.0 |
|
| 1868 | - */ |
|
| 1869 | - public function getQueryLogger() { |
|
| 1870 | - return $this->get(IQueryLogger::class); |
|
| 1871 | - } |
|
| 1872 | - |
|
| 1873 | - /** |
|
| 1874 | - * Get the manager for temporary files and folders |
|
| 1875 | - * |
|
| 1876 | - * @return \OCP\ITempManager |
|
| 1877 | - * @deprecated 20.0.0 |
|
| 1878 | - */ |
|
| 1879 | - public function getTempManager() { |
|
| 1880 | - return $this->get(ITempManager::class); |
|
| 1881 | - } |
|
| 1882 | - |
|
| 1883 | - /** |
|
| 1884 | - * Get the app manager |
|
| 1885 | - * |
|
| 1886 | - * @return \OCP\App\IAppManager |
|
| 1887 | - * @deprecated 20.0.0 |
|
| 1888 | - */ |
|
| 1889 | - public function getAppManager() { |
|
| 1890 | - return $this->get(IAppManager::class); |
|
| 1891 | - } |
|
| 1892 | - |
|
| 1893 | - /** |
|
| 1894 | - * Creates a new mailer |
|
| 1895 | - * |
|
| 1896 | - * @return IMailer |
|
| 1897 | - * @deprecated 20.0.0 |
|
| 1898 | - */ |
|
| 1899 | - public function getMailer() { |
|
| 1900 | - return $this->get(IMailer::class); |
|
| 1901 | - } |
|
| 1902 | - |
|
| 1903 | - /** |
|
| 1904 | - * Get the webroot |
|
| 1905 | - * |
|
| 1906 | - * @return string |
|
| 1907 | - * @deprecated 20.0.0 |
|
| 1908 | - */ |
|
| 1909 | - public function getWebRoot() { |
|
| 1910 | - return $this->webRoot; |
|
| 1911 | - } |
|
| 1912 | - |
|
| 1913 | - /** |
|
| 1914 | - * @return \OC\OCSClient |
|
| 1915 | - * @deprecated 20.0.0 |
|
| 1916 | - */ |
|
| 1917 | - public function getOcsClient() { |
|
| 1918 | - return $this->get('OcsClient'); |
|
| 1919 | - } |
|
| 1920 | - |
|
| 1921 | - /** |
|
| 1922 | - * @return IDateTimeZone |
|
| 1923 | - * @deprecated 20.0.0 |
|
| 1924 | - */ |
|
| 1925 | - public function getDateTimeZone() { |
|
| 1926 | - return $this->get(IDateTimeZone::class); |
|
| 1927 | - } |
|
| 1928 | - |
|
| 1929 | - /** |
|
| 1930 | - * @return IDateTimeFormatter |
|
| 1931 | - * @deprecated 20.0.0 |
|
| 1932 | - */ |
|
| 1933 | - public function getDateTimeFormatter() { |
|
| 1934 | - return $this->get(IDateTimeFormatter::class); |
|
| 1935 | - } |
|
| 1936 | - |
|
| 1937 | - /** |
|
| 1938 | - * @return IMountProviderCollection |
|
| 1939 | - * @deprecated 20.0.0 |
|
| 1940 | - */ |
|
| 1941 | - public function getMountProviderCollection() { |
|
| 1942 | - return $this->get(IMountProviderCollection::class); |
|
| 1943 | - } |
|
| 1944 | - |
|
| 1945 | - /** |
|
| 1946 | - * Get the IniWrapper |
|
| 1947 | - * |
|
| 1948 | - * @return IniGetWrapper |
|
| 1949 | - * @deprecated 20.0.0 |
|
| 1950 | - */ |
|
| 1951 | - public function getIniWrapper() { |
|
| 1952 | - return $this->get(IniGetWrapper::class); |
|
| 1953 | - } |
|
| 1954 | - |
|
| 1955 | - /** |
|
| 1956 | - * @return \OCP\Command\IBus |
|
| 1957 | - * @deprecated 20.0.0 |
|
| 1958 | - */ |
|
| 1959 | - public function getCommandBus() { |
|
| 1960 | - return $this->get(IBus::class); |
|
| 1961 | - } |
|
| 1962 | - |
|
| 1963 | - /** |
|
| 1964 | - * Get the trusted domain helper |
|
| 1965 | - * |
|
| 1966 | - * @return TrustedDomainHelper |
|
| 1967 | - * @deprecated 20.0.0 |
|
| 1968 | - */ |
|
| 1969 | - public function getTrustedDomainHelper() { |
|
| 1970 | - return $this->get(TrustedDomainHelper::class); |
|
| 1971 | - } |
|
| 1972 | - |
|
| 1973 | - /** |
|
| 1974 | - * Get the locking provider |
|
| 1975 | - * |
|
| 1976 | - * @return ILockingProvider |
|
| 1977 | - * @since 8.1.0 |
|
| 1978 | - * @deprecated 20.0.0 |
|
| 1979 | - */ |
|
| 1980 | - public function getLockingProvider() { |
|
| 1981 | - return $this->get(ILockingProvider::class); |
|
| 1982 | - } |
|
| 1983 | - |
|
| 1984 | - /** |
|
| 1985 | - * @return IMountManager |
|
| 1986 | - * @deprecated 20.0.0 |
|
| 1987 | - **/ |
|
| 1988 | - public function getMountManager() { |
|
| 1989 | - return $this->get(IMountManager::class); |
|
| 1990 | - } |
|
| 1991 | - |
|
| 1992 | - /** |
|
| 1993 | - * @return IUserMountCache |
|
| 1994 | - * @deprecated 20.0.0 |
|
| 1995 | - */ |
|
| 1996 | - public function getUserMountCache() { |
|
| 1997 | - return $this->get(IUserMountCache::class); |
|
| 1998 | - } |
|
| 1999 | - |
|
| 2000 | - /** |
|
| 2001 | - * Get the MimeTypeDetector |
|
| 2002 | - * |
|
| 2003 | - * @return IMimeTypeDetector |
|
| 2004 | - * @deprecated 20.0.0 |
|
| 2005 | - */ |
|
| 2006 | - public function getMimeTypeDetector() { |
|
| 2007 | - return $this->get(IMimeTypeDetector::class); |
|
| 2008 | - } |
|
| 2009 | - |
|
| 2010 | - /** |
|
| 2011 | - * Get the MimeTypeLoader |
|
| 2012 | - * |
|
| 2013 | - * @return IMimeTypeLoader |
|
| 2014 | - * @deprecated 20.0.0 |
|
| 2015 | - */ |
|
| 2016 | - public function getMimeTypeLoader() { |
|
| 2017 | - return $this->get(IMimeTypeLoader::class); |
|
| 2018 | - } |
|
| 2019 | - |
|
| 2020 | - /** |
|
| 2021 | - * Get the manager of all the capabilities |
|
| 2022 | - * |
|
| 2023 | - * @return CapabilitiesManager |
|
| 2024 | - * @deprecated 20.0.0 |
|
| 2025 | - */ |
|
| 2026 | - public function getCapabilitiesManager() { |
|
| 2027 | - return $this->get(CapabilitiesManager::class); |
|
| 2028 | - } |
|
| 2029 | - |
|
| 2030 | - /** |
|
| 2031 | - * Get the EventDispatcher |
|
| 2032 | - * |
|
| 2033 | - * @return EventDispatcherInterface |
|
| 2034 | - * @since 8.2.0 |
|
| 2035 | - * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher |
|
| 2036 | - */ |
|
| 2037 | - public function getEventDispatcher() { |
|
| 2038 | - return $this->get(\OC\EventDispatcher\SymfonyAdapter::class); |
|
| 2039 | - } |
|
| 2040 | - |
|
| 2041 | - /** |
|
| 2042 | - * Get the Notification Manager |
|
| 2043 | - * |
|
| 2044 | - * @return \OCP\Notification\IManager |
|
| 2045 | - * @since 8.2.0 |
|
| 2046 | - * @deprecated 20.0.0 |
|
| 2047 | - */ |
|
| 2048 | - public function getNotificationManager() { |
|
| 2049 | - return $this->get(\OCP\Notification\IManager::class); |
|
| 2050 | - } |
|
| 2051 | - |
|
| 2052 | - /** |
|
| 2053 | - * @return ICommentsManager |
|
| 2054 | - * @deprecated 20.0.0 |
|
| 2055 | - */ |
|
| 2056 | - public function getCommentsManager() { |
|
| 2057 | - return $this->get(ICommentsManager::class); |
|
| 2058 | - } |
|
| 2059 | - |
|
| 2060 | - /** |
|
| 2061 | - * @return \OCA\Theming\ThemingDefaults |
|
| 2062 | - * @deprecated 20.0.0 |
|
| 2063 | - */ |
|
| 2064 | - public function getThemingDefaults() { |
|
| 2065 | - return $this->get('ThemingDefaults'); |
|
| 2066 | - } |
|
| 2067 | - |
|
| 2068 | - /** |
|
| 2069 | - * @return \OC\IntegrityCheck\Checker |
|
| 2070 | - * @deprecated 20.0.0 |
|
| 2071 | - */ |
|
| 2072 | - public function getIntegrityCodeChecker() { |
|
| 2073 | - return $this->get('IntegrityCodeChecker'); |
|
| 2074 | - } |
|
| 2075 | - |
|
| 2076 | - /** |
|
| 2077 | - * @return \OC\Session\CryptoWrapper |
|
| 2078 | - * @deprecated 20.0.0 |
|
| 2079 | - */ |
|
| 2080 | - public function getSessionCryptoWrapper() { |
|
| 2081 | - return $this->get('CryptoWrapper'); |
|
| 2082 | - } |
|
| 2083 | - |
|
| 2084 | - /** |
|
| 2085 | - * @return CsrfTokenManager |
|
| 2086 | - * @deprecated 20.0.0 |
|
| 2087 | - */ |
|
| 2088 | - public function getCsrfTokenManager() { |
|
| 2089 | - return $this->get(CsrfTokenManager::class); |
|
| 2090 | - } |
|
| 2091 | - |
|
| 2092 | - /** |
|
| 2093 | - * @return Throttler |
|
| 2094 | - * @deprecated 20.0.0 |
|
| 2095 | - */ |
|
| 2096 | - public function getBruteForceThrottler() { |
|
| 2097 | - return $this->get(Throttler::class); |
|
| 2098 | - } |
|
| 2099 | - |
|
| 2100 | - /** |
|
| 2101 | - * @return IContentSecurityPolicyManager |
|
| 2102 | - * @deprecated 20.0.0 |
|
| 2103 | - */ |
|
| 2104 | - public function getContentSecurityPolicyManager() { |
|
| 2105 | - return $this->get(ContentSecurityPolicyManager::class); |
|
| 2106 | - } |
|
| 2107 | - |
|
| 2108 | - /** |
|
| 2109 | - * @return ContentSecurityPolicyNonceManager |
|
| 2110 | - * @deprecated 20.0.0 |
|
| 2111 | - */ |
|
| 2112 | - public function getContentSecurityPolicyNonceManager() { |
|
| 2113 | - return $this->get(ContentSecurityPolicyNonceManager::class); |
|
| 2114 | - } |
|
| 2115 | - |
|
| 2116 | - /** |
|
| 2117 | - * Not a public API as of 8.2, wait for 9.0 |
|
| 2118 | - * |
|
| 2119 | - * @return \OCA\Files_External\Service\BackendService |
|
| 2120 | - * @deprecated 20.0.0 |
|
| 2121 | - */ |
|
| 2122 | - public function getStoragesBackendService() { |
|
| 2123 | - return $this->get(BackendService::class); |
|
| 2124 | - } |
|
| 2125 | - |
|
| 2126 | - /** |
|
| 2127 | - * Not a public API as of 8.2, wait for 9.0 |
|
| 2128 | - * |
|
| 2129 | - * @return \OCA\Files_External\Service\GlobalStoragesService |
|
| 2130 | - * @deprecated 20.0.0 |
|
| 2131 | - */ |
|
| 2132 | - public function getGlobalStoragesService() { |
|
| 2133 | - return $this->get(GlobalStoragesService::class); |
|
| 2134 | - } |
|
| 2135 | - |
|
| 2136 | - /** |
|
| 2137 | - * Not a public API as of 8.2, wait for 9.0 |
|
| 2138 | - * |
|
| 2139 | - * @return \OCA\Files_External\Service\UserGlobalStoragesService |
|
| 2140 | - * @deprecated 20.0.0 |
|
| 2141 | - */ |
|
| 2142 | - public function getUserGlobalStoragesService() { |
|
| 2143 | - return $this->get(UserGlobalStoragesService::class); |
|
| 2144 | - } |
|
| 2145 | - |
|
| 2146 | - /** |
|
| 2147 | - * Not a public API as of 8.2, wait for 9.0 |
|
| 2148 | - * |
|
| 2149 | - * @return \OCA\Files_External\Service\UserStoragesService |
|
| 2150 | - * @deprecated 20.0.0 |
|
| 2151 | - */ |
|
| 2152 | - public function getUserStoragesService() { |
|
| 2153 | - return $this->get(UserStoragesService::class); |
|
| 2154 | - } |
|
| 2155 | - |
|
| 2156 | - /** |
|
| 2157 | - * @return \OCP\Share\IManager |
|
| 2158 | - * @deprecated 20.0.0 |
|
| 2159 | - */ |
|
| 2160 | - public function getShareManager() { |
|
| 2161 | - return $this->get(\OCP\Share\IManager::class); |
|
| 2162 | - } |
|
| 2163 | - |
|
| 2164 | - /** |
|
| 2165 | - * @return \OCP\Collaboration\Collaborators\ISearch |
|
| 2166 | - * @deprecated 20.0.0 |
|
| 2167 | - */ |
|
| 2168 | - public function getCollaboratorSearch() { |
|
| 2169 | - return $this->get(\OCP\Collaboration\Collaborators\ISearch::class); |
|
| 2170 | - } |
|
| 2171 | - |
|
| 2172 | - /** |
|
| 2173 | - * @return \OCP\Collaboration\AutoComplete\IManager |
|
| 2174 | - * @deprecated 20.0.0 |
|
| 2175 | - */ |
|
| 2176 | - public function getAutoCompleteManager() { |
|
| 2177 | - return $this->get(IManager::class); |
|
| 2178 | - } |
|
| 2179 | - |
|
| 2180 | - /** |
|
| 2181 | - * Returns the LDAP Provider |
|
| 2182 | - * |
|
| 2183 | - * @return \OCP\LDAP\ILDAPProvider |
|
| 2184 | - * @deprecated 20.0.0 |
|
| 2185 | - */ |
|
| 2186 | - public function getLDAPProvider() { |
|
| 2187 | - return $this->get('LDAPProvider'); |
|
| 2188 | - } |
|
| 2189 | - |
|
| 2190 | - /** |
|
| 2191 | - * @return \OCP\Settings\IManager |
|
| 2192 | - * @deprecated 20.0.0 |
|
| 2193 | - */ |
|
| 2194 | - public function getSettingsManager() { |
|
| 2195 | - return $this->get(\OC\Settings\Manager::class); |
|
| 2196 | - } |
|
| 2197 | - |
|
| 2198 | - /** |
|
| 2199 | - * @return \OCP\Files\IAppData |
|
| 2200 | - * @deprecated 20.0.0 |
|
| 2201 | - */ |
|
| 2202 | - public function getAppDataDir($app) { |
|
| 2203 | - /** @var \OC\Files\AppData\Factory $factory */ |
|
| 2204 | - $factory = $this->get(\OC\Files\AppData\Factory::class); |
|
| 2205 | - return $factory->get($app); |
|
| 2206 | - } |
|
| 2207 | - |
|
| 2208 | - /** |
|
| 2209 | - * @return \OCP\Lockdown\ILockdownManager |
|
| 2210 | - * @deprecated 20.0.0 |
|
| 2211 | - */ |
|
| 2212 | - public function getLockdownManager() { |
|
| 2213 | - return $this->get('LockdownManager'); |
|
| 2214 | - } |
|
| 2215 | - |
|
| 2216 | - /** |
|
| 2217 | - * @return \OCP\Federation\ICloudIdManager |
|
| 2218 | - * @deprecated 20.0.0 |
|
| 2219 | - */ |
|
| 2220 | - public function getCloudIdManager() { |
|
| 2221 | - return $this->get(ICloudIdManager::class); |
|
| 2222 | - } |
|
| 2223 | - |
|
| 2224 | - /** |
|
| 2225 | - * @return \OCP\GlobalScale\IConfig |
|
| 2226 | - * @deprecated 20.0.0 |
|
| 2227 | - */ |
|
| 2228 | - public function getGlobalScaleConfig() { |
|
| 2229 | - return $this->get(IConfig::class); |
|
| 2230 | - } |
|
| 2231 | - |
|
| 2232 | - /** |
|
| 2233 | - * @return \OCP\Federation\ICloudFederationProviderManager |
|
| 2234 | - * @deprecated 20.0.0 |
|
| 2235 | - */ |
|
| 2236 | - public function getCloudFederationProviderManager() { |
|
| 2237 | - return $this->get(ICloudFederationProviderManager::class); |
|
| 2238 | - } |
|
| 2239 | - |
|
| 2240 | - /** |
|
| 2241 | - * @return \OCP\Remote\Api\IApiFactory |
|
| 2242 | - * @deprecated 20.0.0 |
|
| 2243 | - */ |
|
| 2244 | - public function getRemoteApiFactory() { |
|
| 2245 | - return $this->get(IApiFactory::class); |
|
| 2246 | - } |
|
| 2247 | - |
|
| 2248 | - /** |
|
| 2249 | - * @return \OCP\Federation\ICloudFederationFactory |
|
| 2250 | - * @deprecated 20.0.0 |
|
| 2251 | - */ |
|
| 2252 | - public function getCloudFederationFactory() { |
|
| 2253 | - return $this->get(ICloudFederationFactory::class); |
|
| 2254 | - } |
|
| 2255 | - |
|
| 2256 | - /** |
|
| 2257 | - * @return \OCP\Remote\IInstanceFactory |
|
| 2258 | - * @deprecated 20.0.0 |
|
| 2259 | - */ |
|
| 2260 | - public function getRemoteInstanceFactory() { |
|
| 2261 | - return $this->get(IInstanceFactory::class); |
|
| 2262 | - } |
|
| 2263 | - |
|
| 2264 | - /** |
|
| 2265 | - * @return IStorageFactory |
|
| 2266 | - * @deprecated 20.0.0 |
|
| 2267 | - */ |
|
| 2268 | - public function getStorageFactory() { |
|
| 2269 | - return $this->get(IStorageFactory::class); |
|
| 2270 | - } |
|
| 2271 | - |
|
| 2272 | - /** |
|
| 2273 | - * Get the Preview GeneratorHelper |
|
| 2274 | - * |
|
| 2275 | - * @return GeneratorHelper |
|
| 2276 | - * @since 17.0.0 |
|
| 2277 | - * @deprecated 20.0.0 |
|
| 2278 | - */ |
|
| 2279 | - public function getGeneratorHelper() { |
|
| 2280 | - return $this->get(\OC\Preview\GeneratorHelper::class); |
|
| 2281 | - } |
|
| 2282 | - |
|
| 2283 | - private function registerDeprecatedAlias(string $alias, string $target) { |
|
| 2284 | - $this->registerService($alias, function (ContainerInterface $container) use ($target, $alias) { |
|
| 2285 | - try { |
|
| 2286 | - /** @var ILogger $logger */ |
|
| 2287 | - $logger = $container->get(ILogger::class); |
|
| 2288 | - $logger->debug('The requested alias "' . $alias . '" is deprecated. Please request "' . $target . '" directly. This alias will be removed in a future Nextcloud version.', ['app' => 'serverDI']); |
|
| 2289 | - } catch (ContainerExceptionInterface $e) { |
|
| 2290 | - // Could not get logger. Continue |
|
| 2291 | - } |
|
| 2292 | - |
|
| 2293 | - return $container->get($target); |
|
| 2294 | - }, false); |
|
| 2295 | - } |
|
| 1110 | + $prefixes = \OC::$composerAutoloader->getPrefixesPsr4(); |
|
| 1111 | + if (isset($prefixes['OCA\\Theming\\'])) { |
|
| 1112 | + $classExists = true; |
|
| 1113 | + } else { |
|
| 1114 | + $classExists = false; |
|
| 1115 | + } |
|
| 1116 | + |
|
| 1117 | + if ($classExists && $c->get(\OCP\IConfig::class)->getSystemValue('installed', false) && $c->get(IAppManager::class)->isInstalled('theming') && $c->getTrustedDomainHelper()->isTrustedDomain($c->getRequest()->getInsecureServerHost())) { |
|
| 1118 | + return new ThemingDefaults( |
|
| 1119 | + $c->get(\OCP\IConfig::class), |
|
| 1120 | + $c->getL10N('theming'), |
|
| 1121 | + $c->get(IURLGenerator::class), |
|
| 1122 | + $c->get(ICacheFactory::class), |
|
| 1123 | + new Util($c->get(\OCP\IConfig::class), $this->get(IAppManager::class), $c->getAppDataDir('theming')), |
|
| 1124 | + new ImageManager( |
|
| 1125 | + $c->get(\OCP\IConfig::class), |
|
| 1126 | + $c->getAppDataDir('theming'), |
|
| 1127 | + $c->get(IURLGenerator::class), |
|
| 1128 | + $this->get(ICacheFactory::class), |
|
| 1129 | + $this->get(ILogger::class), |
|
| 1130 | + $this->get(ITempManager::class) |
|
| 1131 | + ), |
|
| 1132 | + $c->get(IAppManager::class), |
|
| 1133 | + $c->get(INavigationManager::class) |
|
| 1134 | + ); |
|
| 1135 | + } |
|
| 1136 | + return new \OC_Defaults(); |
|
| 1137 | + }); |
|
| 1138 | + $this->registerService(JSCombiner::class, function (Server $c) { |
|
| 1139 | + return new JSCombiner( |
|
| 1140 | + $c->getAppDataDir('js'), |
|
| 1141 | + $c->get(IURLGenerator::class), |
|
| 1142 | + $this->get(ICacheFactory::class), |
|
| 1143 | + $c->get(SystemConfig::class), |
|
| 1144 | + $c->get(ILogger::class) |
|
| 1145 | + ); |
|
| 1146 | + }); |
|
| 1147 | + $this->registerAlias(\OCP\EventDispatcher\IEventDispatcher::class, \OC\EventDispatcher\EventDispatcher::class); |
|
| 1148 | + /** @deprecated 19.0.0 */ |
|
| 1149 | + $this->registerDeprecatedAlias('EventDispatcher', \OC\EventDispatcher\SymfonyAdapter::class); |
|
| 1150 | + $this->registerAlias(EventDispatcherInterface::class, \OC\EventDispatcher\SymfonyAdapter::class); |
|
| 1151 | + |
|
| 1152 | + $this->registerService('CryptoWrapper', function (ContainerInterface $c) { |
|
| 1153 | + // FIXME: Instantiiated here due to cyclic dependency |
|
| 1154 | + $request = new Request( |
|
| 1155 | + [ |
|
| 1156 | + 'get' => $_GET, |
|
| 1157 | + 'post' => $_POST, |
|
| 1158 | + 'files' => $_FILES, |
|
| 1159 | + 'server' => $_SERVER, |
|
| 1160 | + 'env' => $_ENV, |
|
| 1161 | + 'cookies' => $_COOKIE, |
|
| 1162 | + 'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD'])) |
|
| 1163 | + ? $_SERVER['REQUEST_METHOD'] |
|
| 1164 | + : null, |
|
| 1165 | + ], |
|
| 1166 | + $c->get(ISecureRandom::class), |
|
| 1167 | + $c->get(\OCP\IConfig::class) |
|
| 1168 | + ); |
|
| 1169 | + |
|
| 1170 | + return new CryptoWrapper( |
|
| 1171 | + $c->get(\OCP\IConfig::class), |
|
| 1172 | + $c->get(ICrypto::class), |
|
| 1173 | + $c->get(ISecureRandom::class), |
|
| 1174 | + $request |
|
| 1175 | + ); |
|
| 1176 | + }); |
|
| 1177 | + /** @deprecated 19.0.0 */ |
|
| 1178 | + $this->registerDeprecatedAlias('CsrfTokenManager', CsrfTokenManager::class); |
|
| 1179 | + $this->registerService(SessionStorage::class, function (ContainerInterface $c) { |
|
| 1180 | + return new SessionStorage($c->get(ISession::class)); |
|
| 1181 | + }); |
|
| 1182 | + $this->registerAlias(\OCP\Security\IContentSecurityPolicyManager::class, ContentSecurityPolicyManager::class); |
|
| 1183 | + /** @deprecated 19.0.0 */ |
|
| 1184 | + $this->registerDeprecatedAlias('ContentSecurityPolicyManager', ContentSecurityPolicyManager::class); |
|
| 1185 | + |
|
| 1186 | + $this->registerService(\OCP\Share\IManager::class, function (IServerContainer $c) { |
|
| 1187 | + $config = $c->get(\OCP\IConfig::class); |
|
| 1188 | + $factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class); |
|
| 1189 | + /** @var \OCP\Share\IProviderFactory $factory */ |
|
| 1190 | + $factory = new $factoryClass($this); |
|
| 1191 | + |
|
| 1192 | + $manager = new \OC\Share20\Manager( |
|
| 1193 | + $c->get(ILogger::class), |
|
| 1194 | + $c->get(\OCP\IConfig::class), |
|
| 1195 | + $c->get(ISecureRandom::class), |
|
| 1196 | + $c->get(IHasher::class), |
|
| 1197 | + $c->get(IMountManager::class), |
|
| 1198 | + $c->get(IGroupManager::class), |
|
| 1199 | + $c->getL10N('lib'), |
|
| 1200 | + $c->get(IFactory::class), |
|
| 1201 | + $factory, |
|
| 1202 | + $c->get(IUserManager::class), |
|
| 1203 | + $c->get(IRootFolder::class), |
|
| 1204 | + $c->get(SymfonyAdapter::class), |
|
| 1205 | + $c->get(IMailer::class), |
|
| 1206 | + $c->get(IURLGenerator::class), |
|
| 1207 | + $c->get('ThemingDefaults'), |
|
| 1208 | + $c->get(IEventDispatcher::class) |
|
| 1209 | + ); |
|
| 1210 | + |
|
| 1211 | + return $manager; |
|
| 1212 | + }); |
|
| 1213 | + /** @deprecated 19.0.0 */ |
|
| 1214 | + $this->registerDeprecatedAlias('ShareManager', \OCP\Share\IManager::class); |
|
| 1215 | + |
|
| 1216 | + $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function (Server $c) { |
|
| 1217 | + $instance = new Collaboration\Collaborators\Search($c); |
|
| 1218 | + |
|
| 1219 | + // register default plugins |
|
| 1220 | + $instance->registerPlugin(['shareType' => 'SHARE_TYPE_USER', 'class' => UserPlugin::class]); |
|
| 1221 | + $instance->registerPlugin(['shareType' => 'SHARE_TYPE_GROUP', 'class' => GroupPlugin::class]); |
|
| 1222 | + $instance->registerPlugin(['shareType' => 'SHARE_TYPE_EMAIL', 'class' => MailPlugin::class]); |
|
| 1223 | + $instance->registerPlugin(['shareType' => 'SHARE_TYPE_REMOTE', 'class' => RemotePlugin::class]); |
|
| 1224 | + $instance->registerPlugin(['shareType' => 'SHARE_TYPE_REMOTE_GROUP', 'class' => RemoteGroupPlugin::class]); |
|
| 1225 | + |
|
| 1226 | + return $instance; |
|
| 1227 | + }); |
|
| 1228 | + /** @deprecated 19.0.0 */ |
|
| 1229 | + $this->registerDeprecatedAlias('CollaboratorSearch', \OCP\Collaboration\Collaborators\ISearch::class); |
|
| 1230 | + $this->registerAlias(\OCP\Collaboration\Collaborators\ISearchResult::class, \OC\Collaboration\Collaborators\SearchResult::class); |
|
| 1231 | + |
|
| 1232 | + $this->registerAlias(\OCP\Collaboration\AutoComplete\IManager::class, \OC\Collaboration\AutoComplete\Manager::class); |
|
| 1233 | + |
|
| 1234 | + $this->registerAlias(\OCP\Collaboration\Resources\IProviderManager::class, \OC\Collaboration\Resources\ProviderManager::class); |
|
| 1235 | + $this->registerAlias(\OCP\Collaboration\Resources\IManager::class, \OC\Collaboration\Resources\Manager::class); |
|
| 1236 | + |
|
| 1237 | + $this->registerDeprecatedAlias('SettingsManager', \OC\Settings\Manager::class); |
|
| 1238 | + $this->registerAlias(\OCP\Settings\IManager::class, \OC\Settings\Manager::class); |
|
| 1239 | + $this->registerService(\OC\Files\AppData\Factory::class, function (ContainerInterface $c) { |
|
| 1240 | + return new \OC\Files\AppData\Factory( |
|
| 1241 | + $c->get(IRootFolder::class), |
|
| 1242 | + $c->get(SystemConfig::class) |
|
| 1243 | + ); |
|
| 1244 | + }); |
|
| 1245 | + |
|
| 1246 | + $this->registerService('LockdownManager', function (ContainerInterface $c) { |
|
| 1247 | + return new LockdownManager(function () use ($c) { |
|
| 1248 | + return $c->get(ISession::class); |
|
| 1249 | + }); |
|
| 1250 | + }); |
|
| 1251 | + |
|
| 1252 | + $this->registerService(\OCP\OCS\IDiscoveryService::class, function (ContainerInterface $c) { |
|
| 1253 | + return new DiscoveryService( |
|
| 1254 | + $c->get(ICacheFactory::class), |
|
| 1255 | + $c->get(IClientService::class) |
|
| 1256 | + ); |
|
| 1257 | + }); |
|
| 1258 | + |
|
| 1259 | + $this->registerService(ICloudIdManager::class, function (ContainerInterface $c) { |
|
| 1260 | + return new CloudIdManager($c->get(\OCP\Contacts\IManager::class)); |
|
| 1261 | + }); |
|
| 1262 | + |
|
| 1263 | + $this->registerAlias(\OCP\GlobalScale\IConfig::class, \OC\GlobalScale\Config::class); |
|
| 1264 | + |
|
| 1265 | + $this->registerService(ICloudFederationProviderManager::class, function (ContainerInterface $c) { |
|
| 1266 | + return new CloudFederationProviderManager( |
|
| 1267 | + $c->get(IAppManager::class), |
|
| 1268 | + $c->get(IClientService::class), |
|
| 1269 | + $c->get(ICloudIdManager::class), |
|
| 1270 | + $c->get(ILogger::class) |
|
| 1271 | + ); |
|
| 1272 | + }); |
|
| 1273 | + |
|
| 1274 | + $this->registerService(ICloudFederationFactory::class, function (Server $c) { |
|
| 1275 | + return new CloudFederationFactory(); |
|
| 1276 | + }); |
|
| 1277 | + |
|
| 1278 | + $this->registerAlias(\OCP\AppFramework\Utility\IControllerMethodReflector::class, \OC\AppFramework\Utility\ControllerMethodReflector::class); |
|
| 1279 | + /** @deprecated 19.0.0 */ |
|
| 1280 | + $this->registerDeprecatedAlias('ControllerMethodReflector', \OCP\AppFramework\Utility\IControllerMethodReflector::class); |
|
| 1281 | + |
|
| 1282 | + $this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class); |
|
| 1283 | + /** @deprecated 19.0.0 */ |
|
| 1284 | + $this->registerDeprecatedAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class); |
|
| 1285 | + |
|
| 1286 | + $this->registerService(Defaults::class, function (Server $c) { |
|
| 1287 | + return new Defaults( |
|
| 1288 | + $c->getThemingDefaults() |
|
| 1289 | + ); |
|
| 1290 | + }); |
|
| 1291 | + /** @deprecated 19.0.0 */ |
|
| 1292 | + $this->registerDeprecatedAlias('Defaults', \OCP\Defaults::class); |
|
| 1293 | + |
|
| 1294 | + $this->registerService(\OCP\ISession::class, function (ContainerInterface $c) { |
|
| 1295 | + return $c->get(\OCP\IUserSession::class)->getSession(); |
|
| 1296 | + }, false); |
|
| 1297 | + |
|
| 1298 | + $this->registerService(IShareHelper::class, function (ContainerInterface $c) { |
|
| 1299 | + return new ShareHelper( |
|
| 1300 | + $c->get(\OCP\Share\IManager::class) |
|
| 1301 | + ); |
|
| 1302 | + }); |
|
| 1303 | + |
|
| 1304 | + $this->registerService(Installer::class, function (ContainerInterface $c) { |
|
| 1305 | + return new Installer( |
|
| 1306 | + $c->get(AppFetcher::class), |
|
| 1307 | + $c->get(IClientService::class), |
|
| 1308 | + $c->get(ITempManager::class), |
|
| 1309 | + $c->get(ILogger::class), |
|
| 1310 | + $c->get(\OCP\IConfig::class), |
|
| 1311 | + \OC::$CLI |
|
| 1312 | + ); |
|
| 1313 | + }); |
|
| 1314 | + |
|
| 1315 | + $this->registerService(IApiFactory::class, function (ContainerInterface $c) { |
|
| 1316 | + return new ApiFactory($c->get(IClientService::class)); |
|
| 1317 | + }); |
|
| 1318 | + |
|
| 1319 | + $this->registerService(IInstanceFactory::class, function (ContainerInterface $c) { |
|
| 1320 | + $memcacheFactory = $c->get(ICacheFactory::class); |
|
| 1321 | + return new InstanceFactory($memcacheFactory->createLocal('remoteinstance.'), $c->get(IClientService::class)); |
|
| 1322 | + }); |
|
| 1323 | + |
|
| 1324 | + $this->registerAlias(IContactsStore::class, ContactsStore::class); |
|
| 1325 | + $this->registerAlias(IAccountManager::class, AccountManager::class); |
|
| 1326 | + |
|
| 1327 | + $this->registerAlias(IStorageFactory::class, StorageFactory::class); |
|
| 1328 | + |
|
| 1329 | + $this->registerAlias(IDashboardManager::class, DashboardManager::class); |
|
| 1330 | + $this->registerAlias(\OCP\Dashboard\IManager::class, \OC\Dashboard\Manager::class); |
|
| 1331 | + $this->registerAlias(IFullTextSearchManager::class, FullTextSearchManager::class); |
|
| 1332 | + |
|
| 1333 | + $this->registerAlias(ISubAdmin::class, SubAdmin::class); |
|
| 1334 | + |
|
| 1335 | + $this->registerAlias(IInitialStateService::class, InitialStateService::class); |
|
| 1336 | + |
|
| 1337 | + $this->registerAlias(\OCP\UserStatus\IManager::class, \OC\UserStatus\Manager::class); |
|
| 1338 | + |
|
| 1339 | + $this->connectDispatcher(); |
|
| 1340 | + } |
|
| 1341 | + |
|
| 1342 | + public function boot() { |
|
| 1343 | + /** @var HookConnector $hookConnector */ |
|
| 1344 | + $hookConnector = $this->get(HookConnector::class); |
|
| 1345 | + $hookConnector->viewToNode(); |
|
| 1346 | + } |
|
| 1347 | + |
|
| 1348 | + /** |
|
| 1349 | + * @return \OCP\Calendar\IManager |
|
| 1350 | + * @deprecated 20.0.0 |
|
| 1351 | + */ |
|
| 1352 | + public function getCalendarManager() { |
|
| 1353 | + return $this->get(\OC\Calendar\Manager::class); |
|
| 1354 | + } |
|
| 1355 | + |
|
| 1356 | + /** |
|
| 1357 | + * @return \OCP\Calendar\Resource\IManager |
|
| 1358 | + * @deprecated 20.0.0 |
|
| 1359 | + */ |
|
| 1360 | + public function getCalendarResourceBackendManager() { |
|
| 1361 | + return $this->get(\OC\Calendar\Resource\Manager::class); |
|
| 1362 | + } |
|
| 1363 | + |
|
| 1364 | + /** |
|
| 1365 | + * @return \OCP\Calendar\Room\IManager |
|
| 1366 | + * @deprecated 20.0.0 |
|
| 1367 | + */ |
|
| 1368 | + public function getCalendarRoomBackendManager() { |
|
| 1369 | + return $this->get(\OC\Calendar\Room\Manager::class); |
|
| 1370 | + } |
|
| 1371 | + |
|
| 1372 | + private function connectDispatcher() { |
|
| 1373 | + $dispatcher = $this->get(SymfonyAdapter::class); |
|
| 1374 | + |
|
| 1375 | + // Delete avatar on user deletion |
|
| 1376 | + $dispatcher->addListener('OCP\IUser::preDelete', function (GenericEvent $e) { |
|
| 1377 | + $logger = $this->get(ILogger::class); |
|
| 1378 | + $manager = $this->getAvatarManager(); |
|
| 1379 | + /** @var IUser $user */ |
|
| 1380 | + $user = $e->getSubject(); |
|
| 1381 | + |
|
| 1382 | + try { |
|
| 1383 | + $avatar = $manager->getAvatar($user->getUID()); |
|
| 1384 | + $avatar->remove(); |
|
| 1385 | + } catch (NotFoundException $e) { |
|
| 1386 | + // no avatar to remove |
|
| 1387 | + } catch (\Exception $e) { |
|
| 1388 | + // Ignore exceptions |
|
| 1389 | + $logger->info('Could not cleanup avatar of ' . $user->getUID()); |
|
| 1390 | + } |
|
| 1391 | + }); |
|
| 1392 | + |
|
| 1393 | + $dispatcher->addListener('OCP\IUser::changeUser', function (GenericEvent $e) { |
|
| 1394 | + $manager = $this->getAvatarManager(); |
|
| 1395 | + /** @var IUser $user */ |
|
| 1396 | + $user = $e->getSubject(); |
|
| 1397 | + $feature = $e->getArgument('feature'); |
|
| 1398 | + $oldValue = $e->getArgument('oldValue'); |
|
| 1399 | + $value = $e->getArgument('value'); |
|
| 1400 | + |
|
| 1401 | + // We only change the avatar on display name changes |
|
| 1402 | + if ($feature !== 'displayName') { |
|
| 1403 | + return; |
|
| 1404 | + } |
|
| 1405 | + |
|
| 1406 | + try { |
|
| 1407 | + $avatar = $manager->getAvatar($user->getUID()); |
|
| 1408 | + $avatar->userChanged($feature, $oldValue, $value); |
|
| 1409 | + } catch (NotFoundException $e) { |
|
| 1410 | + // no avatar to remove |
|
| 1411 | + } |
|
| 1412 | + }); |
|
| 1413 | + |
|
| 1414 | + /** @var IEventDispatcher $eventDispatched */ |
|
| 1415 | + $eventDispatched = $this->get(IEventDispatcher::class); |
|
| 1416 | + $eventDispatched->addServiceListener(LoginFailed::class, LoginFailedListener::class); |
|
| 1417 | + $eventDispatched->addServiceListener(PostLoginEvent::class, UserLoggedInListener::class); |
|
| 1418 | + } |
|
| 1419 | + |
|
| 1420 | + /** |
|
| 1421 | + * @return \OCP\Contacts\IManager |
|
| 1422 | + * @deprecated 20.0.0 |
|
| 1423 | + */ |
|
| 1424 | + public function getContactsManager() { |
|
| 1425 | + return $this->get(\OCP\Contacts\IManager::class); |
|
| 1426 | + } |
|
| 1427 | + |
|
| 1428 | + /** |
|
| 1429 | + * @return \OC\Encryption\Manager |
|
| 1430 | + * @deprecated 20.0.0 |
|
| 1431 | + */ |
|
| 1432 | + public function getEncryptionManager() { |
|
| 1433 | + return $this->get(\OCP\Encryption\IManager::class); |
|
| 1434 | + } |
|
| 1435 | + |
|
| 1436 | + /** |
|
| 1437 | + * @return \OC\Encryption\File |
|
| 1438 | + * @deprecated 20.0.0 |
|
| 1439 | + */ |
|
| 1440 | + public function getEncryptionFilesHelper() { |
|
| 1441 | + return $this->get(IFile::class); |
|
| 1442 | + } |
|
| 1443 | + |
|
| 1444 | + /** |
|
| 1445 | + * @return \OCP\Encryption\Keys\IStorage |
|
| 1446 | + * @deprecated 20.0.0 |
|
| 1447 | + */ |
|
| 1448 | + public function getEncryptionKeyStorage() { |
|
| 1449 | + return $this->get(IStorage::class); |
|
| 1450 | + } |
|
| 1451 | + |
|
| 1452 | + /** |
|
| 1453 | + * The current request object holding all information about the request |
|
| 1454 | + * currently being processed is returned from this method. |
|
| 1455 | + * In case the current execution was not initiated by a web request null is returned |
|
| 1456 | + * |
|
| 1457 | + * @return \OCP\IRequest |
|
| 1458 | + * @deprecated 20.0.0 |
|
| 1459 | + */ |
|
| 1460 | + public function getRequest() { |
|
| 1461 | + return $this->get(IRequest::class); |
|
| 1462 | + } |
|
| 1463 | + |
|
| 1464 | + /** |
|
| 1465 | + * Returns the preview manager which can create preview images for a given file |
|
| 1466 | + * |
|
| 1467 | + * @return IPreview |
|
| 1468 | + * @deprecated 20.0.0 |
|
| 1469 | + */ |
|
| 1470 | + public function getPreviewManager() { |
|
| 1471 | + return $this->get(IPreview::class); |
|
| 1472 | + } |
|
| 1473 | + |
|
| 1474 | + /** |
|
| 1475 | + * Returns the tag manager which can get and set tags for different object types |
|
| 1476 | + * |
|
| 1477 | + * @see \OCP\ITagManager::load() |
|
| 1478 | + * @return ITagManager |
|
| 1479 | + * @deprecated 20.0.0 |
|
| 1480 | + */ |
|
| 1481 | + public function getTagManager() { |
|
| 1482 | + return $this->get(ITagManager::class); |
|
| 1483 | + } |
|
| 1484 | + |
|
| 1485 | + /** |
|
| 1486 | + * Returns the system-tag manager |
|
| 1487 | + * |
|
| 1488 | + * @return ISystemTagManager |
|
| 1489 | + * |
|
| 1490 | + * @since 9.0.0 |
|
| 1491 | + * @deprecated 20.0.0 |
|
| 1492 | + */ |
|
| 1493 | + public function getSystemTagManager() { |
|
| 1494 | + return $this->get(ISystemTagManager::class); |
|
| 1495 | + } |
|
| 1496 | + |
|
| 1497 | + /** |
|
| 1498 | + * Returns the system-tag object mapper |
|
| 1499 | + * |
|
| 1500 | + * @return ISystemTagObjectMapper |
|
| 1501 | + * |
|
| 1502 | + * @since 9.0.0 |
|
| 1503 | + * @deprecated 20.0.0 |
|
| 1504 | + */ |
|
| 1505 | + public function getSystemTagObjectMapper() { |
|
| 1506 | + return $this->get(ISystemTagObjectMapper::class); |
|
| 1507 | + } |
|
| 1508 | + |
|
| 1509 | + /** |
|
| 1510 | + * Returns the avatar manager, used for avatar functionality |
|
| 1511 | + * |
|
| 1512 | + * @return IAvatarManager |
|
| 1513 | + * @deprecated 20.0.0 |
|
| 1514 | + */ |
|
| 1515 | + public function getAvatarManager() { |
|
| 1516 | + return $this->get(IAvatarManager::class); |
|
| 1517 | + } |
|
| 1518 | + |
|
| 1519 | + /** |
|
| 1520 | + * Returns the root folder of ownCloud's data directory |
|
| 1521 | + * |
|
| 1522 | + * @return IRootFolder |
|
| 1523 | + * @deprecated 20.0.0 |
|
| 1524 | + */ |
|
| 1525 | + public function getRootFolder() { |
|
| 1526 | + return $this->get(IRootFolder::class); |
|
| 1527 | + } |
|
| 1528 | + |
|
| 1529 | + /** |
|
| 1530 | + * Returns the root folder of ownCloud's data directory |
|
| 1531 | + * This is the lazy variant so this gets only initialized once it |
|
| 1532 | + * is actually used. |
|
| 1533 | + * |
|
| 1534 | + * @return IRootFolder |
|
| 1535 | + * @deprecated 20.0.0 |
|
| 1536 | + */ |
|
| 1537 | + public function getLazyRootFolder() { |
|
| 1538 | + return $this->get(IRootFolder::class); |
|
| 1539 | + } |
|
| 1540 | + |
|
| 1541 | + /** |
|
| 1542 | + * Returns a view to ownCloud's files folder |
|
| 1543 | + * |
|
| 1544 | + * @param string $userId user ID |
|
| 1545 | + * @return \OCP\Files\Folder|null |
|
| 1546 | + * @deprecated 20.0.0 |
|
| 1547 | + */ |
|
| 1548 | + public function getUserFolder($userId = null) { |
|
| 1549 | + if ($userId === null) { |
|
| 1550 | + $user = $this->get(IUserSession::class)->getUser(); |
|
| 1551 | + if (!$user) { |
|
| 1552 | + return null; |
|
| 1553 | + } |
|
| 1554 | + $userId = $user->getUID(); |
|
| 1555 | + } |
|
| 1556 | + $root = $this->get(IRootFolder::class); |
|
| 1557 | + return $root->getUserFolder($userId); |
|
| 1558 | + } |
|
| 1559 | + |
|
| 1560 | + /** |
|
| 1561 | + * @return \OC\User\Manager |
|
| 1562 | + * @deprecated 20.0.0 |
|
| 1563 | + */ |
|
| 1564 | + public function getUserManager() { |
|
| 1565 | + return $this->get(IUserManager::class); |
|
| 1566 | + } |
|
| 1567 | + |
|
| 1568 | + /** |
|
| 1569 | + * @return \OC\Group\Manager |
|
| 1570 | + * @deprecated 20.0.0 |
|
| 1571 | + */ |
|
| 1572 | + public function getGroupManager() { |
|
| 1573 | + return $this->get(IGroupManager::class); |
|
| 1574 | + } |
|
| 1575 | + |
|
| 1576 | + /** |
|
| 1577 | + * @return \OC\User\Session |
|
| 1578 | + * @deprecated 20.0.0 |
|
| 1579 | + */ |
|
| 1580 | + public function getUserSession() { |
|
| 1581 | + return $this->get(IUserSession::class); |
|
| 1582 | + } |
|
| 1583 | + |
|
| 1584 | + /** |
|
| 1585 | + * @return \OCP\ISession |
|
| 1586 | + * @deprecated 20.0.0 |
|
| 1587 | + */ |
|
| 1588 | + public function getSession() { |
|
| 1589 | + return $this->get(IUserSession::class)->getSession(); |
|
| 1590 | + } |
|
| 1591 | + |
|
| 1592 | + /** |
|
| 1593 | + * @param \OCP\ISession $session |
|
| 1594 | + */ |
|
| 1595 | + public function setSession(\OCP\ISession $session) { |
|
| 1596 | + $this->get(SessionStorage::class)->setSession($session); |
|
| 1597 | + $this->get(IUserSession::class)->setSession($session); |
|
| 1598 | + $this->get(Store::class)->setSession($session); |
|
| 1599 | + } |
|
| 1600 | + |
|
| 1601 | + /** |
|
| 1602 | + * @return \OC\Authentication\TwoFactorAuth\Manager |
|
| 1603 | + * @deprecated 20.0.0 |
|
| 1604 | + */ |
|
| 1605 | + public function getTwoFactorAuthManager() { |
|
| 1606 | + return $this->get(\OC\Authentication\TwoFactorAuth\Manager::class); |
|
| 1607 | + } |
|
| 1608 | + |
|
| 1609 | + /** |
|
| 1610 | + * @return \OC\NavigationManager |
|
| 1611 | + * @deprecated 20.0.0 |
|
| 1612 | + */ |
|
| 1613 | + public function getNavigationManager() { |
|
| 1614 | + return $this->get(INavigationManager::class); |
|
| 1615 | + } |
|
| 1616 | + |
|
| 1617 | + /** |
|
| 1618 | + * @return \OCP\IConfig |
|
| 1619 | + * @deprecated 20.0.0 |
|
| 1620 | + */ |
|
| 1621 | + public function getConfig() { |
|
| 1622 | + return $this->get(AllConfig::class); |
|
| 1623 | + } |
|
| 1624 | + |
|
| 1625 | + /** |
|
| 1626 | + * @return \OC\SystemConfig |
|
| 1627 | + * @deprecated 20.0.0 |
|
| 1628 | + */ |
|
| 1629 | + public function getSystemConfig() { |
|
| 1630 | + return $this->get(SystemConfig::class); |
|
| 1631 | + } |
|
| 1632 | + |
|
| 1633 | + /** |
|
| 1634 | + * Returns the app config manager |
|
| 1635 | + * |
|
| 1636 | + * @return IAppConfig |
|
| 1637 | + * @deprecated 20.0.0 |
|
| 1638 | + */ |
|
| 1639 | + public function getAppConfig() { |
|
| 1640 | + return $this->get(IAppConfig::class); |
|
| 1641 | + } |
|
| 1642 | + |
|
| 1643 | + /** |
|
| 1644 | + * @return IFactory |
|
| 1645 | + * @deprecated 20.0.0 |
|
| 1646 | + */ |
|
| 1647 | + public function getL10NFactory() { |
|
| 1648 | + return $this->get(IFactory::class); |
|
| 1649 | + } |
|
| 1650 | + |
|
| 1651 | + /** |
|
| 1652 | + * get an L10N instance |
|
| 1653 | + * |
|
| 1654 | + * @param string $app appid |
|
| 1655 | + * @param string $lang |
|
| 1656 | + * @return IL10N |
|
| 1657 | + * @deprecated 20.0.0 |
|
| 1658 | + */ |
|
| 1659 | + public function getL10N($app, $lang = null) { |
|
| 1660 | + return $this->get(IFactory::class)->get($app, $lang); |
|
| 1661 | + } |
|
| 1662 | + |
|
| 1663 | + /** |
|
| 1664 | + * @return IURLGenerator |
|
| 1665 | + * @deprecated 20.0.0 |
|
| 1666 | + */ |
|
| 1667 | + public function getURLGenerator() { |
|
| 1668 | + return $this->get(IURLGenerator::class); |
|
| 1669 | + } |
|
| 1670 | + |
|
| 1671 | + /** |
|
| 1672 | + * @return AppFetcher |
|
| 1673 | + * @deprecated 20.0.0 |
|
| 1674 | + */ |
|
| 1675 | + public function getAppFetcher() { |
|
| 1676 | + return $this->get(AppFetcher::class); |
|
| 1677 | + } |
|
| 1678 | + |
|
| 1679 | + /** |
|
| 1680 | + * Returns an ICache instance. Since 8.1.0 it returns a fake cache. Use |
|
| 1681 | + * getMemCacheFactory() instead. |
|
| 1682 | + * |
|
| 1683 | + * @return ICache |
|
| 1684 | + * @deprecated 8.1.0 use getMemCacheFactory to obtain a proper cache |
|
| 1685 | + */ |
|
| 1686 | + public function getCache() { |
|
| 1687 | + return $this->get(ICache::class); |
|
| 1688 | + } |
|
| 1689 | + |
|
| 1690 | + /** |
|
| 1691 | + * Returns an \OCP\CacheFactory instance |
|
| 1692 | + * |
|
| 1693 | + * @return \OCP\ICacheFactory |
|
| 1694 | + * @deprecated 20.0.0 |
|
| 1695 | + */ |
|
| 1696 | + public function getMemCacheFactory() { |
|
| 1697 | + return $this->get(ICacheFactory::class); |
|
| 1698 | + } |
|
| 1699 | + |
|
| 1700 | + /** |
|
| 1701 | + * Returns an \OC\RedisFactory instance |
|
| 1702 | + * |
|
| 1703 | + * @return \OC\RedisFactory |
|
| 1704 | + * @deprecated 20.0.0 |
|
| 1705 | + */ |
|
| 1706 | + public function getGetRedisFactory() { |
|
| 1707 | + return $this->get('RedisFactory'); |
|
| 1708 | + } |
|
| 1709 | + |
|
| 1710 | + |
|
| 1711 | + /** |
|
| 1712 | + * Returns the current session |
|
| 1713 | + * |
|
| 1714 | + * @return \OCP\IDBConnection |
|
| 1715 | + * @deprecated 20.0.0 |
|
| 1716 | + */ |
|
| 1717 | + public function getDatabaseConnection() { |
|
| 1718 | + return $this->get(IDBConnection::class); |
|
| 1719 | + } |
|
| 1720 | + |
|
| 1721 | + /** |
|
| 1722 | + * Returns the activity manager |
|
| 1723 | + * |
|
| 1724 | + * @return \OCP\Activity\IManager |
|
| 1725 | + * @deprecated 20.0.0 |
|
| 1726 | + */ |
|
| 1727 | + public function getActivityManager() { |
|
| 1728 | + return $this->get(\OCP\Activity\IManager::class); |
|
| 1729 | + } |
|
| 1730 | + |
|
| 1731 | + /** |
|
| 1732 | + * Returns an job list for controlling background jobs |
|
| 1733 | + * |
|
| 1734 | + * @return IJobList |
|
| 1735 | + * @deprecated 20.0.0 |
|
| 1736 | + */ |
|
| 1737 | + public function getJobList() { |
|
| 1738 | + return $this->get(IJobList::class); |
|
| 1739 | + } |
|
| 1740 | + |
|
| 1741 | + /** |
|
| 1742 | + * Returns a logger instance |
|
| 1743 | + * |
|
| 1744 | + * @return ILogger |
|
| 1745 | + * @deprecated 20.0.0 |
|
| 1746 | + */ |
|
| 1747 | + public function getLogger() { |
|
| 1748 | + return $this->get(ILogger::class); |
|
| 1749 | + } |
|
| 1750 | + |
|
| 1751 | + /** |
|
| 1752 | + * @return ILogFactory |
|
| 1753 | + * @throws \OCP\AppFramework\QueryException |
|
| 1754 | + * @deprecated 20.0.0 |
|
| 1755 | + */ |
|
| 1756 | + public function getLogFactory() { |
|
| 1757 | + return $this->get(ILogFactory::class); |
|
| 1758 | + } |
|
| 1759 | + |
|
| 1760 | + /** |
|
| 1761 | + * Returns a router for generating and matching urls |
|
| 1762 | + * |
|
| 1763 | + * @return IRouter |
|
| 1764 | + * @deprecated 20.0.0 |
|
| 1765 | + */ |
|
| 1766 | + public function getRouter() { |
|
| 1767 | + return $this->get(IRouter::class); |
|
| 1768 | + } |
|
| 1769 | + |
|
| 1770 | + /** |
|
| 1771 | + * Returns a search instance |
|
| 1772 | + * |
|
| 1773 | + * @return ISearch |
|
| 1774 | + * @deprecated 20.0.0 |
|
| 1775 | + */ |
|
| 1776 | + public function getSearch() { |
|
| 1777 | + return $this->get(ISearch::class); |
|
| 1778 | + } |
|
| 1779 | + |
|
| 1780 | + /** |
|
| 1781 | + * Returns a SecureRandom instance |
|
| 1782 | + * |
|
| 1783 | + * @return \OCP\Security\ISecureRandom |
|
| 1784 | + * @deprecated 20.0.0 |
|
| 1785 | + */ |
|
| 1786 | + public function getSecureRandom() { |
|
| 1787 | + return $this->get(ISecureRandom::class); |
|
| 1788 | + } |
|
| 1789 | + |
|
| 1790 | + /** |
|
| 1791 | + * Returns a Crypto instance |
|
| 1792 | + * |
|
| 1793 | + * @return ICrypto |
|
| 1794 | + * @deprecated 20.0.0 |
|
| 1795 | + */ |
|
| 1796 | + public function getCrypto() { |
|
| 1797 | + return $this->get(ICrypto::class); |
|
| 1798 | + } |
|
| 1799 | + |
|
| 1800 | + /** |
|
| 1801 | + * Returns a Hasher instance |
|
| 1802 | + * |
|
| 1803 | + * @return IHasher |
|
| 1804 | + * @deprecated 20.0.0 |
|
| 1805 | + */ |
|
| 1806 | + public function getHasher() { |
|
| 1807 | + return $this->get(IHasher::class); |
|
| 1808 | + } |
|
| 1809 | + |
|
| 1810 | + /** |
|
| 1811 | + * Returns a CredentialsManager instance |
|
| 1812 | + * |
|
| 1813 | + * @return ICredentialsManager |
|
| 1814 | + * @deprecated 20.0.0 |
|
| 1815 | + */ |
|
| 1816 | + public function getCredentialsManager() { |
|
| 1817 | + return $this->get(ICredentialsManager::class); |
|
| 1818 | + } |
|
| 1819 | + |
|
| 1820 | + /** |
|
| 1821 | + * Get the certificate manager |
|
| 1822 | + * |
|
| 1823 | + * @return \OCP\ICertificateManager |
|
| 1824 | + */ |
|
| 1825 | + public function getCertificateManager() { |
|
| 1826 | + return $this->get(ICertificateManager::class); |
|
| 1827 | + } |
|
| 1828 | + |
|
| 1829 | + /** |
|
| 1830 | + * Returns an instance of the HTTP client service |
|
| 1831 | + * |
|
| 1832 | + * @return IClientService |
|
| 1833 | + * @deprecated 20.0.0 |
|
| 1834 | + */ |
|
| 1835 | + public function getHTTPClientService() { |
|
| 1836 | + return $this->get(IClientService::class); |
|
| 1837 | + } |
|
| 1838 | + |
|
| 1839 | + /** |
|
| 1840 | + * Create a new event source |
|
| 1841 | + * |
|
| 1842 | + * @return \OCP\IEventSource |
|
| 1843 | + * @deprecated 20.0.0 |
|
| 1844 | + */ |
|
| 1845 | + public function createEventSource() { |
|
| 1846 | + return new \OC_EventSource(); |
|
| 1847 | + } |
|
| 1848 | + |
|
| 1849 | + /** |
|
| 1850 | + * Get the active event logger |
|
| 1851 | + * |
|
| 1852 | + * The returned logger only logs data when debug mode is enabled |
|
| 1853 | + * |
|
| 1854 | + * @return IEventLogger |
|
| 1855 | + * @deprecated 20.0.0 |
|
| 1856 | + */ |
|
| 1857 | + public function getEventLogger() { |
|
| 1858 | + return $this->get(IEventLogger::class); |
|
| 1859 | + } |
|
| 1860 | + |
|
| 1861 | + /** |
|
| 1862 | + * Get the active query logger |
|
| 1863 | + * |
|
| 1864 | + * The returned logger only logs data when debug mode is enabled |
|
| 1865 | + * |
|
| 1866 | + * @return IQueryLogger |
|
| 1867 | + * @deprecated 20.0.0 |
|
| 1868 | + */ |
|
| 1869 | + public function getQueryLogger() { |
|
| 1870 | + return $this->get(IQueryLogger::class); |
|
| 1871 | + } |
|
| 1872 | + |
|
| 1873 | + /** |
|
| 1874 | + * Get the manager for temporary files and folders |
|
| 1875 | + * |
|
| 1876 | + * @return \OCP\ITempManager |
|
| 1877 | + * @deprecated 20.0.0 |
|
| 1878 | + */ |
|
| 1879 | + public function getTempManager() { |
|
| 1880 | + return $this->get(ITempManager::class); |
|
| 1881 | + } |
|
| 1882 | + |
|
| 1883 | + /** |
|
| 1884 | + * Get the app manager |
|
| 1885 | + * |
|
| 1886 | + * @return \OCP\App\IAppManager |
|
| 1887 | + * @deprecated 20.0.0 |
|
| 1888 | + */ |
|
| 1889 | + public function getAppManager() { |
|
| 1890 | + return $this->get(IAppManager::class); |
|
| 1891 | + } |
|
| 1892 | + |
|
| 1893 | + /** |
|
| 1894 | + * Creates a new mailer |
|
| 1895 | + * |
|
| 1896 | + * @return IMailer |
|
| 1897 | + * @deprecated 20.0.0 |
|
| 1898 | + */ |
|
| 1899 | + public function getMailer() { |
|
| 1900 | + return $this->get(IMailer::class); |
|
| 1901 | + } |
|
| 1902 | + |
|
| 1903 | + /** |
|
| 1904 | + * Get the webroot |
|
| 1905 | + * |
|
| 1906 | + * @return string |
|
| 1907 | + * @deprecated 20.0.0 |
|
| 1908 | + */ |
|
| 1909 | + public function getWebRoot() { |
|
| 1910 | + return $this->webRoot; |
|
| 1911 | + } |
|
| 1912 | + |
|
| 1913 | + /** |
|
| 1914 | + * @return \OC\OCSClient |
|
| 1915 | + * @deprecated 20.0.0 |
|
| 1916 | + */ |
|
| 1917 | + public function getOcsClient() { |
|
| 1918 | + return $this->get('OcsClient'); |
|
| 1919 | + } |
|
| 1920 | + |
|
| 1921 | + /** |
|
| 1922 | + * @return IDateTimeZone |
|
| 1923 | + * @deprecated 20.0.0 |
|
| 1924 | + */ |
|
| 1925 | + public function getDateTimeZone() { |
|
| 1926 | + return $this->get(IDateTimeZone::class); |
|
| 1927 | + } |
|
| 1928 | + |
|
| 1929 | + /** |
|
| 1930 | + * @return IDateTimeFormatter |
|
| 1931 | + * @deprecated 20.0.0 |
|
| 1932 | + */ |
|
| 1933 | + public function getDateTimeFormatter() { |
|
| 1934 | + return $this->get(IDateTimeFormatter::class); |
|
| 1935 | + } |
|
| 1936 | + |
|
| 1937 | + /** |
|
| 1938 | + * @return IMountProviderCollection |
|
| 1939 | + * @deprecated 20.0.0 |
|
| 1940 | + */ |
|
| 1941 | + public function getMountProviderCollection() { |
|
| 1942 | + return $this->get(IMountProviderCollection::class); |
|
| 1943 | + } |
|
| 1944 | + |
|
| 1945 | + /** |
|
| 1946 | + * Get the IniWrapper |
|
| 1947 | + * |
|
| 1948 | + * @return IniGetWrapper |
|
| 1949 | + * @deprecated 20.0.0 |
|
| 1950 | + */ |
|
| 1951 | + public function getIniWrapper() { |
|
| 1952 | + return $this->get(IniGetWrapper::class); |
|
| 1953 | + } |
|
| 1954 | + |
|
| 1955 | + /** |
|
| 1956 | + * @return \OCP\Command\IBus |
|
| 1957 | + * @deprecated 20.0.0 |
|
| 1958 | + */ |
|
| 1959 | + public function getCommandBus() { |
|
| 1960 | + return $this->get(IBus::class); |
|
| 1961 | + } |
|
| 1962 | + |
|
| 1963 | + /** |
|
| 1964 | + * Get the trusted domain helper |
|
| 1965 | + * |
|
| 1966 | + * @return TrustedDomainHelper |
|
| 1967 | + * @deprecated 20.0.0 |
|
| 1968 | + */ |
|
| 1969 | + public function getTrustedDomainHelper() { |
|
| 1970 | + return $this->get(TrustedDomainHelper::class); |
|
| 1971 | + } |
|
| 1972 | + |
|
| 1973 | + /** |
|
| 1974 | + * Get the locking provider |
|
| 1975 | + * |
|
| 1976 | + * @return ILockingProvider |
|
| 1977 | + * @since 8.1.0 |
|
| 1978 | + * @deprecated 20.0.0 |
|
| 1979 | + */ |
|
| 1980 | + public function getLockingProvider() { |
|
| 1981 | + return $this->get(ILockingProvider::class); |
|
| 1982 | + } |
|
| 1983 | + |
|
| 1984 | + /** |
|
| 1985 | + * @return IMountManager |
|
| 1986 | + * @deprecated 20.0.0 |
|
| 1987 | + **/ |
|
| 1988 | + public function getMountManager() { |
|
| 1989 | + return $this->get(IMountManager::class); |
|
| 1990 | + } |
|
| 1991 | + |
|
| 1992 | + /** |
|
| 1993 | + * @return IUserMountCache |
|
| 1994 | + * @deprecated 20.0.0 |
|
| 1995 | + */ |
|
| 1996 | + public function getUserMountCache() { |
|
| 1997 | + return $this->get(IUserMountCache::class); |
|
| 1998 | + } |
|
| 1999 | + |
|
| 2000 | + /** |
|
| 2001 | + * Get the MimeTypeDetector |
|
| 2002 | + * |
|
| 2003 | + * @return IMimeTypeDetector |
|
| 2004 | + * @deprecated 20.0.0 |
|
| 2005 | + */ |
|
| 2006 | + public function getMimeTypeDetector() { |
|
| 2007 | + return $this->get(IMimeTypeDetector::class); |
|
| 2008 | + } |
|
| 2009 | + |
|
| 2010 | + /** |
|
| 2011 | + * Get the MimeTypeLoader |
|
| 2012 | + * |
|
| 2013 | + * @return IMimeTypeLoader |
|
| 2014 | + * @deprecated 20.0.0 |
|
| 2015 | + */ |
|
| 2016 | + public function getMimeTypeLoader() { |
|
| 2017 | + return $this->get(IMimeTypeLoader::class); |
|
| 2018 | + } |
|
| 2019 | + |
|
| 2020 | + /** |
|
| 2021 | + * Get the manager of all the capabilities |
|
| 2022 | + * |
|
| 2023 | + * @return CapabilitiesManager |
|
| 2024 | + * @deprecated 20.0.0 |
|
| 2025 | + */ |
|
| 2026 | + public function getCapabilitiesManager() { |
|
| 2027 | + return $this->get(CapabilitiesManager::class); |
|
| 2028 | + } |
|
| 2029 | + |
|
| 2030 | + /** |
|
| 2031 | + * Get the EventDispatcher |
|
| 2032 | + * |
|
| 2033 | + * @return EventDispatcherInterface |
|
| 2034 | + * @since 8.2.0 |
|
| 2035 | + * @deprecated 18.0.0 use \OCP\EventDispatcher\IEventDispatcher |
|
| 2036 | + */ |
|
| 2037 | + public function getEventDispatcher() { |
|
| 2038 | + return $this->get(\OC\EventDispatcher\SymfonyAdapter::class); |
|
| 2039 | + } |
|
| 2040 | + |
|
| 2041 | + /** |
|
| 2042 | + * Get the Notification Manager |
|
| 2043 | + * |
|
| 2044 | + * @return \OCP\Notification\IManager |
|
| 2045 | + * @since 8.2.0 |
|
| 2046 | + * @deprecated 20.0.0 |
|
| 2047 | + */ |
|
| 2048 | + public function getNotificationManager() { |
|
| 2049 | + return $this->get(\OCP\Notification\IManager::class); |
|
| 2050 | + } |
|
| 2051 | + |
|
| 2052 | + /** |
|
| 2053 | + * @return ICommentsManager |
|
| 2054 | + * @deprecated 20.0.0 |
|
| 2055 | + */ |
|
| 2056 | + public function getCommentsManager() { |
|
| 2057 | + return $this->get(ICommentsManager::class); |
|
| 2058 | + } |
|
| 2059 | + |
|
| 2060 | + /** |
|
| 2061 | + * @return \OCA\Theming\ThemingDefaults |
|
| 2062 | + * @deprecated 20.0.0 |
|
| 2063 | + */ |
|
| 2064 | + public function getThemingDefaults() { |
|
| 2065 | + return $this->get('ThemingDefaults'); |
|
| 2066 | + } |
|
| 2067 | + |
|
| 2068 | + /** |
|
| 2069 | + * @return \OC\IntegrityCheck\Checker |
|
| 2070 | + * @deprecated 20.0.0 |
|
| 2071 | + */ |
|
| 2072 | + public function getIntegrityCodeChecker() { |
|
| 2073 | + return $this->get('IntegrityCodeChecker'); |
|
| 2074 | + } |
|
| 2075 | + |
|
| 2076 | + /** |
|
| 2077 | + * @return \OC\Session\CryptoWrapper |
|
| 2078 | + * @deprecated 20.0.0 |
|
| 2079 | + */ |
|
| 2080 | + public function getSessionCryptoWrapper() { |
|
| 2081 | + return $this->get('CryptoWrapper'); |
|
| 2082 | + } |
|
| 2083 | + |
|
| 2084 | + /** |
|
| 2085 | + * @return CsrfTokenManager |
|
| 2086 | + * @deprecated 20.0.0 |
|
| 2087 | + */ |
|
| 2088 | + public function getCsrfTokenManager() { |
|
| 2089 | + return $this->get(CsrfTokenManager::class); |
|
| 2090 | + } |
|
| 2091 | + |
|
| 2092 | + /** |
|
| 2093 | + * @return Throttler |
|
| 2094 | + * @deprecated 20.0.0 |
|
| 2095 | + */ |
|
| 2096 | + public function getBruteForceThrottler() { |
|
| 2097 | + return $this->get(Throttler::class); |
|
| 2098 | + } |
|
| 2099 | + |
|
| 2100 | + /** |
|
| 2101 | + * @return IContentSecurityPolicyManager |
|
| 2102 | + * @deprecated 20.0.0 |
|
| 2103 | + */ |
|
| 2104 | + public function getContentSecurityPolicyManager() { |
|
| 2105 | + return $this->get(ContentSecurityPolicyManager::class); |
|
| 2106 | + } |
|
| 2107 | + |
|
| 2108 | + /** |
|
| 2109 | + * @return ContentSecurityPolicyNonceManager |
|
| 2110 | + * @deprecated 20.0.0 |
|
| 2111 | + */ |
|
| 2112 | + public function getContentSecurityPolicyNonceManager() { |
|
| 2113 | + return $this->get(ContentSecurityPolicyNonceManager::class); |
|
| 2114 | + } |
|
| 2115 | + |
|
| 2116 | + /** |
|
| 2117 | + * Not a public API as of 8.2, wait for 9.0 |
|
| 2118 | + * |
|
| 2119 | + * @return \OCA\Files_External\Service\BackendService |
|
| 2120 | + * @deprecated 20.0.0 |
|
| 2121 | + */ |
|
| 2122 | + public function getStoragesBackendService() { |
|
| 2123 | + return $this->get(BackendService::class); |
|
| 2124 | + } |
|
| 2125 | + |
|
| 2126 | + /** |
|
| 2127 | + * Not a public API as of 8.2, wait for 9.0 |
|
| 2128 | + * |
|
| 2129 | + * @return \OCA\Files_External\Service\GlobalStoragesService |
|
| 2130 | + * @deprecated 20.0.0 |
|
| 2131 | + */ |
|
| 2132 | + public function getGlobalStoragesService() { |
|
| 2133 | + return $this->get(GlobalStoragesService::class); |
|
| 2134 | + } |
|
| 2135 | + |
|
| 2136 | + /** |
|
| 2137 | + * Not a public API as of 8.2, wait for 9.0 |
|
| 2138 | + * |
|
| 2139 | + * @return \OCA\Files_External\Service\UserGlobalStoragesService |
|
| 2140 | + * @deprecated 20.0.0 |
|
| 2141 | + */ |
|
| 2142 | + public function getUserGlobalStoragesService() { |
|
| 2143 | + return $this->get(UserGlobalStoragesService::class); |
|
| 2144 | + } |
|
| 2145 | + |
|
| 2146 | + /** |
|
| 2147 | + * Not a public API as of 8.2, wait for 9.0 |
|
| 2148 | + * |
|
| 2149 | + * @return \OCA\Files_External\Service\UserStoragesService |
|
| 2150 | + * @deprecated 20.0.0 |
|
| 2151 | + */ |
|
| 2152 | + public function getUserStoragesService() { |
|
| 2153 | + return $this->get(UserStoragesService::class); |
|
| 2154 | + } |
|
| 2155 | + |
|
| 2156 | + /** |
|
| 2157 | + * @return \OCP\Share\IManager |
|
| 2158 | + * @deprecated 20.0.0 |
|
| 2159 | + */ |
|
| 2160 | + public function getShareManager() { |
|
| 2161 | + return $this->get(\OCP\Share\IManager::class); |
|
| 2162 | + } |
|
| 2163 | + |
|
| 2164 | + /** |
|
| 2165 | + * @return \OCP\Collaboration\Collaborators\ISearch |
|
| 2166 | + * @deprecated 20.0.0 |
|
| 2167 | + */ |
|
| 2168 | + public function getCollaboratorSearch() { |
|
| 2169 | + return $this->get(\OCP\Collaboration\Collaborators\ISearch::class); |
|
| 2170 | + } |
|
| 2171 | + |
|
| 2172 | + /** |
|
| 2173 | + * @return \OCP\Collaboration\AutoComplete\IManager |
|
| 2174 | + * @deprecated 20.0.0 |
|
| 2175 | + */ |
|
| 2176 | + public function getAutoCompleteManager() { |
|
| 2177 | + return $this->get(IManager::class); |
|
| 2178 | + } |
|
| 2179 | + |
|
| 2180 | + /** |
|
| 2181 | + * Returns the LDAP Provider |
|
| 2182 | + * |
|
| 2183 | + * @return \OCP\LDAP\ILDAPProvider |
|
| 2184 | + * @deprecated 20.0.0 |
|
| 2185 | + */ |
|
| 2186 | + public function getLDAPProvider() { |
|
| 2187 | + return $this->get('LDAPProvider'); |
|
| 2188 | + } |
|
| 2189 | + |
|
| 2190 | + /** |
|
| 2191 | + * @return \OCP\Settings\IManager |
|
| 2192 | + * @deprecated 20.0.0 |
|
| 2193 | + */ |
|
| 2194 | + public function getSettingsManager() { |
|
| 2195 | + return $this->get(\OC\Settings\Manager::class); |
|
| 2196 | + } |
|
| 2197 | + |
|
| 2198 | + /** |
|
| 2199 | + * @return \OCP\Files\IAppData |
|
| 2200 | + * @deprecated 20.0.0 |
|
| 2201 | + */ |
|
| 2202 | + public function getAppDataDir($app) { |
|
| 2203 | + /** @var \OC\Files\AppData\Factory $factory */ |
|
| 2204 | + $factory = $this->get(\OC\Files\AppData\Factory::class); |
|
| 2205 | + return $factory->get($app); |
|
| 2206 | + } |
|
| 2207 | + |
|
| 2208 | + /** |
|
| 2209 | + * @return \OCP\Lockdown\ILockdownManager |
|
| 2210 | + * @deprecated 20.0.0 |
|
| 2211 | + */ |
|
| 2212 | + public function getLockdownManager() { |
|
| 2213 | + return $this->get('LockdownManager'); |
|
| 2214 | + } |
|
| 2215 | + |
|
| 2216 | + /** |
|
| 2217 | + * @return \OCP\Federation\ICloudIdManager |
|
| 2218 | + * @deprecated 20.0.0 |
|
| 2219 | + */ |
|
| 2220 | + public function getCloudIdManager() { |
|
| 2221 | + return $this->get(ICloudIdManager::class); |
|
| 2222 | + } |
|
| 2223 | + |
|
| 2224 | + /** |
|
| 2225 | + * @return \OCP\GlobalScale\IConfig |
|
| 2226 | + * @deprecated 20.0.0 |
|
| 2227 | + */ |
|
| 2228 | + public function getGlobalScaleConfig() { |
|
| 2229 | + return $this->get(IConfig::class); |
|
| 2230 | + } |
|
| 2231 | + |
|
| 2232 | + /** |
|
| 2233 | + * @return \OCP\Federation\ICloudFederationProviderManager |
|
| 2234 | + * @deprecated 20.0.0 |
|
| 2235 | + */ |
|
| 2236 | + public function getCloudFederationProviderManager() { |
|
| 2237 | + return $this->get(ICloudFederationProviderManager::class); |
|
| 2238 | + } |
|
| 2239 | + |
|
| 2240 | + /** |
|
| 2241 | + * @return \OCP\Remote\Api\IApiFactory |
|
| 2242 | + * @deprecated 20.0.0 |
|
| 2243 | + */ |
|
| 2244 | + public function getRemoteApiFactory() { |
|
| 2245 | + return $this->get(IApiFactory::class); |
|
| 2246 | + } |
|
| 2247 | + |
|
| 2248 | + /** |
|
| 2249 | + * @return \OCP\Federation\ICloudFederationFactory |
|
| 2250 | + * @deprecated 20.0.0 |
|
| 2251 | + */ |
|
| 2252 | + public function getCloudFederationFactory() { |
|
| 2253 | + return $this->get(ICloudFederationFactory::class); |
|
| 2254 | + } |
|
| 2255 | + |
|
| 2256 | + /** |
|
| 2257 | + * @return \OCP\Remote\IInstanceFactory |
|
| 2258 | + * @deprecated 20.0.0 |
|
| 2259 | + */ |
|
| 2260 | + public function getRemoteInstanceFactory() { |
|
| 2261 | + return $this->get(IInstanceFactory::class); |
|
| 2262 | + } |
|
| 2263 | + |
|
| 2264 | + /** |
|
| 2265 | + * @return IStorageFactory |
|
| 2266 | + * @deprecated 20.0.0 |
|
| 2267 | + */ |
|
| 2268 | + public function getStorageFactory() { |
|
| 2269 | + return $this->get(IStorageFactory::class); |
|
| 2270 | + } |
|
| 2271 | + |
|
| 2272 | + /** |
|
| 2273 | + * Get the Preview GeneratorHelper |
|
| 2274 | + * |
|
| 2275 | + * @return GeneratorHelper |
|
| 2276 | + * @since 17.0.0 |
|
| 2277 | + * @deprecated 20.0.0 |
|
| 2278 | + */ |
|
| 2279 | + public function getGeneratorHelper() { |
|
| 2280 | + return $this->get(\OC\Preview\GeneratorHelper::class); |
|
| 2281 | + } |
|
| 2282 | + |
|
| 2283 | + private function registerDeprecatedAlias(string $alias, string $target) { |
|
| 2284 | + $this->registerService($alias, function (ContainerInterface $container) use ($target, $alias) { |
|
| 2285 | + try { |
|
| 2286 | + /** @var ILogger $logger */ |
|
| 2287 | + $logger = $container->get(ILogger::class); |
|
| 2288 | + $logger->debug('The requested alias "' . $alias . '" is deprecated. Please request "' . $target . '" directly. This alias will be removed in a future Nextcloud version.', ['app' => 'serverDI']); |
|
| 2289 | + } catch (ContainerExceptionInterface $e) { |
|
| 2290 | + // Could not get logger. Continue |
|
| 2291 | + } |
|
| 2292 | + |
|
| 2293 | + return $container->get($target); |
|
| 2294 | + }, false); |
|
| 2295 | + } |
|
| 2296 | 2296 | } |
@@ -264,10 +264,10 @@ discard block |
||
| 264 | 264 | $this->registerParameter('isCLI', \OC::$CLI); |
| 265 | 265 | $this->registerParameter('serverRoot', \OC::$SERVERROOT); |
| 266 | 266 | |
| 267 | - $this->registerService(ContainerInterface::class, function (ContainerInterface $c) { |
|
| 267 | + $this->registerService(ContainerInterface::class, function(ContainerInterface $c) { |
|
| 268 | 268 | return $c; |
| 269 | 269 | }); |
| 270 | - $this->registerService(\OCP\IServerContainer::class, function (ContainerInterface $c) { |
|
| 270 | + $this->registerService(\OCP\IServerContainer::class, function(ContainerInterface $c) { |
|
| 271 | 271 | return $c; |
| 272 | 272 | }); |
| 273 | 273 | |
@@ -291,11 +291,11 @@ discard block |
||
| 291 | 291 | |
| 292 | 292 | $this->registerAlias(IActionFactory::class, ActionFactory::class); |
| 293 | 293 | |
| 294 | - $this->registerService(View::class, function (Server $c) { |
|
| 294 | + $this->registerService(View::class, function(Server $c) { |
|
| 295 | 295 | return new View(); |
| 296 | 296 | }, false); |
| 297 | 297 | |
| 298 | - $this->registerService(IPreview::class, function (ContainerInterface $c) { |
|
| 298 | + $this->registerService(IPreview::class, function(ContainerInterface $c) { |
|
| 299 | 299 | return new PreviewManager( |
| 300 | 300 | $c->get(\OCP\IConfig::class), |
| 301 | 301 | $c->get(IRootFolder::class), |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | /** @deprecated 19.0.0 */ |
| 312 | 312 | $this->registerDeprecatedAlias('PreviewManager', IPreview::class); |
| 313 | 313 | |
| 314 | - $this->registerService(\OC\Preview\Watcher::class, function (ContainerInterface $c) { |
|
| 314 | + $this->registerService(\OC\Preview\Watcher::class, function(ContainerInterface $c) { |
|
| 315 | 315 | return new \OC\Preview\Watcher( |
| 316 | 316 | new \OC\Preview\Storage\Root( |
| 317 | 317 | $c->get(IRootFolder::class), |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | ); |
| 321 | 321 | }); |
| 322 | 322 | |
| 323 | - $this->registerService(\OCP\Encryption\IManager::class, function (Server $c) { |
|
| 323 | + $this->registerService(\OCP\Encryption\IManager::class, function(Server $c) { |
|
| 324 | 324 | $view = new View(); |
| 325 | 325 | $util = new Encryption\Util( |
| 326 | 326 | $view, |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | /** @deprecated 21.0.0 */ |
| 344 | 344 | $this->registerDeprecatedAlias('EncryptionFileHelper', IFile::class); |
| 345 | - $this->registerService(IFile::class, function (ContainerInterface $c) { |
|
| 345 | + $this->registerService(IFile::class, function(ContainerInterface $c) { |
|
| 346 | 346 | $util = new Encryption\Util( |
| 347 | 347 | new View(), |
| 348 | 348 | $c->get(IUserManager::class), |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | |
| 359 | 359 | /** @deprecated 21.0.0 */ |
| 360 | 360 | $this->registerDeprecatedAlias('EncryptionKeyStorage', IStorage::class); |
| 361 | - $this->registerService(IStorage::class, function (ContainerInterface $c) { |
|
| 361 | + $this->registerService(IStorage::class, function(ContainerInterface $c) { |
|
| 362 | 362 | $view = new View(); |
| 363 | 363 | $util = new Encryption\Util( |
| 364 | 364 | $view, |
@@ -381,22 +381,22 @@ discard block |
||
| 381 | 381 | /** @deprecated 19.0.0 */ |
| 382 | 382 | $this->registerDeprecatedAlias('TagManager', \OCP\ITagManager::class); |
| 383 | 383 | |
| 384 | - $this->registerService('SystemTagManagerFactory', function (ContainerInterface $c) { |
|
| 384 | + $this->registerService('SystemTagManagerFactory', function(ContainerInterface $c) { |
|
| 385 | 385 | /** @var \OCP\IConfig $config */ |
| 386 | 386 | $config = $c->get(\OCP\IConfig::class); |
| 387 | 387 | $factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class); |
| 388 | 388 | return new $factoryClass($this); |
| 389 | 389 | }); |
| 390 | - $this->registerService(ISystemTagManager::class, function (ContainerInterface $c) { |
|
| 390 | + $this->registerService(ISystemTagManager::class, function(ContainerInterface $c) { |
|
| 391 | 391 | return $c->get('SystemTagManagerFactory')->getManager(); |
| 392 | 392 | }); |
| 393 | 393 | /** @deprecated 19.0.0 */ |
| 394 | 394 | $this->registerDeprecatedAlias('SystemTagManager', ISystemTagManager::class); |
| 395 | 395 | |
| 396 | - $this->registerService(ISystemTagObjectMapper::class, function (ContainerInterface $c) { |
|
| 396 | + $this->registerService(ISystemTagObjectMapper::class, function(ContainerInterface $c) { |
|
| 397 | 397 | return $c->get('SystemTagManagerFactory')->getObjectMapper(); |
| 398 | 398 | }); |
| 399 | - $this->registerService('RootFolder', function (ContainerInterface $c) { |
|
| 399 | + $this->registerService('RootFolder', function(ContainerInterface $c) { |
|
| 400 | 400 | $manager = \OC\Files\Filesystem::getMountManager(null); |
| 401 | 401 | $view = new View(); |
| 402 | 402 | $root = new Root( |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | |
| 417 | 417 | return $root; |
| 418 | 418 | }); |
| 419 | - $this->registerService(HookConnector::class, function (ContainerInterface $c) { |
|
| 419 | + $this->registerService(HookConnector::class, function(ContainerInterface $c) { |
|
| 420 | 420 | return new HookConnector( |
| 421 | 421 | $c->get(IRootFolder::class), |
| 422 | 422 | new View(), |
@@ -428,8 +428,8 @@ discard block |
||
| 428 | 428 | /** @deprecated 19.0.0 */ |
| 429 | 429 | $this->registerDeprecatedAlias('SystemTagObjectMapper', ISystemTagObjectMapper::class); |
| 430 | 430 | |
| 431 | - $this->registerService(IRootFolder::class, function (ContainerInterface $c) { |
|
| 432 | - return new LazyRoot(function () use ($c) { |
|
| 431 | + $this->registerService(IRootFolder::class, function(ContainerInterface $c) { |
|
| 432 | + return new LazyRoot(function() use ($c) { |
|
| 433 | 433 | return $c->get('RootFolder'); |
| 434 | 434 | }); |
| 435 | 435 | }); |
@@ -440,44 +440,44 @@ discard block |
||
| 440 | 440 | $this->registerDeprecatedAlias('UserManager', \OC\User\Manager::class); |
| 441 | 441 | $this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class); |
| 442 | 442 | |
| 443 | - $this->registerService(\OCP\IGroupManager::class, function (ContainerInterface $c) { |
|
| 443 | + $this->registerService(\OCP\IGroupManager::class, function(ContainerInterface $c) { |
|
| 444 | 444 | $groupManager = new \OC\Group\Manager($this->get(IUserManager::class), $c->get(SymfonyAdapter::class), $this->get(ILogger::class)); |
| 445 | - $groupManager->listen('\OC\Group', 'preCreate', function ($gid) { |
|
| 445 | + $groupManager->listen('\OC\Group', 'preCreate', function($gid) { |
|
| 446 | 446 | /** @var IEventDispatcher $dispatcher */ |
| 447 | 447 | $dispatcher = $this->get(IEventDispatcher::class); |
| 448 | 448 | $dispatcher->dispatchTyped(new BeforeGroupCreatedEvent($gid)); |
| 449 | 449 | }); |
| 450 | - $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $group) { |
|
| 450 | + $groupManager->listen('\OC\Group', 'postCreate', function(\OC\Group\Group $group) { |
|
| 451 | 451 | /** @var IEventDispatcher $dispatcher */ |
| 452 | 452 | $dispatcher = $this->get(IEventDispatcher::class); |
| 453 | 453 | $dispatcher->dispatchTyped(new GroupCreatedEvent($group)); |
| 454 | 454 | }); |
| 455 | - $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) { |
|
| 455 | + $groupManager->listen('\OC\Group', 'preDelete', function(\OC\Group\Group $group) { |
|
| 456 | 456 | /** @var IEventDispatcher $dispatcher */ |
| 457 | 457 | $dispatcher = $this->get(IEventDispatcher::class); |
| 458 | 458 | $dispatcher->dispatchTyped(new BeforeGroupDeletedEvent($group)); |
| 459 | 459 | }); |
| 460 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) { |
|
| 460 | + $groupManager->listen('\OC\Group', 'postDelete', function(\OC\Group\Group $group) { |
|
| 461 | 461 | /** @var IEventDispatcher $dispatcher */ |
| 462 | 462 | $dispatcher = $this->get(IEventDispatcher::class); |
| 463 | 463 | $dispatcher->dispatchTyped(new GroupDeletedEvent($group)); |
| 464 | 464 | }); |
| 465 | - $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 465 | + $groupManager->listen('\OC\Group', 'preAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
| 466 | 466 | /** @var IEventDispatcher $dispatcher */ |
| 467 | 467 | $dispatcher = $this->get(IEventDispatcher::class); |
| 468 | 468 | $dispatcher->dispatchTyped(new BeforeUserAddedEvent($group, $user)); |
| 469 | 469 | }); |
| 470 | - $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 470 | + $groupManager->listen('\OC\Group', 'postAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
| 471 | 471 | /** @var IEventDispatcher $dispatcher */ |
| 472 | 472 | $dispatcher = $this->get(IEventDispatcher::class); |
| 473 | 473 | $dispatcher->dispatchTyped(new UserAddedEvent($group, $user)); |
| 474 | 474 | }); |
| 475 | - $groupManager->listen('\OC\Group', 'preRemoveUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 475 | + $groupManager->listen('\OC\Group', 'preRemoveUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
| 476 | 476 | /** @var IEventDispatcher $dispatcher */ |
| 477 | 477 | $dispatcher = $this->get(IEventDispatcher::class); |
| 478 | 478 | $dispatcher->dispatchTyped(new BeforeUserRemovedEvent($group, $user)); |
| 479 | 479 | }); |
| 480 | - $groupManager->listen('\OC\Group', 'postRemoveUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 480 | + $groupManager->listen('\OC\Group', 'postRemoveUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
| 481 | 481 | /** @var IEventDispatcher $dispatcher */ |
| 482 | 482 | $dispatcher = $this->get(IEventDispatcher::class); |
| 483 | 483 | $dispatcher->dispatchTyped(new UserRemovedEvent($group, $user)); |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | /** @deprecated 19.0.0 */ |
| 488 | 488 | $this->registerDeprecatedAlias('GroupManager', \OCP\IGroupManager::class); |
| 489 | 489 | |
| 490 | - $this->registerService(Store::class, function (ContainerInterface $c) { |
|
| 490 | + $this->registerService(Store::class, function(ContainerInterface $c) { |
|
| 491 | 491 | $session = $c->get(ISession::class); |
| 492 | 492 | if (\OC::$server->get(SystemConfig::class)->getValue('installed', false)) { |
| 493 | 493 | $tokenProvider = $c->get(IProvider::class); |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | $this->registerAlias(IStore::class, Store::class); |
| 501 | 501 | $this->registerAlias(IProvider::class, Authentication\Token\Manager::class); |
| 502 | 502 | |
| 503 | - $this->registerService(\OC\User\Session::class, function (Server $c) { |
|
| 503 | + $this->registerService(\OC\User\Session::class, function(Server $c) { |
|
| 504 | 504 | $manager = $c->get(IUserManager::class); |
| 505 | 505 | $session = new \OC\Session\Memory(''); |
| 506 | 506 | $timeFactory = new TimeFactory(); |
@@ -525,18 +525,18 @@ discard block |
||
| 525 | 525 | $c->get(ILogger::class), |
| 526 | 526 | $c->get(IEventDispatcher::class) |
| 527 | 527 | ); |
| 528 | - $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { |
|
| 528 | + $userSession->listen('\OC\User', 'preCreateUser', function($uid, $password) { |
|
| 529 | 529 | \OC_Hook::emit('OC_User', 'pre_createUser', ['run' => true, 'uid' => $uid, 'password' => $password]); |
| 530 | 530 | |
| 531 | 531 | /** @var IEventDispatcher $dispatcher */ |
| 532 | 532 | $dispatcher = $this->get(IEventDispatcher::class); |
| 533 | 533 | $dispatcher->dispatchTyped(new BeforeUserCreatedEvent($uid, $password)); |
| 534 | 534 | }); |
| 535 | - $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) { |
|
| 535 | + $userSession->listen('\OC\User', 'postCreateUser', function($user, $password) { |
|
| 536 | 536 | /** @var \OC\User\User $user */ |
| 537 | 537 | \OC_Hook::emit('OC_User', 'post_createUser', ['uid' => $user->getUID(), 'password' => $password]); |
| 538 | 538 | }); |
| 539 | - $userSession->listen('\OC\User', 'preDelete', function ($user) use ($legacyDispatcher) { |
|
| 539 | + $userSession->listen('\OC\User', 'preDelete', function($user) use ($legacyDispatcher) { |
|
| 540 | 540 | /** @var \OC\User\User $user */ |
| 541 | 541 | \OC_Hook::emit('OC_User', 'pre_deleteUser', ['run' => true, 'uid' => $user->getUID()]); |
| 542 | 542 | $legacyDispatcher->dispatch('OCP\IUser::preDelete', new GenericEvent($user)); |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | $dispatcher = $this->get(IEventDispatcher::class); |
| 546 | 546 | $dispatcher->dispatchTyped(new BeforeUserDeletedEvent($user)); |
| 547 | 547 | }); |
| 548 | - $userSession->listen('\OC\User', 'postDelete', function ($user) { |
|
| 548 | + $userSession->listen('\OC\User', 'postDelete', function($user) { |
|
| 549 | 549 | /** @var \OC\User\User $user */ |
| 550 | 550 | \OC_Hook::emit('OC_User', 'post_deleteUser', ['uid' => $user->getUID()]); |
| 551 | 551 | |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | $dispatcher = $this->get(IEventDispatcher::class); |
| 554 | 554 | $dispatcher->dispatchTyped(new UserDeletedEvent($user)); |
| 555 | 555 | }); |
| 556 | - $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) { |
|
| 556 | + $userSession->listen('\OC\User', 'preSetPassword', function($user, $password, $recoveryPassword) { |
|
| 557 | 557 | /** @var \OC\User\User $user */ |
| 558 | 558 | \OC_Hook::emit('OC_User', 'pre_setPassword', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword]); |
| 559 | 559 | |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | $dispatcher = $this->get(IEventDispatcher::class); |
| 562 | 562 | $dispatcher->dispatchTyped(new BeforePasswordUpdatedEvent($user, $password, $recoveryPassword)); |
| 563 | 563 | }); |
| 564 | - $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) { |
|
| 564 | + $userSession->listen('\OC\User', 'postSetPassword', function($user, $password, $recoveryPassword) { |
|
| 565 | 565 | /** @var \OC\User\User $user */ |
| 566 | 566 | \OC_Hook::emit('OC_User', 'post_setPassword', ['run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword]); |
| 567 | 567 | |
@@ -569,14 +569,14 @@ discard block |
||
| 569 | 569 | $dispatcher = $this->get(IEventDispatcher::class); |
| 570 | 570 | $dispatcher->dispatchTyped(new PasswordUpdatedEvent($user, $password, $recoveryPassword)); |
| 571 | 571 | }); |
| 572 | - $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) { |
|
| 572 | + $userSession->listen('\OC\User', 'preLogin', function($uid, $password) { |
|
| 573 | 573 | \OC_Hook::emit('OC_User', 'pre_login', ['run' => true, 'uid' => $uid, 'password' => $password]); |
| 574 | 574 | |
| 575 | 575 | /** @var IEventDispatcher $dispatcher */ |
| 576 | 576 | $dispatcher = $this->get(IEventDispatcher::class); |
| 577 | 577 | $dispatcher->dispatchTyped(new BeforeUserLoggedInEvent($uid, $password)); |
| 578 | 578 | }); |
| 579 | - $userSession->listen('\OC\User', 'postLogin', function ($user, $loginName, $password, $isTokenLogin) { |
|
| 579 | + $userSession->listen('\OC\User', 'postLogin', function($user, $loginName, $password, $isTokenLogin) { |
|
| 580 | 580 | /** @var \OC\User\User $user */ |
| 581 | 581 | \OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $user->getUID(), 'loginName' => $loginName, 'password' => $password, 'isTokenLogin' => $isTokenLogin]); |
| 582 | 582 | |
@@ -584,12 +584,12 @@ discard block |
||
| 584 | 584 | $dispatcher = $this->get(IEventDispatcher::class); |
| 585 | 585 | $dispatcher->dispatchTyped(new UserLoggedInEvent($user, $password, $isTokenLogin)); |
| 586 | 586 | }); |
| 587 | - $userSession->listen('\OC\User', 'preRememberedLogin', function ($uid) { |
|
| 587 | + $userSession->listen('\OC\User', 'preRememberedLogin', function($uid) { |
|
| 588 | 588 | /** @var IEventDispatcher $dispatcher */ |
| 589 | 589 | $dispatcher = $this->get(IEventDispatcher::class); |
| 590 | 590 | $dispatcher->dispatchTyped(new BeforeUserLoggedInWithCookieEvent($uid)); |
| 591 | 591 | }); |
| 592 | - $userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) { |
|
| 592 | + $userSession->listen('\OC\User', 'postRememberedLogin', function($user, $password) { |
|
| 593 | 593 | /** @var \OC\User\User $user */ |
| 594 | 594 | \OC_Hook::emit('OC_User', 'post_login', ['run' => true, 'uid' => $user->getUID(), 'password' => $password]); |
| 595 | 595 | |
@@ -597,19 +597,19 @@ discard block |
||
| 597 | 597 | $dispatcher = $this->get(IEventDispatcher::class); |
| 598 | 598 | $dispatcher->dispatchTyped(new UserLoggedInWithCookieEvent($user, $password)); |
| 599 | 599 | }); |
| 600 | - $userSession->listen('\OC\User', 'logout', function ($user) { |
|
| 600 | + $userSession->listen('\OC\User', 'logout', function($user) { |
|
| 601 | 601 | \OC_Hook::emit('OC_User', 'logout', []); |
| 602 | 602 | |
| 603 | 603 | /** @var IEventDispatcher $dispatcher */ |
| 604 | 604 | $dispatcher = $this->get(IEventDispatcher::class); |
| 605 | 605 | $dispatcher->dispatchTyped(new BeforeUserLoggedOutEvent($user)); |
| 606 | 606 | }); |
| 607 | - $userSession->listen('\OC\User', 'postLogout', function ($user) { |
|
| 607 | + $userSession->listen('\OC\User', 'postLogout', function($user) { |
|
| 608 | 608 | /** @var IEventDispatcher $dispatcher */ |
| 609 | 609 | $dispatcher = $this->get(IEventDispatcher::class); |
| 610 | 610 | $dispatcher->dispatchTyped(new UserLoggedOutEvent($user)); |
| 611 | 611 | }); |
| 612 | - $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) { |
|
| 612 | + $userSession->listen('\OC\User', 'changeUser', function($user, $feature, $value, $oldValue) { |
|
| 613 | 613 | /** @var \OC\User\User $user */ |
| 614 | 614 | \OC_Hook::emit('OC_User', 'changeUser', ['run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue]); |
| 615 | 615 | |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | $this->registerDeprecatedAlias('AllConfig', \OC\AllConfig::class); |
| 634 | 634 | $this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class); |
| 635 | 635 | |
| 636 | - $this->registerService(\OC\SystemConfig::class, function ($c) use ($config) { |
|
| 636 | + $this->registerService(\OC\SystemConfig::class, function($c) use ($config) { |
|
| 637 | 637 | return new \OC\SystemConfig($config); |
| 638 | 638 | }); |
| 639 | 639 | /** @deprecated 19.0.0 */ |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | $this->registerDeprecatedAlias('AppConfig', \OC\AppConfig::class); |
| 644 | 644 | $this->registerAlias(IAppConfig::class, \OC\AppConfig::class); |
| 645 | 645 | |
| 646 | - $this->registerService(IFactory::class, function (Server $c) { |
|
| 646 | + $this->registerService(IFactory::class, function(Server $c) { |
|
| 647 | 647 | return new \OC\L10N\Factory( |
| 648 | 648 | $c->get(\OCP\IConfig::class), |
| 649 | 649 | $c->getRequest(), |
@@ -663,13 +663,13 @@ discard block |
||
| 663 | 663 | /** @deprecated 19.0.0 */ |
| 664 | 664 | $this->registerDeprecatedAlias('CategoryFetcher', CategoryFetcher::class); |
| 665 | 665 | |
| 666 | - $this->registerService(ICache::class, function ($c) { |
|
| 666 | + $this->registerService(ICache::class, function($c) { |
|
| 667 | 667 | return new Cache\File(); |
| 668 | 668 | }); |
| 669 | 669 | /** @deprecated 19.0.0 */ |
| 670 | 670 | $this->registerDeprecatedAlias('UserCache', ICache::class); |
| 671 | 671 | |
| 672 | - $this->registerService(Factory::class, function (Server $c) { |
|
| 672 | + $this->registerService(Factory::class, function(Server $c) { |
|
| 673 | 673 | $arrayCacheFactory = new \OC\Memcache\Factory('', $c->get(ILogger::class), |
| 674 | 674 | ArrayCache::class, |
| 675 | 675 | ArrayCache::class, |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | $version = implode(',', $v); |
| 685 | 685 | $instanceId = \OC_Util::getInstanceId(); |
| 686 | 686 | $path = \OC::$SERVERROOT; |
| 687 | - $prefix = md5($instanceId . '-' . $version . '-' . $path); |
|
| 687 | + $prefix = md5($instanceId.'-'.$version.'-'.$path); |
|
| 688 | 688 | return new \OC\Memcache\Factory($prefix, $c->get(ILogger::class), |
| 689 | 689 | $config->getSystemValue('memcache.local', null), |
| 690 | 690 | $config->getSystemValue('memcache.distributed', null), |
@@ -697,12 +697,12 @@ discard block |
||
| 697 | 697 | $this->registerDeprecatedAlias('MemCacheFactory', Factory::class); |
| 698 | 698 | $this->registerAlias(ICacheFactory::class, Factory::class); |
| 699 | 699 | |
| 700 | - $this->registerService('RedisFactory', function (Server $c) { |
|
| 700 | + $this->registerService('RedisFactory', function(Server $c) { |
|
| 701 | 701 | $systemConfig = $c->get(SystemConfig::class); |
| 702 | 702 | return new RedisFactory($systemConfig); |
| 703 | 703 | }); |
| 704 | 704 | |
| 705 | - $this->registerService(\OCP\Activity\IManager::class, function (Server $c) { |
|
| 705 | + $this->registerService(\OCP\Activity\IManager::class, function(Server $c) { |
|
| 706 | 706 | $l10n = $this->get(IFactory::class)->get('lib'); |
| 707 | 707 | return new \OC\Activity\Manager( |
| 708 | 708 | $c->getRequest(), |
@@ -715,14 +715,14 @@ discard block |
||
| 715 | 715 | /** @deprecated 19.0.0 */ |
| 716 | 716 | $this->registerDeprecatedAlias('ActivityManager', \OCP\Activity\IManager::class); |
| 717 | 717 | |
| 718 | - $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) { |
|
| 718 | + $this->registerService(\OCP\Activity\IEventMerger::class, function(Server $c) { |
|
| 719 | 719 | return new \OC\Activity\EventMerger( |
| 720 | 720 | $c->getL10N('lib') |
| 721 | 721 | ); |
| 722 | 722 | }); |
| 723 | 723 | $this->registerAlias(IValidator::class, Validator::class); |
| 724 | 724 | |
| 725 | - $this->registerService(AvatarManager::class, function (Server $c) { |
|
| 725 | + $this->registerService(AvatarManager::class, function(Server $c) { |
|
| 726 | 726 | return new AvatarManager( |
| 727 | 727 | $c->get(\OC\User\Manager::class), |
| 728 | 728 | $c->getAppDataDir('avatar'), |
@@ -738,7 +738,7 @@ discard block |
||
| 738 | 738 | $this->registerAlias(\OCP\Support\CrashReport\IRegistry::class, \OC\Support\CrashReport\Registry::class); |
| 739 | 739 | $this->registerAlias(\OCP\Support\Subscription\IRegistry::class, \OC\Support\Subscription\Registry::class); |
| 740 | 740 | |
| 741 | - $this->registerService(\OC\Log::class, function (Server $c) { |
|
| 741 | + $this->registerService(\OC\Log::class, function(Server $c) { |
|
| 742 | 742 | $logType = $c->get(AllConfig::class)->getSystemValue('log_type', 'file'); |
| 743 | 743 | $factory = new LogFactory($c, $this->get(SystemConfig::class)); |
| 744 | 744 | $logger = $factory->get($logType); |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | // PSR-3 logger |
| 753 | 753 | $this->registerAlias(LoggerInterface::class, PsrLoggerAdapter::class); |
| 754 | 754 | |
| 755 | - $this->registerService(ILogFactory::class, function (Server $c) { |
|
| 755 | + $this->registerService(ILogFactory::class, function(Server $c) { |
|
| 756 | 756 | return new LogFactory($c, $this->get(SystemConfig::class)); |
| 757 | 757 | }); |
| 758 | 758 | |
@@ -760,7 +760,7 @@ discard block |
||
| 760 | 760 | /** @deprecated 19.0.0 */ |
| 761 | 761 | $this->registerDeprecatedAlias('JobList', IJobList::class); |
| 762 | 762 | |
| 763 | - $this->registerService(Router::class, function (Server $c) { |
|
| 763 | + $this->registerService(Router::class, function(Server $c) { |
|
| 764 | 764 | $cacheFactory = $c->get(ICacheFactory::class); |
| 765 | 765 | $logger = $c->get(ILogger::class); |
| 766 | 766 | if ($cacheFactory->isLocalCacheAvailable()) { |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | /** @deprecated 19.0.0 */ |
| 779 | 779 | $this->registerDeprecatedAlias('Search', ISearch::class); |
| 780 | 780 | |
| 781 | - $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) { |
|
| 781 | + $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function($c) { |
|
| 782 | 782 | return new \OC\Security\RateLimiting\Backend\MemoryCache( |
| 783 | 783 | $this->get(ICacheFactory::class), |
| 784 | 784 | new \OC\AppFramework\Utility\TimeFactory() |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | /** @deprecated 19.0.0 */ |
| 802 | 802 | $this->registerDeprecatedAlias('CredentialsManager', ICredentialsManager::class); |
| 803 | 803 | |
| 804 | - $this->registerService(IDBConnection::class, function (Server $c) { |
|
| 804 | + $this->registerService(IDBConnection::class, function(Server $c) { |
|
| 805 | 805 | $systemConfig = $c->get(SystemConfig::class); |
| 806 | 806 | $factory = new \OC\DB\ConnectionFactory($systemConfig); |
| 807 | 807 | $type = $systemConfig->getValue('dbtype', 'sqlite'); |
@@ -819,7 +819,7 @@ discard block |
||
| 819 | 819 | $this->registerAlias(ICertificateManager::class, CertificateManager::class); |
| 820 | 820 | $this->registerAlias(IClientService::class, ClientService::class); |
| 821 | 821 | $this->registerDeprecatedAlias('HttpClientService', IClientService::class); |
| 822 | - $this->registerService(IEventLogger::class, function (ContainerInterface $c) { |
|
| 822 | + $this->registerService(IEventLogger::class, function(ContainerInterface $c) { |
|
| 823 | 823 | $eventLogger = new EventLogger(); |
| 824 | 824 | if ($c->get(SystemConfig::class)->getValue('debug', false)) { |
| 825 | 825 | // In debug mode, module is being activated by default |
@@ -830,7 +830,7 @@ discard block |
||
| 830 | 830 | /** @deprecated 19.0.0 */ |
| 831 | 831 | $this->registerDeprecatedAlias('EventLogger', IEventLogger::class); |
| 832 | 832 | |
| 833 | - $this->registerService(IQueryLogger::class, function (ContainerInterface $c) { |
|
| 833 | + $this->registerService(IQueryLogger::class, function(ContainerInterface $c) { |
|
| 834 | 834 | $queryLogger = new QueryLogger(); |
| 835 | 835 | if ($c->get(SystemConfig::class)->getValue('debug', false)) { |
| 836 | 836 | // In debug mode, module is being activated by default |
@@ -845,7 +845,7 @@ discard block |
||
| 845 | 845 | $this->registerDeprecatedAlias('TempManager', TempManager::class); |
| 846 | 846 | $this->registerAlias(ITempManager::class, TempManager::class); |
| 847 | 847 | |
| 848 | - $this->registerService(AppManager::class, function (ContainerInterface $c) { |
|
| 848 | + $this->registerService(AppManager::class, function(ContainerInterface $c) { |
|
| 849 | 849 | // TODO: use auto-wiring |
| 850 | 850 | return new \OC\App\AppManager( |
| 851 | 851 | $c->get(IUserSession::class), |
@@ -865,7 +865,7 @@ discard block |
||
| 865 | 865 | /** @deprecated 19.0.0 */ |
| 866 | 866 | $this->registerDeprecatedAlias('DateTimeZone', IDateTimeZone::class); |
| 867 | 867 | |
| 868 | - $this->registerService(IDateTimeFormatter::class, function (Server $c) { |
|
| 868 | + $this->registerService(IDateTimeFormatter::class, function(Server $c) { |
|
| 869 | 869 | $language = $c->get(\OCP\IConfig::class)->getUserValue($c->get(ISession::class)->get('user_id'), 'core', 'lang', null); |
| 870 | 870 | |
| 871 | 871 | return new DateTimeFormatter( |
@@ -876,7 +876,7 @@ discard block |
||
| 876 | 876 | /** @deprecated 19.0.0 */ |
| 877 | 877 | $this->registerDeprecatedAlias('DateTimeFormatter', IDateTimeFormatter::class); |
| 878 | 878 | |
| 879 | - $this->registerService(IUserMountCache::class, function (ContainerInterface $c) { |
|
| 879 | + $this->registerService(IUserMountCache::class, function(ContainerInterface $c) { |
|
| 880 | 880 | $mountCache = new UserMountCache( |
| 881 | 881 | $c->get(IDBConnection::class), |
| 882 | 882 | $c->get(IUserManager::class), |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | /** @deprecated 19.0.0 */ |
| 890 | 890 | $this->registerDeprecatedAlias('UserMountCache', IUserMountCache::class); |
| 891 | 891 | |
| 892 | - $this->registerService(IMountProviderCollection::class, function (ContainerInterface $c) { |
|
| 892 | + $this->registerService(IMountProviderCollection::class, function(ContainerInterface $c) { |
|
| 893 | 893 | $loader = \OC\Files\Filesystem::getLoader(); |
| 894 | 894 | $mountCache = $c->get(IUserMountCache::class); |
| 895 | 895 | $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | |
| 911 | 911 | /** @deprecated 20.0.0 */ |
| 912 | 912 | $this->registerDeprecatedAlias('IniWrapper', IniGetWrapper::class); |
| 913 | - $this->registerService(IBus::class, function (ContainerInterface $c) { |
|
| 913 | + $this->registerService(IBus::class, function(ContainerInterface $c) { |
|
| 914 | 914 | $busClass = $c->get(\OCP\IConfig::class)->getSystemValue('commandbus'); |
| 915 | 915 | if ($busClass) { |
| 916 | 916 | [$app, $class] = explode('::', $busClass, 2); |
@@ -930,7 +930,7 @@ discard block |
||
| 930 | 930 | $this->registerDeprecatedAlias('TrustedDomainHelper', TrustedDomainHelper::class); |
| 931 | 931 | /** @deprecated 19.0.0 */ |
| 932 | 932 | $this->registerDeprecatedAlias('Throttler', Throttler::class); |
| 933 | - $this->registerService('IntegrityCodeChecker', function (ContainerInterface $c) { |
|
| 933 | + $this->registerService('IntegrityCodeChecker', function(ContainerInterface $c) { |
|
| 934 | 934 | // IConfig and IAppManager requires a working database. This code |
| 935 | 935 | // might however be called when ownCloud is not yet setup. |
| 936 | 936 | if (\OC::$server->get(SystemConfig::class)->getValue('installed', false)) { |
@@ -952,7 +952,7 @@ discard block |
||
| 952 | 952 | $c->get(IMimeTypeDetector::class) |
| 953 | 953 | ); |
| 954 | 954 | }); |
| 955 | - $this->registerService(\OCP\IRequest::class, function (ContainerInterface $c) { |
|
| 955 | + $this->registerService(\OCP\IRequest::class, function(ContainerInterface $c) { |
|
| 956 | 956 | if (isset($this['urlParams'])) { |
| 957 | 957 | $urlParams = $this['urlParams']; |
| 958 | 958 | } else { |
@@ -989,7 +989,7 @@ discard block |
||
| 989 | 989 | /** @deprecated 19.0.0 */ |
| 990 | 990 | $this->registerDeprecatedAlias('Request', \OCP\IRequest::class); |
| 991 | 991 | |
| 992 | - $this->registerService(IMailer::class, function (Server $c) { |
|
| 992 | + $this->registerService(IMailer::class, function(Server $c) { |
|
| 993 | 993 | return new Mailer( |
| 994 | 994 | $c->get(\OCP\IConfig::class), |
| 995 | 995 | $c->get(ILogger::class), |
@@ -1003,7 +1003,7 @@ discard block |
||
| 1003 | 1003 | /** @deprecated 19.0.0 */ |
| 1004 | 1004 | $this->registerDeprecatedAlias('Mailer', IMailer::class); |
| 1005 | 1005 | |
| 1006 | - $this->registerService('LDAPProvider', function (ContainerInterface $c) { |
|
| 1006 | + $this->registerService('LDAPProvider', function(ContainerInterface $c) { |
|
| 1007 | 1007 | $config = $c->get(\OCP\IConfig::class); |
| 1008 | 1008 | $factoryClass = $config->getSystemValue('ldapProviderFactory', null); |
| 1009 | 1009 | if (is_null($factoryClass)) { |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | $factory = new $factoryClass($this); |
| 1014 | 1014 | return $factory->getLDAPProvider(); |
| 1015 | 1015 | }); |
| 1016 | - $this->registerService(ILockingProvider::class, function (ContainerInterface $c) { |
|
| 1016 | + $this->registerService(ILockingProvider::class, function(ContainerInterface $c) { |
|
| 1017 | 1017 | $ini = $c->get(IniGetWrapper::class); |
| 1018 | 1018 | $config = $c->get(\OCP\IConfig::class); |
| 1019 | 1019 | $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); |
@@ -1041,12 +1041,12 @@ discard block |
||
| 1041 | 1041 | /** @deprecated 19.0.0 */ |
| 1042 | 1042 | $this->registerDeprecatedAlias('MountManager', IMountManager::class); |
| 1043 | 1043 | |
| 1044 | - $this->registerService(IMimeTypeDetector::class, function (ContainerInterface $c) { |
|
| 1044 | + $this->registerService(IMimeTypeDetector::class, function(ContainerInterface $c) { |
|
| 1045 | 1045 | return new \OC\Files\Type\Detection( |
| 1046 | 1046 | $c->get(IURLGenerator::class), |
| 1047 | 1047 | $c->get(ILogger::class), |
| 1048 | 1048 | \OC::$configDir, |
| 1049 | - \OC::$SERVERROOT . '/resources/config/' |
|
| 1049 | + \OC::$SERVERROOT.'/resources/config/' |
|
| 1050 | 1050 | ); |
| 1051 | 1051 | }); |
| 1052 | 1052 | /** @deprecated 19.0.0 */ |
@@ -1055,19 +1055,19 @@ discard block |
||
| 1055 | 1055 | $this->registerAlias(IMimeTypeLoader::class, Loader::class); |
| 1056 | 1056 | /** @deprecated 19.0.0 */ |
| 1057 | 1057 | $this->registerDeprecatedAlias('MimeTypeLoader', IMimeTypeLoader::class); |
| 1058 | - $this->registerService(BundleFetcher::class, function () { |
|
| 1058 | + $this->registerService(BundleFetcher::class, function() { |
|
| 1059 | 1059 | return new BundleFetcher($this->getL10N('lib')); |
| 1060 | 1060 | }); |
| 1061 | 1061 | $this->registerAlias(\OCP\Notification\IManager::class, Manager::class); |
| 1062 | 1062 | /** @deprecated 19.0.0 */ |
| 1063 | 1063 | $this->registerDeprecatedAlias('NotificationManager', \OCP\Notification\IManager::class); |
| 1064 | 1064 | |
| 1065 | - $this->registerService(CapabilitiesManager::class, function (ContainerInterface $c) { |
|
| 1065 | + $this->registerService(CapabilitiesManager::class, function(ContainerInterface $c) { |
|
| 1066 | 1066 | $manager = new CapabilitiesManager($c->get(ILogger::class)); |
| 1067 | - $manager->registerCapability(function () use ($c) { |
|
| 1067 | + $manager->registerCapability(function() use ($c) { |
|
| 1068 | 1068 | return new \OC\OCS\CoreCapabilities($c->get(\OCP\IConfig::class)); |
| 1069 | 1069 | }); |
| 1070 | - $manager->registerCapability(function () use ($c) { |
|
| 1070 | + $manager->registerCapability(function() use ($c) { |
|
| 1071 | 1071 | return $c->get(\OC\Security\Bruteforce\Capabilities::class); |
| 1072 | 1072 | }); |
| 1073 | 1073 | return $manager; |
@@ -1075,14 +1075,14 @@ discard block |
||
| 1075 | 1075 | /** @deprecated 19.0.0 */ |
| 1076 | 1076 | $this->registerDeprecatedAlias('CapabilitiesManager', CapabilitiesManager::class); |
| 1077 | 1077 | |
| 1078 | - $this->registerService(ICommentsManager::class, function (Server $c) { |
|
| 1078 | + $this->registerService(ICommentsManager::class, function(Server $c) { |
|
| 1079 | 1079 | $config = $c->get(\OCP\IConfig::class); |
| 1080 | 1080 | $factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class); |
| 1081 | 1081 | /** @var \OCP\Comments\ICommentsManagerFactory $factory */ |
| 1082 | 1082 | $factory = new $factoryClass($this); |
| 1083 | 1083 | $manager = $factory->getManager(); |
| 1084 | 1084 | |
| 1085 | - $manager->registerDisplayNameResolver('user', function ($id) use ($c) { |
|
| 1085 | + $manager->registerDisplayNameResolver('user', function($id) use ($c) { |
|
| 1086 | 1086 | $manager = $c->get(IUserManager::class); |
| 1087 | 1087 | $user = $manager->get($id); |
| 1088 | 1088 | if (is_null($user)) { |
@@ -1100,7 +1100,7 @@ discard block |
||
| 1100 | 1100 | $this->registerDeprecatedAlias('CommentsManager', ICommentsManager::class); |
| 1101 | 1101 | |
| 1102 | 1102 | $this->registerAlias(\OC_Defaults::class, 'ThemingDefaults'); |
| 1103 | - $this->registerService('ThemingDefaults', function (Server $c) { |
|
| 1103 | + $this->registerService('ThemingDefaults', function(Server $c) { |
|
| 1104 | 1104 | /* |
| 1105 | 1105 | * Dark magic for autoloader. |
| 1106 | 1106 | * If we do a class_exists it will try to load the class which will |
@@ -1135,7 +1135,7 @@ discard block |
||
| 1135 | 1135 | } |
| 1136 | 1136 | return new \OC_Defaults(); |
| 1137 | 1137 | }); |
| 1138 | - $this->registerService(JSCombiner::class, function (Server $c) { |
|
| 1138 | + $this->registerService(JSCombiner::class, function(Server $c) { |
|
| 1139 | 1139 | return new JSCombiner( |
| 1140 | 1140 | $c->getAppDataDir('js'), |
| 1141 | 1141 | $c->get(IURLGenerator::class), |
@@ -1149,7 +1149,7 @@ discard block |
||
| 1149 | 1149 | $this->registerDeprecatedAlias('EventDispatcher', \OC\EventDispatcher\SymfonyAdapter::class); |
| 1150 | 1150 | $this->registerAlias(EventDispatcherInterface::class, \OC\EventDispatcher\SymfonyAdapter::class); |
| 1151 | 1151 | |
| 1152 | - $this->registerService('CryptoWrapper', function (ContainerInterface $c) { |
|
| 1152 | + $this->registerService('CryptoWrapper', function(ContainerInterface $c) { |
|
| 1153 | 1153 | // FIXME: Instantiiated here due to cyclic dependency |
| 1154 | 1154 | $request = new Request( |
| 1155 | 1155 | [ |
@@ -1176,14 +1176,14 @@ discard block |
||
| 1176 | 1176 | }); |
| 1177 | 1177 | /** @deprecated 19.0.0 */ |
| 1178 | 1178 | $this->registerDeprecatedAlias('CsrfTokenManager', CsrfTokenManager::class); |
| 1179 | - $this->registerService(SessionStorage::class, function (ContainerInterface $c) { |
|
| 1179 | + $this->registerService(SessionStorage::class, function(ContainerInterface $c) { |
|
| 1180 | 1180 | return new SessionStorage($c->get(ISession::class)); |
| 1181 | 1181 | }); |
| 1182 | 1182 | $this->registerAlias(\OCP\Security\IContentSecurityPolicyManager::class, ContentSecurityPolicyManager::class); |
| 1183 | 1183 | /** @deprecated 19.0.0 */ |
| 1184 | 1184 | $this->registerDeprecatedAlias('ContentSecurityPolicyManager', ContentSecurityPolicyManager::class); |
| 1185 | 1185 | |
| 1186 | - $this->registerService(\OCP\Share\IManager::class, function (IServerContainer $c) { |
|
| 1186 | + $this->registerService(\OCP\Share\IManager::class, function(IServerContainer $c) { |
|
| 1187 | 1187 | $config = $c->get(\OCP\IConfig::class); |
| 1188 | 1188 | $factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class); |
| 1189 | 1189 | /** @var \OCP\Share\IProviderFactory $factory */ |
@@ -1213,7 +1213,7 @@ discard block |
||
| 1213 | 1213 | /** @deprecated 19.0.0 */ |
| 1214 | 1214 | $this->registerDeprecatedAlias('ShareManager', \OCP\Share\IManager::class); |
| 1215 | 1215 | |
| 1216 | - $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function (Server $c) { |
|
| 1216 | + $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function(Server $c) { |
|
| 1217 | 1217 | $instance = new Collaboration\Collaborators\Search($c); |
| 1218 | 1218 | |
| 1219 | 1219 | // register default plugins |
@@ -1236,33 +1236,33 @@ discard block |
||
| 1236 | 1236 | |
| 1237 | 1237 | $this->registerDeprecatedAlias('SettingsManager', \OC\Settings\Manager::class); |
| 1238 | 1238 | $this->registerAlias(\OCP\Settings\IManager::class, \OC\Settings\Manager::class); |
| 1239 | - $this->registerService(\OC\Files\AppData\Factory::class, function (ContainerInterface $c) { |
|
| 1239 | + $this->registerService(\OC\Files\AppData\Factory::class, function(ContainerInterface $c) { |
|
| 1240 | 1240 | return new \OC\Files\AppData\Factory( |
| 1241 | 1241 | $c->get(IRootFolder::class), |
| 1242 | 1242 | $c->get(SystemConfig::class) |
| 1243 | 1243 | ); |
| 1244 | 1244 | }); |
| 1245 | 1245 | |
| 1246 | - $this->registerService('LockdownManager', function (ContainerInterface $c) { |
|
| 1247 | - return new LockdownManager(function () use ($c) { |
|
| 1246 | + $this->registerService('LockdownManager', function(ContainerInterface $c) { |
|
| 1247 | + return new LockdownManager(function() use ($c) { |
|
| 1248 | 1248 | return $c->get(ISession::class); |
| 1249 | 1249 | }); |
| 1250 | 1250 | }); |
| 1251 | 1251 | |
| 1252 | - $this->registerService(\OCP\OCS\IDiscoveryService::class, function (ContainerInterface $c) { |
|
| 1252 | + $this->registerService(\OCP\OCS\IDiscoveryService::class, function(ContainerInterface $c) { |
|
| 1253 | 1253 | return new DiscoveryService( |
| 1254 | 1254 | $c->get(ICacheFactory::class), |
| 1255 | 1255 | $c->get(IClientService::class) |
| 1256 | 1256 | ); |
| 1257 | 1257 | }); |
| 1258 | 1258 | |
| 1259 | - $this->registerService(ICloudIdManager::class, function (ContainerInterface $c) { |
|
| 1259 | + $this->registerService(ICloudIdManager::class, function(ContainerInterface $c) { |
|
| 1260 | 1260 | return new CloudIdManager($c->get(\OCP\Contacts\IManager::class)); |
| 1261 | 1261 | }); |
| 1262 | 1262 | |
| 1263 | 1263 | $this->registerAlias(\OCP\GlobalScale\IConfig::class, \OC\GlobalScale\Config::class); |
| 1264 | 1264 | |
| 1265 | - $this->registerService(ICloudFederationProviderManager::class, function (ContainerInterface $c) { |
|
| 1265 | + $this->registerService(ICloudFederationProviderManager::class, function(ContainerInterface $c) { |
|
| 1266 | 1266 | return new CloudFederationProviderManager( |
| 1267 | 1267 | $c->get(IAppManager::class), |
| 1268 | 1268 | $c->get(IClientService::class), |
@@ -1271,7 +1271,7 @@ discard block |
||
| 1271 | 1271 | ); |
| 1272 | 1272 | }); |
| 1273 | 1273 | |
| 1274 | - $this->registerService(ICloudFederationFactory::class, function (Server $c) { |
|
| 1274 | + $this->registerService(ICloudFederationFactory::class, function(Server $c) { |
|
| 1275 | 1275 | return new CloudFederationFactory(); |
| 1276 | 1276 | }); |
| 1277 | 1277 | |
@@ -1283,7 +1283,7 @@ discard block |
||
| 1283 | 1283 | /** @deprecated 19.0.0 */ |
| 1284 | 1284 | $this->registerDeprecatedAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class); |
| 1285 | 1285 | |
| 1286 | - $this->registerService(Defaults::class, function (Server $c) { |
|
| 1286 | + $this->registerService(Defaults::class, function(Server $c) { |
|
| 1287 | 1287 | return new Defaults( |
| 1288 | 1288 | $c->getThemingDefaults() |
| 1289 | 1289 | ); |
@@ -1291,17 +1291,17 @@ discard block |
||
| 1291 | 1291 | /** @deprecated 19.0.0 */ |
| 1292 | 1292 | $this->registerDeprecatedAlias('Defaults', \OCP\Defaults::class); |
| 1293 | 1293 | |
| 1294 | - $this->registerService(\OCP\ISession::class, function (ContainerInterface $c) { |
|
| 1294 | + $this->registerService(\OCP\ISession::class, function(ContainerInterface $c) { |
|
| 1295 | 1295 | return $c->get(\OCP\IUserSession::class)->getSession(); |
| 1296 | 1296 | }, false); |
| 1297 | 1297 | |
| 1298 | - $this->registerService(IShareHelper::class, function (ContainerInterface $c) { |
|
| 1298 | + $this->registerService(IShareHelper::class, function(ContainerInterface $c) { |
|
| 1299 | 1299 | return new ShareHelper( |
| 1300 | 1300 | $c->get(\OCP\Share\IManager::class) |
| 1301 | 1301 | ); |
| 1302 | 1302 | }); |
| 1303 | 1303 | |
| 1304 | - $this->registerService(Installer::class, function (ContainerInterface $c) { |
|
| 1304 | + $this->registerService(Installer::class, function(ContainerInterface $c) { |
|
| 1305 | 1305 | return new Installer( |
| 1306 | 1306 | $c->get(AppFetcher::class), |
| 1307 | 1307 | $c->get(IClientService::class), |
@@ -1312,11 +1312,11 @@ discard block |
||
| 1312 | 1312 | ); |
| 1313 | 1313 | }); |
| 1314 | 1314 | |
| 1315 | - $this->registerService(IApiFactory::class, function (ContainerInterface $c) { |
|
| 1315 | + $this->registerService(IApiFactory::class, function(ContainerInterface $c) { |
|
| 1316 | 1316 | return new ApiFactory($c->get(IClientService::class)); |
| 1317 | 1317 | }); |
| 1318 | 1318 | |
| 1319 | - $this->registerService(IInstanceFactory::class, function (ContainerInterface $c) { |
|
| 1319 | + $this->registerService(IInstanceFactory::class, function(ContainerInterface $c) { |
|
| 1320 | 1320 | $memcacheFactory = $c->get(ICacheFactory::class); |
| 1321 | 1321 | return new InstanceFactory($memcacheFactory->createLocal('remoteinstance.'), $c->get(IClientService::class)); |
| 1322 | 1322 | }); |
@@ -1373,7 +1373,7 @@ discard block |
||
| 1373 | 1373 | $dispatcher = $this->get(SymfonyAdapter::class); |
| 1374 | 1374 | |
| 1375 | 1375 | // Delete avatar on user deletion |
| 1376 | - $dispatcher->addListener('OCP\IUser::preDelete', function (GenericEvent $e) { |
|
| 1376 | + $dispatcher->addListener('OCP\IUser::preDelete', function(GenericEvent $e) { |
|
| 1377 | 1377 | $logger = $this->get(ILogger::class); |
| 1378 | 1378 | $manager = $this->getAvatarManager(); |
| 1379 | 1379 | /** @var IUser $user */ |
@@ -1386,11 +1386,11 @@ discard block |
||
| 1386 | 1386 | // no avatar to remove |
| 1387 | 1387 | } catch (\Exception $e) { |
| 1388 | 1388 | // Ignore exceptions |
| 1389 | - $logger->info('Could not cleanup avatar of ' . $user->getUID()); |
|
| 1389 | + $logger->info('Could not cleanup avatar of '.$user->getUID()); |
|
| 1390 | 1390 | } |
| 1391 | 1391 | }); |
| 1392 | 1392 | |
| 1393 | - $dispatcher->addListener('OCP\IUser::changeUser', function (GenericEvent $e) { |
|
| 1393 | + $dispatcher->addListener('OCP\IUser::changeUser', function(GenericEvent $e) { |
|
| 1394 | 1394 | $manager = $this->getAvatarManager(); |
| 1395 | 1395 | /** @var IUser $user */ |
| 1396 | 1396 | $user = $e->getSubject(); |
@@ -2281,11 +2281,11 @@ discard block |
||
| 2281 | 2281 | } |
| 2282 | 2282 | |
| 2283 | 2283 | private function registerDeprecatedAlias(string $alias, string $target) { |
| 2284 | - $this->registerService($alias, function (ContainerInterface $container) use ($target, $alias) { |
|
| 2284 | + $this->registerService($alias, function(ContainerInterface $container) use ($target, $alias) { |
|
| 2285 | 2285 | try { |
| 2286 | 2286 | /** @var ILogger $logger */ |
| 2287 | 2287 | $logger = $container->get(ILogger::class); |
| 2288 | - $logger->debug('The requested alias "' . $alias . '" is deprecated. Please request "' . $target . '" directly. This alias will be removed in a future Nextcloud version.', ['app' => 'serverDI']); |
|
| 2288 | + $logger->debug('The requested alias "'.$alias.'" is deprecated. Please request "'.$target.'" directly. This alias will be removed in a future Nextcloud version.', ['app' => 'serverDI']); |
|
| 2289 | 2289 | } catch (ContainerExceptionInterface $e) { |
| 2290 | 2290 | // Could not get logger. Continue |
| 2291 | 2291 | } |