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.

App.php 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Christopher Schäpers <kondou@ts.unde.re>
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Morris Jobke <hey@morrisjobke.de>
  8. * @author Vincent Petry <vincent@nextcloud.com>
  9. * @author Carl Schwan <carl@carlschwan.eu>
  10. *
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. namespace OCA\Files;
  27. use OC\NavigationManager;
  28. use OCP\App\IAppManager;
  29. use OCP\IConfig;
  30. use OCP\IGroupManager;
  31. use OCP\INavigationManager;
  32. use OCP\IURLGenerator;
  33. use OCP\IUserSession;
  34. use OCP\L10N\IFactory;
  35. use OCP\Server;
  36. class App {
  37. private static ?INavigationManager $navigationManager = null;
  38. /**
  39. * Returns the app's navigation manager
  40. */
  41. public static function getNavigationManager(): INavigationManager {
  42. // TODO: move this into a service in the Application class
  43. if (self::$navigationManager === null) {
  44. self::$navigationManager = new NavigationManager(
  45. Server::get(IAppManager::class),
  46. Server::get(IUrlGenerator::class),
  47. Server::get(IFactory::class),
  48. Server::get(IUserSession::class),
  49. Server::get(IGroupManager::class),
  50. Server::get(IConfig::class)
  51. );
  52. self::$navigationManager->clear(false);
  53. }
  54. return self::$navigationManager;
  55. }
  56. public static function extendJsConfig($settings): void {
  57. $appConfig = json_decode($settings['array']['oc_appconfig'], true);
  58. $maxChunkSize = (int)Server::get(IConfig::class)->getAppValue('files', 'max_chunk_size', (string)(10 * 1024 * 1024));
  59. $appConfig['files'] = [
  60. 'max_chunk_size' => $maxChunkSize
  61. ];
  62. $settings['array']['oc_appconfig'] = json_encode($appConfig);
  63. }
  64. }