From eab3d8d9383b1b6bf94ccdfafea4492156e096ac Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Mon, 3 Jul 2023 15:16:52 +0200 Subject: [PATCH] Improved #1197 --- .../nextcloud/snappymail/lib/Migration/InstallStep.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/integrations/nextcloud/snappymail/lib/Migration/InstallStep.php b/integrations/nextcloud/snappymail/lib/Migration/InstallStep.php index c3b59a969..d39ee5ee0 100644 --- a/integrations/nextcloud/snappymail/lib/Migration/InstallStep.php +++ b/integrations/nextcloud/snappymail/lib/Migration/InstallStep.php @@ -94,12 +94,17 @@ class InstallStep implements IRepairStep // check if admins provided additional/custom initial config file // https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html#setting-a-single-configuration-value // ex: php occ config:app:set snappymail custom_config_file --value="/path/to/config.php" + // https://github.com/the-djmaze/snappymail/pull/1197 try { /** @var IConfig $ncConfig */ $ncConfig = \OC::$server->get(IConfig::class); $customConfigFile = $ncConfig->getAppValue(Application::APP_ID, 'custom_config_file'); - if ($customConfigFile && strpos($customConfigFile, ':') === false) { - include $customConfigFile; + if ($customConfigFile) { + if (!\str_contains($customConfigFile, ':') && \is_readable($customConfigFile)) { + require $customConfigFile; + } else { + throw new \Exception("not found {$customConfigFile}"); + } } } catch (\Throwable $e) { $output->warning("custom config error: " . $e->getMessage());