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