mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 12:39:20 +03:00
Code optimizations
This commit is contained in:
parent
b4d6468094
commit
1613a4528b
8 changed files with 45 additions and 29 deletions
|
|
@ -1,9 +1,7 @@
|
|||
imap_host = "IMAP_HOST"
|
||||
imap_port = IMAP_PORT
|
||||
imap_secure = "SSL"
|
||||
imap_verify_ssl = Off
|
||||
smtp_host = "SMTP_HOST"
|
||||
smtp_port = SMTP_PORT
|
||||
smtp_secure = "SSL"
|
||||
smtp_verify_ssl = Off
|
||||
smtp_auth = On
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
outlook.com,qq.com,yahoo.com
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
imap_host = "imap.gmail.com"
|
||||
imap_port = 993
|
||||
imap_secure = "SSL"
|
||||
imap_verify_ssl = Off
|
||||
smtp_host = "smtp.gmail.com"
|
||||
smtp_port = 465
|
||||
smtp_secure = "SSL"
|
||||
smtp_verify_ssl = Off
|
||||
smtp_auth = On
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
imap_host = "imap-mail.outlook.com"
|
||||
imap_port = 993
|
||||
imap_secure = "SSL"
|
||||
imap_verify_ssl = Off
|
||||
smtp_host = "smtp-mail.outlook.com"
|
||||
smtp_port = 587
|
||||
smtp_secure = "TLS"
|
||||
smtp_verify_ssl = Off
|
||||
smtp_auth = On
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
imap_host = "imap.qq.com"
|
||||
imap_port = 993
|
||||
imap_secure = "SSL"
|
||||
imap_verify_ssl = Off
|
||||
smtp_host = "smtp.qq.com"
|
||||
smtp_port = 465
|
||||
smtp_secure = "SSL"
|
||||
smtp_verify_ssl = Off
|
||||
smtp_auth = On
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
imap_host = "imap.mail.yahoo.com"
|
||||
imap_port = 993
|
||||
imap_secure = "SSL"
|
||||
imap_verify_ssl = Off
|
||||
smtp_host = "smtp.mail.yahoo.com"
|
||||
smtp_port = 465
|
||||
smtp_secure = "SSL"
|
||||
smtp_verify_ssl = Off
|
||||
smtp_auth = On
|
||||
|
|
@ -3588,9 +3588,10 @@ class Actions
|
|||
|
||||
public function removeOldVersion()
|
||||
{
|
||||
$sVPath = APP_INDEX_ROOT_PATH.'rainloop/v/';
|
||||
|
||||
$this->Logger()->Write('Versions GC: Begin');
|
||||
|
||||
$sVPath = APP_INDEX_ROOT_PATH.'rainloop/v/';
|
||||
$aDirs = @\array_map('basename', @\array_filter(@\glob($sVPath.'*'), 'is_dir'));
|
||||
|
||||
$this->Logger()->Write('Versions GC: Count:'.(\is_array($aDirs) ? \count($aDirs) : 0));
|
||||
|
|
@ -3604,9 +3605,18 @@ class Actions
|
|||
if (APP_DEV_VERSION !== $sName && APP_VERSION !== $sName)
|
||||
{
|
||||
$this->Logger()->Write('Versions GC: Begin to remove "'.$sVPath.$sName.'" version');
|
||||
@\MailSo\Base\Utils::RecRmDir($sVPath.$sName);
|
||||
$this->Logger()->Write('Versions GC: End to remove "'.$sVPath.$sName.'" version');
|
||||
|
||||
if (@\unlink($sVPath.$sName.'/index.php'))
|
||||
{
|
||||
@\MailSo\Base\Utils::RecRmDir($sVPath.$sName);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->Logger()->Write('Versions GC (Error): index file cant be removed from"'.$sVPath.$sName.'"',
|
||||
\MailSo\Log\Enumerations\Type::ERROR);
|
||||
}
|
||||
|
||||
$this->Logger()->Write('Versions GC: End to remove "'.$sVPath.$sName.'" version');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,10 +40,12 @@ Options -Indexes
|
|||
$sSite = strtolower(trim(empty($_SERVER['HTTP_HOST']) ? (empty($_SERVER['SERVER_NAME']) ? '' : $_SERVER['SERVER_NAME']) : $_SERVER['HTTP_HOST']));
|
||||
$sSite = 'www.' === substr($sSite, 0, 4) ? substr($sSite, 4) : $sSite;
|
||||
$sSite = preg_replace('/^.+@/', '', preg_replace('/:[\d]+$/', '', $sSite));
|
||||
$sSite = in_array($sSite, array('localhost', '127.0.0.1', '::1', '::1/128', '0:0:0:0:0:0:0:1')) ? 'localhost' : $sSite;
|
||||
$sSite = in_array($sSite, array('localhost', '127.0.0.1', '::1', '::1/128', '0:0:0:0:0:0:0:1')) ? 'localhost' : trim($sSite);
|
||||
$sSite = 0 === strlen($sSite) ? 'localhost' : $sSite;
|
||||
|
||||
define('APP_SITE', $sSite);
|
||||
define('APP_SITE_CLEAR', 0 < strlen(APP_SITE) ? trim(preg_replace('/[^a-zA-Z0-9_.\-]+/', '_', trim(strtolower(APP_SITE))), ' _') : '');
|
||||
|
||||
unset($sSite);
|
||||
|
||||
define('APP_DEFAULT_PRIVATE_DATA_NAME', '_default_');
|
||||
|
||||
|
|
@ -177,7 +179,7 @@ Options -Indexes
|
|||
|
||||
if (@is_dir(APP_PRIVATE_DATA.'domains'))
|
||||
{
|
||||
$sFile = $sNewFile = '';
|
||||
$sFile = $sNewFile = $sNewFileName = '';
|
||||
$aFiles = @glob(APP_VERSION_ROOT_PATH.'app/domains/*');
|
||||
|
||||
if (is_array($aFiles) && 0 < \count($aFiles))
|
||||
|
|
@ -186,32 +188,45 @@ Options -Indexes
|
|||
{
|
||||
if (@is_file($sFile))
|
||||
{
|
||||
$sNewFile = APP_PRIVATE_DATA.'domains/'.basename($sFile);
|
||||
if (!@file_exists($sNewFile))
|
||||
$sNewFileName = basename($sFile);
|
||||
if ('default.ini.dist' !== $sNewFileName)
|
||||
{
|
||||
@copy($sFile, $sNewFile);
|
||||
$sNewFile = APP_PRIVATE_DATA.'domains/'.$sNewFileName;
|
||||
if (!@file_exists($sNewFile))
|
||||
{
|
||||
@copy($sFile, $sNewFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($aFiles, $sFile, $sNewFile);
|
||||
|
||||
if (@file_exists(APP_VERSION_ROOT_PATH.'app/domains/default.ini.dist'))
|
||||
unset($aFiles, $sFile, $sNewFileName, $sNewFile);
|
||||
|
||||
if (@file_exists(APP_VERSION_ROOT_PATH.'app/domains/default.ini.dist') &&
|
||||
!file_exists(APP_PRIVATE_DATA.'domains/'.APP_SITE.'.ini'))
|
||||
{
|
||||
$sClearedSiteName = preg_replace('/^(webmail|email|mail||imap|smtp)\./i', '', trim(APP_SITE));
|
||||
|
||||
$sConfigTemplate = @file_get_contents(APP_VERSION_ROOT_PATH.'app/domains/default.ini.dist');
|
||||
$sConfigDomain = str_replace('IMAP_HOST','imap.'.$sSite,$sConfigTemplate);
|
||||
$sConfigDomain = str_replace('IMAP_PORT','993',$sConfigDomain);
|
||||
$sConfigDomain = str_replace('SMTP_HOST','smtp.'.$sSite,$sConfigDomain);
|
||||
$sConfigDomain = str_replace('SMTP_PORT','465',$sConfigDomain);
|
||||
|
||||
@file_put_contents(APP_PRIVATE_DATA.'domains/'.$sSite.'.ini', $sConfigDomain);
|
||||
|
||||
if (!empty($sConfigTemplate) && !empty($sClearedSiteName))
|
||||
{
|
||||
@file_put_contents(APP_PRIVATE_DATA.'domains/'.APP_SITE.'.ini', strtr($sConfigTemplate, array(
|
||||
'IMAP_HOST' => 'localhost' !== $sClearedSiteName? 'imap.'.$sClearedSiteName : $sClearedSiteName,
|
||||
'IMAP_PORT' => '993',
|
||||
'SMTP_HOST' => 'localhost' !== $sClearedSiteName? 'smtp.'.$sClearedSiteName : $sClearedSiteName,
|
||||
'SMTP_PORT' => '465'
|
||||
)));
|
||||
}
|
||||
|
||||
unset($sConfigTemplate, $sClearedSiteName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($sSite, $sSalt, $sData, $sInstalled, $sConfigTemplate, $sConfigDomain, $sPrivateDataFolderInternalName);
|
||||
unset($sSalt, $sData, $sInstalled, $sPrivateDataFolderInternalName);
|
||||
}
|
||||
|
||||
include APP_VERSION_ROOT_PATH.'app/handle.php';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue