1
0

SetupManagerFactory.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OC\Files;
  8. use OC\Share20\ShareDisableChecker;
  9. use OCP\Diagnostics\IEventLogger;
  10. use OCP\EventDispatcher\IEventDispatcher;
  11. use OCP\Files\Config\IMountProviderCollection;
  12. use OCP\Files\Config\IUserMountCache;
  13. use OCP\Files\Mount\IMountManager;
  14. use OCP\ICacheFactory;
  15. use OCP\IConfig;
  16. use OCP\IUserManager;
  17. use OCP\IUserSession;
  18. use OCP\Lockdown\ILockdownManager;
  19. use Psr\Log\LoggerInterface;
  20. class SetupManagerFactory {
  21. private ?SetupManager $setupManager;
  22. public function __construct(
  23. private IEventLogger $eventLogger,
  24. private IMountProviderCollection $mountProviderCollection,
  25. private IUserManager $userManager,
  26. private IEventDispatcher $eventDispatcher,
  27. private IUserMountCache $userMountCache,
  28. private ILockdownManager $lockdownManager,
  29. private IUserSession $userSession,
  30. private ICacheFactory $cacheFactory,
  31. private LoggerInterface $logger,
  32. private IConfig $config,
  33. private ShareDisableChecker $shareDisableChecker,
  34. ) {
  35. $this->setupManager = null;
  36. }
  37. public function create(IMountManager $mountManager): SetupManager {
  38. if (!$this->setupManager) {
  39. $this->setupManager = new SetupManager(
  40. $this->eventLogger,
  41. $this->mountProviderCollection,
  42. $mountManager,
  43. $this->userManager,
  44. $this->eventDispatcher,
  45. $this->userMountCache,
  46. $this->lockdownManager,
  47. $this->userSession,
  48. $this->cacheFactory,
  49. $this->logger,
  50. $this->config,
  51. $this->shareDisableChecker,
  52. );
  53. }
  54. return $this->setupManager;
  55. }
  56. }