mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 00:17:03 +03:00
Pre-configure some domains in Nextcloud
This commit is contained in:
parent
7fac6ca9dd
commit
9430c987e1
1 changed files with 24 additions and 13 deletions
|
|
@ -50,23 +50,34 @@ class SnappyMailHelper
|
||||||
$bSave = true;
|
$bSave = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pre-configure some domains
|
||||||
$ocConfig = \OC::$server->getConfig();
|
$ocConfig = \OC::$server->getConfig();
|
||||||
if ($ocConfig->getAppValue('snappymail', 'snappymail-autologin', false)
|
if ($ocConfig->getAppValue('snappymail', 'snappymail-autologin', false)
|
||||||
|| $ocConfig->getAppValue('snappymail', 'snappymail-autologin-with-email', false)
|
|| $ocConfig->getAppValue('snappymail', 'snappymail-autologin-with-email', false)
|
||||||
) {
|
) {
|
||||||
$oProvider = \RainLoop\Api::Actions()->DomainProvider();
|
$aDomains = \array_unique([
|
||||||
$oDomain = $oProvider->Load('nextcloud');
|
'nextcloud',
|
||||||
if (!($oDomain instanceof \RainLoop\Model\Domain)) {
|
\preg_replace('/:\d+/$','',$_SERVER['HTTP_HOST']),
|
||||||
$oDomain = new \RainLoop\Model\Domain('nextcloud');
|
$_SERVER['SERVER_NAME'],
|
||||||
$oDomain->SetConfig(
|
\gethostname()
|
||||||
'localhost', 143, \MailSo\Net\Enumerations\ConnectionSecurityType::NONE, true,
|
]);
|
||||||
true, 'localhost', 4190, \MailSo\Net\Enumerations\ConnectionSecurityType::NONE,
|
foreach ($aDomains as $i => $sDomain) {
|
||||||
'localhost', 25, \MailSo\Net\Enumerations\ConnectionSecurityType::NONE, true, true, false, false,
|
$oProvider = \RainLoop\Api::Actions()->DomainProvider();
|
||||||
'');
|
$oDomain = $oProvider->Load($sDomain);
|
||||||
$oProvider->Save($oDomain);
|
if (!($oDomain instanceof \RainLoop\Model\Domain)) {
|
||||||
if (!$oConfig->Set('login', 'default_domain', '')) {
|
$oDomain = new \RainLoop\Model\Domain($sDomain);
|
||||||
$oConfig->Set('login', 'default_domain', 'nextcloud');
|
$bShortLogin = !$i;
|
||||||
$bSave = true;
|
$iSecurityType = \MailSo\Net\Enumerations\ConnectionSecurityType::NONE;
|
||||||
|
$oDomain->SetConfig(
|
||||||
|
'localhost', 143, $iSecurityType, $bShortLogin,
|
||||||
|
true, 'localhost', 4190, $iSecurityType,
|
||||||
|
'localhost', 25, $iSecurityType, $bShortLogin, true, false, false,
|
||||||
|
'');
|
||||||
|
$oProvider->Save($oDomain);
|
||||||
|
if (!$oConfig->Get('login', 'default_domain', '')) {
|
||||||
|
$oConfig->Set('login', 'default_domain', 'nextcloud');
|
||||||
|
$bSave = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue