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