From 6552a939896187db2b7ab70148fa1c189812f837 Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Mon, 20 Nov 2023 12:50:47 +0100 Subject: [PATCH] Changes for #929 --- integrations/nextcloud/snappymail/INSTALL | 3 +++ .../snappymail/lib/Migration/InstallStep.php | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/integrations/nextcloud/snappymail/INSTALL b/integrations/nextcloud/snappymail/INSTALL index 1669c33f0a..2e42a4f674 100755 --- a/integrations/nextcloud/snappymail/INSTALL +++ b/integrations/nextcloud/snappymail/INSTALL @@ -15,3 +15,6 @@ Then, enable the SnappyMail plugin that is in the "Social & communication" secti After a quick wait, SnappyMail is installed. Even if it is really attractive, it is too soon to click on the newly appeared "Email" icon in the apps list. You should configure SnappyMail before using it (which makes some sense, doesn'it): go to Nextcloud admin panel (upper-right corner dropdown menu) and go to "Additionnal settings". There click on the "Go to SnappyMail Webmail admin panel". In the SnappyMail admin prompt, the default login is "admin" and the default password will be generated in "[nextcloud-data]/app_snappymail/_data_/_default_/admin_password.txt". No need to advise you to change it once in the admin panel! This is it, you are now free to configure SnappyMail as you wish. One important point is the Domains section when you will set up the IMAP/SMTP parameters that shall be associated with the email adresses of your users. + +STUCK IN MAINTENANCE: +https://github.com/the-djmaze/snappymail/issues/929 diff --git a/integrations/nextcloud/snappymail/lib/Migration/InstallStep.php b/integrations/nextcloud/snappymail/lib/Migration/InstallStep.php index d39ee5ee02..d2ac146d48 100644 --- a/integrations/nextcloud/snappymail/lib/Migration/InstallStep.php +++ b/integrations/nextcloud/snappymail/lib/Migration/InstallStep.php @@ -21,13 +21,17 @@ public function getName() { public function run(IOutput $output) { + $output->info('clearstatcache'); \clearstatcache(); \clearstatcache(true); + $output->info('opcache_reset'); // opcache_reset is a terrible solution, but certain Nextcloud setups have issues \is_callable('opcache_reset') && \opcache_reset(); + $output->info('Load App'); \OCA\SnappyMail\Util\SnappyMailHelper::loadApp(); + $output->info('Fix permissions'); \SnappyMail\Upgrade::fixPermissions(); $app_dir = \dirname(\dirname(__DIR__)) . '/app'; @@ -48,11 +52,13 @@ public function run(IOutput $output) { $bSave = false; if (!$oConfig->Get('webmail', 'app_path')) { + $output->info('Set config [webmail]app_path'); $oConfig->Set('webmail', 'app_path', \OC::$server->getAppManager()->getAppWebPath('snappymail') . '/app/'); $bSave = true; } if (!\is_dir(APP_PLUGINS_PATH . 'nextcloud')) { + $output->info('Install extension: nextcloud'); \SnappyMail\Repository::installPackage('plugin', 'nextcloud'); $oConfig->Set('plugins', 'enable', true); $aList = \SnappyMail\Repository::getEnabledPackagesNames(); @@ -64,6 +70,7 @@ public function run(IOutput $output) { $sPassword = $oConfig->Get('security', 'admin_password'); if ('12345' == $sPassword || !$sPassword) { + $output->info('Generate admin password'); $sPassword = \substr(\base64_encode(\random_bytes(16)), 0, 12); $oConfig->SetPassword($sPassword); \RainLoop\Utils::saveFile(APP_PRIVATE_DATA . 'admin_password.txt', $sPassword . "\n"); @@ -74,6 +81,7 @@ public function run(IOutput $output) { $oProvider = \RainLoop\Api::Actions()->DomainProvider(); $oDomain = $oProvider->Load('nextcloud'); if (!$oDomain) { + $output->info('Add nextcloud as domain'); // $oDomain = \RainLoop\Model\Domain::fromIniArray('nextcloud', []); $oDomain = new \RainLoop\Model\Domain('nextcloud'); $iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::NONE; @@ -89,7 +97,13 @@ public function run(IOutput $output) { } } - $bSave && $oConfig->Save(); + if ($bSave) { + $oConfig->Save() + ? $output->info('Config saved') + : $output->info('Config failed'); + } else { + $output->info('Config not changed'); + } // 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 @@ -100,6 +114,7 @@ public function run(IOutput $output) { $ncConfig = \OC::$server->get(IConfig::class); $customConfigFile = $ncConfig->getAppValue(Application::APP_ID, 'custom_config_file'); if ($customConfigFile) { + $output->info("Load custom config: {$customConfigFile}"); if (!\str_contains($customConfigFile, ':') && \is_readable($customConfigFile)) { require $customConfigFile; } else {