App.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 <pvince81@owncloud.com>
  9. *
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. namespace OCA\Files;
  26. class App {
  27. /**
  28. * @var \OCP\INavigationManager
  29. */
  30. private static $navigationManager;
  31. /**
  32. * Returns the app's navigation manager
  33. *
  34. * @return \OCP\INavigationManager
  35. */
  36. public static function getNavigationManager() {
  37. // TODO: move this into a service in the Application class
  38. if (self::$navigationManager === null) {
  39. self::$navigationManager = new \OC\NavigationManager(
  40. \OC::$server->getAppManager(),
  41. \OC::$server->getURLGenerator(),
  42. \OC::$server->getL10NFactory(),
  43. \OC::$server->getUserSession(),
  44. \OC::$server->getGroupManager(),
  45. \OC::$server->getConfig()
  46. );
  47. self::$navigationManager->clear(false);
  48. }
  49. return self::$navigationManager;
  50. }
  51. public static function extendJsConfig($settings) {
  52. $appConfig = json_decode($settings['array']['oc_appconfig'], true);
  53. $maxChunkSize = (int)\OC::$server->getConfig()->getAppValue('files', 'max_chunk_size', 10 * 1024 * 1024);
  54. $appConfig['files'] = [
  55. 'max_chunk_size' => $maxChunkSize
  56. ];
  57. $settings['array']['oc_appconfig'] = json_encode($appConfig);
  58. }
  59. }