You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SetupManagerFactory.php 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2022 Robin Appelman <robin@icewind.nl>
  5. *
  6. * @license GNU AGPL version 3 or any later version
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License as
  10. * published by the Free Software Foundation, either version 3 of the
  11. * License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. namespace OC\Files;
  23. use OC\Share20\ShareDisableChecker;
  24. use OCP\Diagnostics\IEventLogger;
  25. use OCP\EventDispatcher\IEventDispatcher;
  26. use OCP\Files\Config\IMountProviderCollection;
  27. use OCP\Files\Config\IUserMountCache;
  28. use OCP\Files\Mount\IMountManager;
  29. use OCP\ICacheFactory;
  30. use OCP\IConfig;
  31. use OCP\IUserManager;
  32. use OCP\IUserSession;
  33. use OCP\Lockdown\ILockdownManager;
  34. use Psr\Log\LoggerInterface;
  35. class SetupManagerFactory {
  36. private ?SetupManager $setupManager;
  37. public function __construct(
  38. private IEventLogger $eventLogger,
  39. private IMountProviderCollection $mountProviderCollection,
  40. private IUserManager $userManager,
  41. private IEventDispatcher $eventDispatcher,
  42. private IUserMountCache $userMountCache,
  43. private ILockdownManager $lockdownManager,
  44. private IUserSession $userSession,
  45. private ICacheFactory $cacheFactory,
  46. private LoggerInterface $logger,
  47. private IConfig $config,
  48. private ShareDisableChecker $shareDisableChecker,
  49. ) {
  50. $this->setupManager = null;
  51. }
  52. public function create(IMountManager $mountManager): SetupManager {
  53. if (!$this->setupManager) {
  54. $this->setupManager = new SetupManager(
  55. $this->eventLogger,
  56. $this->mountProviderCollection,
  57. $mountManager,
  58. $this->userManager,
  59. $this->eventDispatcher,
  60. $this->userMountCache,
  61. $this->lockdownManager,
  62. $this->userSession,
  63. $this->cacheFactory,
  64. $this->logger,
  65. $this->config,
  66. $this->shareDisableChecker,
  67. );
  68. }
  69. return $this->setupManager;
  70. }
  71. }