1
0

App.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 OCP\App\IAppManager;
  10. use OCP\IConfig;
  11. use OCP\IGroupManager;
  12. use OCP\INavigationManager;
  13. use OCP\IURLGenerator;
  14. use OCP\IUserSession;
  15. use OCP\L10N\IFactory;
  16. use OCP\Server;
  17. class App {
  18. private static ?INavigationManager $navigationManager = null;
  19. /**
  20. * Returns the app's navigation manager
  21. */
  22. public static function getNavigationManager(): INavigationManager {
  23. // TODO: move this into a service in the Application class
  24. if (self::$navigationManager === null) {
  25. self::$navigationManager = new NavigationManager(
  26. Server::get(IAppManager::class),
  27. Server::get(IUrlGenerator::class),
  28. Server::get(IFactory::class),
  29. Server::get(IUserSession::class),
  30. Server::get(IGroupManager::class),
  31. Server::get(IConfig::class)
  32. );
  33. self::$navigationManager->clear(false);
  34. }
  35. return self::$navigationManager;
  36. }
  37. public static function extendJsConfig($settings): void {
  38. $appConfig = json_decode($settings['array']['oc_appconfig'], true);
  39. $maxChunkSize = (int)Server::get(IConfig::class)->getAppValue('files', 'max_chunk_size', (string)(10 * 1024 * 1024));
  40. $appConfig['files'] = [
  41. 'max_chunk_size' => $maxChunkSize
  42. ];
  43. $settings['array']['oc_appconfig'] = json_encode($appConfig);
  44. }
  45. }