From ce085b8e082b5b15093bee59869eff6c8c23ac83 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Tue, 18 Feb 2025 12:45:32 +0100 Subject: [PATCH 1/2] chore(files): Remove unused navigation manager Signed-off-by: provokateurin --- apps/files/lib/App.php | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/apps/files/lib/App.php b/apps/files/lib/App.php index 9e6d35a75383e..b71b3bdeedb8f 100644 --- a/apps/files/lib/App.php +++ b/apps/files/lib/App.php @@ -21,29 +21,6 @@ use Psr\Log\LoggerInterface; class App { - private static ?INavigationManager $navigationManager = null; - - /** - * Returns the app's navigation manager - */ - public static function getNavigationManager(): INavigationManager { - // TODO: move this into a service in the Application class - if (self::$navigationManager === null) { - self::$navigationManager = new NavigationManager( - Server::get(IAppManager::class), - Server::get(IUrlGenerator::class), - Server::get(IFactory::class), - Server::get(IUserSession::class), - Server::get(IGroupManager::class), - Server::get(IConfig::class), - Server::get(LoggerInterface::class), - Server::get(IEventDispatcher::class), - ); - self::$navigationManager->clear(false); - } - return self::$navigationManager; - } - public static function extendJsConfig($settings): void { $appConfig = json_decode($settings['array']['oc_appconfig'], true); From ade062aa9cc38069d9111f5b8c3db7ac2272221f Mon Sep 17 00:00:00 2001 From: provokateurin Date: Tue, 18 Feb 2025 12:49:23 +0100 Subject: [PATCH 2/2] refactor(files): Remove App class and move files.max_chunk_size to JSConfigHelper Signed-off-by: provokateurin --- .../composer/composer/autoload_classmap.php | 1 - .../composer/composer/autoload_static.php | 1 - apps/files/lib/App.php | 33 ------------------- apps/files/lib/AppInfo/Application.php | 6 ---- lib/private/Template/JSConfigHelper.php | 9 ++--- 5 files changed, 5 insertions(+), 45 deletions(-) delete mode 100644 apps/files/lib/App.php diff --git a/apps/files/composer/composer/autoload_classmap.php b/apps/files/composer/composer/autoload_classmap.php index 5922560f521c9..29d510ca0dbe6 100644 --- a/apps/files/composer/composer/autoload_classmap.php +++ b/apps/files/composer/composer/autoload_classmap.php @@ -16,7 +16,6 @@ 'OCA\\Files\\Activity\\Settings\\FileActivitySettings' => $baseDir . '/../lib/Activity/Settings/FileActivitySettings.php', 'OCA\\Files\\Activity\\Settings\\FileChanged' => $baseDir . '/../lib/Activity/Settings/FileChanged.php', 'OCA\\Files\\Activity\\Settings\\FileFavoriteChanged' => $baseDir . '/../lib/Activity/Settings/FileFavoriteChanged.php', - 'OCA\\Files\\App' => $baseDir . '/../lib/App.php', 'OCA\\Files\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php', 'OCA\\Files\\BackgroundJob\\CleanupDirectEditingTokens' => $baseDir . '/../lib/BackgroundJob/CleanupDirectEditingTokens.php', 'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => $baseDir . '/../lib/BackgroundJob/CleanupFileLocks.php', diff --git a/apps/files/composer/composer/autoload_static.php b/apps/files/composer/composer/autoload_static.php index bf489b037f762..1f5f377764c34 100644 --- a/apps/files/composer/composer/autoload_static.php +++ b/apps/files/composer/composer/autoload_static.php @@ -31,7 +31,6 @@ class ComposerStaticInitFiles 'OCA\\Files\\Activity\\Settings\\FileActivitySettings' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileActivitySettings.php', 'OCA\\Files\\Activity\\Settings\\FileChanged' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileChanged.php', 'OCA\\Files\\Activity\\Settings\\FileFavoriteChanged' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileFavoriteChanged.php', - 'OCA\\Files\\App' => __DIR__ . '/..' . '/../lib/App.php', 'OCA\\Files\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php', 'OCA\\Files\\BackgroundJob\\CleanupDirectEditingTokens' => __DIR__ . '/..' . '/../lib/BackgroundJob/CleanupDirectEditingTokens.php', 'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => __DIR__ . '/..' . '/../lib/BackgroundJob/CleanupFileLocks.php', diff --git a/apps/files/lib/App.php b/apps/files/lib/App.php deleted file mode 100644 index b71b3bdeedb8f..0000000000000 --- a/apps/files/lib/App.php +++ /dev/null @@ -1,33 +0,0 @@ - ChunkedUploadConfig::getMaxChunkSize(), - ]; - - $settings['array']['oc_appconfig'] = json_encode($appConfig); - } -} diff --git a/apps/files/lib/AppInfo/Application.php b/apps/files/lib/AppInfo/Application.php index 8d00912f7bba4..3421da594687c 100644 --- a/apps/files/lib/AppInfo/Application.php +++ b/apps/files/lib/AppInfo/Application.php @@ -52,7 +52,6 @@ use OCP\ITagManager; use OCP\IUserSession; use OCP\Share\IManager as IShareManager; -use OCP\Util; use Psr\Container\ContainerInterface; use Psr\Log\LoggerInterface; @@ -131,7 +130,6 @@ public function boot(IBootContext $context): void { $context->injectFn(Closure::fromCallable([$this, 'registerCollaboration'])); $context->injectFn([Listener::class, 'register']); $this->registerTemplates(); - $this->registerHooks(); } private function registerCollaboration(IProviderManager $providerManager): void { @@ -144,8 +142,4 @@ private function registerTemplates(): void { $templateManager->registerTemplate('application/vnd.oasis.opendocument.text', 'core/templates/filetemplates/template.odt'); $templateManager->registerTemplate('application/vnd.oasis.opendocument.spreadsheet', 'core/templates/filetemplates/template.ods'); } - - private function registerHooks(): void { - Util::connectHook('\OCP\Config', 'js', '\OCA\Files\App', 'extendJsConfig'); - } } diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php index 5743d2965d2c4..e1368cf35bfda 100644 --- a/lib/private/Template/JSConfigHelper.php +++ b/lib/private/Template/JSConfigHelper.php @@ -12,6 +12,7 @@ use OC\CapabilitiesManager; use OC\Files\FilenameValidator; use OC\Share\Share; +use OCA\Files\Service\ChunkedUploadConfig; use OCA\Provisioning_API\Controller\AUserDataOCSController; use OCP\App\AppPathNotFoundException; use OCP\App\IAppManager; @@ -246,7 +247,10 @@ public function getConfig(): string { 'defaultRemoteExpireDateEnabled' => $defaultRemoteExpireDateEnabled, 'defaultRemoteExpireDate' => $defaultRemoteExpireDate, 'defaultRemoteExpireDateEnforced' => $defaultRemoteExpireDateEnforced, - ] + ], + 'files' => [ + 'max_chunk_size' => ChunkedUploadConfig::getMaxChunkSize(), + ], ]), '_theme' => json_encode([ 'entity' => $this->defaults->getEntity(), @@ -277,9 +281,6 @@ public function getConfig(): string { $this->initialStateService->provideInitialState('core', 'config', $config); $this->initialStateService->provideInitialState('core', 'capabilities', $capabilities); - // Allow hooks to modify the output values - \OC_Hook::emit('\OCP\Config', 'js', ['array' => &$array]); - $result = ''; // Echo it