App.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 Thomas Müller <thomas.mueller@tmit.eu>
  9. * @author Vincent Petry <pvince81@owncloud.com>
  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. class App {
  28. /**
  29. * @var \OCP\INavigationManager
  30. */
  31. private static $navigationManager;
  32. /**
  33. * Returns the app's navigation manager
  34. *
  35. * @return \OCP\INavigationManager
  36. */
  37. public static function getNavigationManager() {
  38. // TODO: move this into a service in the Application class
  39. if (self::$navigationManager === null) {
  40. self::$navigationManager = new \OC\NavigationManager(
  41. \OC::$server->getAppManager(),
  42. \OC::$server->getURLGenerator(),
  43. \OC::$server->getL10NFactory(),
  44. \OC::$server->getUserSession(),
  45. \OC::$server->getGroupManager(),
  46. \OC::$server->getConfig()
  47. );
  48. self::$navigationManager->clear(false);
  49. }
  50. return self::$navigationManager;
  51. }
  52. public static function extendJsConfig($settings) {
  53. $appConfig = json_decode($settings['array']['oc_appconfig'], true);
  54. $maxChunkSize = (int)(\OC::$server->getConfig()->getAppValue('files', 'max_chunk_size', (10 * 1024 * 1024)));
  55. $appConfig['files'] = [
  56. 'max_chunk_size' => $maxChunkSize
  57. ];
  58. $settings['array']['oc_appconfig'] = json_encode($appConfig);
  59. }
  60. }