2013-05-06 20:45:04 +02:00
|
|
|
<?php
|
2024-05-28 16:42:42 +02:00
|
|
|
|
2013-05-06 20:45:04 +02:00
|
|
|
/**
|
2024-05-28 16:42:42 +02:00
|
|
|
* SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2013-05-06 20:45:04 +02:00
|
|
|
*/
|
|
|
|
namespace OCA\Files;
|
|
|
|
|
2022-04-08 14:16:21 +02:00
|
|
|
use OC\NavigationManager;
|
2024-10-17 09:19:44 +02:00
|
|
|
use OCA\Files\Service\ChunkedUploadConfig;
|
2022-04-08 14:16:21 +02:00
|
|
|
use OCP\App\IAppManager;
|
2024-12-17 20:11:19 +01:00
|
|
|
use OCP\EventDispatcher\IEventDispatcher;
|
2022-04-08 14:16:21 +02:00
|
|
|
use OCP\IConfig;
|
|
|
|
use OCP\IGroupManager;
|
|
|
|
use OCP\INavigationManager;
|
|
|
|
use OCP\IURLGenerator;
|
|
|
|
use OCP\IUserSession;
|
|
|
|
use OCP\L10N\IFactory;
|
|
|
|
use OCP\Server;
|
2024-08-27 12:13:04 +02:00
|
|
|
use Psr\Log\LoggerInterface;
|
2022-04-08 14:16:21 +02:00
|
|
|
|
2013-05-08 11:56:59 +02:00
|
|
|
class App {
|
2022-04-08 14:16:21 +02:00
|
|
|
private static ?INavigationManager $navigationManager = null;
|
2014-05-08 16:24:24 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the app's navigation manager
|
|
|
|
*/
|
2022-04-08 14:16:21 +02:00
|
|
|
public static function getNavigationManager(): INavigationManager {
|
2015-07-13 17:38:13 +02:00
|
|
|
// TODO: move this into a service in the Application class
|
2014-05-08 16:24:24 +02:00
|
|
|
if (self::$navigationManager === null) {
|
2022-04-08 14:16:21 +02:00
|
|
|
self::$navigationManager = new NavigationManager(
|
|
|
|
Server::get(IAppManager::class),
|
|
|
|
Server::get(IUrlGenerator::class),
|
|
|
|
Server::get(IFactory::class),
|
|
|
|
Server::get(IUserSession::class),
|
|
|
|
Server::get(IGroupManager::class),
|
2024-08-27 12:13:04 +02:00
|
|
|
Server::get(IConfig::class),
|
|
|
|
Server::get(LoggerInterface::class),
|
2024-12-17 20:11:19 +01:00
|
|
|
Server::get(IEventDispatcher::class),
|
2017-03-26 19:40:41 +02:00
|
|
|
);
|
2017-03-26 21:15:25 +02:00
|
|
|
self::$navigationManager->clear(false);
|
2014-05-08 16:24:24 +02:00
|
|
|
}
|
|
|
|
return self::$navigationManager;
|
|
|
|
}
|
|
|
|
|
2022-04-08 14:16:21 +02:00
|
|
|
public static function extendJsConfig($settings): void {
|
2016-10-07 16:27:54 +02:00
|
|
|
$appConfig = json_decode($settings['array']['oc_appconfig'], true);
|
|
|
|
|
|
|
|
$appConfig['files'] = [
|
2024-10-17 09:19:44 +02:00
|
|
|
'max_chunk_size' => ChunkedUploadConfig::getMaxChunkSize(),
|
2016-10-07 16:27:54 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
$settings['array']['oc_appconfig'] = json_encode($appConfig);
|
|
|
|
}
|
2013-08-18 11:02:08 +02:00
|
|
|
}
|