App.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\Files;
  8. use OC\NavigationManager;
  9. use OCA\Files\Service\ChunkedUploadConfig;
  10. use OCP\App\IAppManager;
  11. use OCP\IConfig;
  12. use OCP\IGroupManager;
  13. use OCP\INavigationManager;
  14. use OCP\IURLGenerator;
  15. use OCP\IUserSession;
  16. use OCP\L10N\IFactory;
  17. use OCP\Server;
  18. use Psr\Log\LoggerInterface;
  19. class App {
  20. private static ?INavigationManager $navigationManager = null;
  21. /**
  22. * Returns the app's navigation manager
  23. */
  24. public static function getNavigationManager(): INavigationManager {
  25. // TODO: move this into a service in the Application class
  26. if (self::$navigationManager === null) {
  27. self::$navigationManager = new NavigationManager(
  28. Server::get(IAppManager::class),
  29. Server::get(IUrlGenerator::class),
  30. Server::get(IFactory::class),
  31. Server::get(IUserSession::class),
  32. Server::get(IGroupManager::class),
  33. Server::get(IConfig::class),
  34. Server::get(LoggerInterface::class),
  35. );
  36. self::$navigationManager->clear(false);
  37. }
  38. return self::$navigationManager;
  39. }
  40. public static function extendJsConfig($settings): void {
  41. $appConfig = json_decode($settings['array']['oc_appconfig'], true);
  42. $appConfig['files'] = [
  43. 'max_chunk_size' => ChunkedUploadConfig::getMaxChunkSize(),
  44. ];
  45. $settings['array']['oc_appconfig'] = json_encode($appConfig);
  46. }
  47. }