Improved Domain settings handling and store as JSON instead of ini

This commit is contained in:
the-djmaze 2022-10-31 11:17:25 +01:00
parent 9430c987e1
commit 2c54b0caf0
8 changed files with 143 additions and 207 deletions

View file

@ -62,4 +62,19 @@ class ConnectSettings
// $this->ssl['capath'] = (string) $oConfig->Get('ssl', 'capath', '');
}
public static function fromArray(array $aSettings) : self
{
$object = new self;
$object->host = $aSettings['Host'];
$object->port = $aSettings['Port'];
$object->type = $aSettings['Secure'];
$object->ssl['verify_peer'] = !!$aSettings['VerifySsl'];
$object->ssl['verify_peer_name'] = !!$aSettings['VerifySsl'];
$object->ssl['allow_self_signed'] = !!$aSettings['AllowSelfSigned'];
if (!empty($aSettings['ClientCert'])) {
$object->ssl['local_cert'] = $aSettings['ClientCert'];
}
return $object;
}
}

View file

@ -180,7 +180,6 @@ trait Response
$sSubject = $mResult['subject'];
$mResult['Hash'] = \md5($mResult['Folder'].$mResult['Uid']);
$mResult['RequestHash'] = Utils::EncodeKeyValuesQ(array(
'V' => APP_VERSION,
'Account' => $oAccount->Hash(),
'Folder' => $mResult['Folder'],
'Uid' => $mResult['Uid'],
@ -237,7 +236,6 @@ trait Response
$mResult = $mResponse->jsonSerialize();
$mResult['IsThumbnail'] = $this->GetCapa(Capa::ATTACHMENT_THUMBNAILS) && $this->isFileHasThumbnail($mResult['FileName']);
$mResult['Download'] = Utils::EncodeKeyValuesQ(array(
'V' => APP_VERSION,
'Account' => $this->getAccountFromToken()->Hash(),
'Folder' => $mResult['Folder'],
'Uid' => $mResult['Uid'],

View file

@ -182,8 +182,7 @@ trait User
if (!$bError) {
$mResult = array(
'FileHash' => Utils::EncodeKeyValuesQ(array(
'V' => APP_VERSION,
'Account' => $oAccount ? \md5($oAccount->Hash()) : '',
'Account' => $oAccount ? $oAccount->Hash() : '',
'FileName' => 'attachments.zip',
'MimeType' => 'application/zip',
'FileHash' => $sZipHash

View file

@ -277,10 +277,7 @@ class ActionsAdmin extends Actions
$oImapClient->SetTimeOuts($iConnectionTimeout);
$iTime = \microtime(true);
$oSettings = new \MailSo\Net\ConnectSettings;
$oSettings->host = $oDomain->IncHost();
$oSettings->port = $oDomain->IncPort();
$oSettings->type = $oDomain->IncSecure();
$oSettings = \MailSo\Net\ConnectSettings::fromArray($oDomain->ImapSettings());
$oImapClient->Connect($oSettings);
$sUsername = $this->GetActionParam('username', '');
@ -339,10 +336,7 @@ class ActionsAdmin extends Actions
$oSmtpClient->SetTimeOuts($iConnectionTimeout);
$iTime = \microtime(true);
$oSettings = new \MailSo\Net\ConnectSettings;
$oSettings->host = $oDomain->OutHost();
$oSettings->port = $oDomain->OutPort();
$oSettings->type = $oDomain->OutSecure();
$oSettings = \MailSo\Net\ConnectSettings::fromArray($oDomain->SmtpSettings());
$oSmtpClient->Connect($oSettings, \MailSo\Smtp\SmtpClient::EhloHelper());
$oSmtpClient->Disconnect();
@ -373,10 +367,7 @@ class ActionsAdmin extends Actions
$oSieveClient->SetTimeOuts($iConnectionTimeout);
$iTime = \microtime(true);
$oSettings = new \MailSo\Net\ConnectSettings;
$oSettings->host = $oDomain->SieveHost();
$oSettings->port = $oDomain->SievePort();
$oSettings->type = $oDomain->SieveSecure();
$oSettings = \MailSo\Net\ConnectSettings::fromArray($oDomain->SieveSettings());
$oSieveClient->Connect($oSettings);
$oSieveClient->Disconnect();

View file

@ -99,9 +99,9 @@ abstract class Account implements \JsonSerializable
{
return \sha1(\implode(APP_SALT, [
$this->sEmail,
$this->Domain()->IncHost(),
$this->Domain()->IncPort(),
$this->sPassword
APP_VERSION
// \json_encode($this->Domain()),
// $this->sPassword
]));
}
@ -213,16 +213,7 @@ abstract class Account implements \JsonSerializable
$oPlugins->RunHook('imap.before-connect', array($this, $oImapClient, &$aCredentials));
if ($aCredentials['UseConnect']) {
$oSettings = new \MailSo\Net\ConnectSettings;
$oSettings->host = $aCredentials['Host'];
$oSettings->port = $aCredentials['Port'];
$oSettings->type = $aCredentials['Secure'];
$oSettings->ssl['verify_peer'] = !!$aCredentials['VerifySsl'];
$oSettings->ssl['verify_peer_name'] = !!$aCredentials['VerifySsl'];
$oSettings->ssl['allow_self_signed'] = !!$aCredentials['AllowSelfSigned'];
if ($aCredentials['ClientCert']) {
$oSettings->ssl['local_cert'] = $aCredentials['ClientCert'];
}
$oSettings = \MailSo\Net\ConnectSettings::fromArray($aCredentials);
$oImapClient->Connect($oSettings);
}
$oPlugins->RunHook('imap.after-connect', array($this, $oImapClient, $aCredentials));
@ -248,13 +239,7 @@ abstract class Account implements \JsonSerializable
$aCredentials['UseAuth'] = $aCredentials['UseAuth'] && !$aCredentials['UsePhpMail'];
if ($aCredentials['UseConnect'] && !$aCredentials['UsePhpMail']) {
$oSettings = new \MailSo\Net\ConnectSettings;
$oSettings->host = $aCredentials['Host'];
$oSettings->port = $aCredentials['Port'];
$oSettings->type = $aCredentials['Secure'];
$oSettings->ssl['verify_peer'] = !!$aCredentials['VerifySsl'];
$oSettings->ssl['verify_peer_name'] = !!$aCredentials['VerifySsl'];
$oSettings->ssl['allow_self_signed'] = !!$aCredentials['AllowSelfSigned'];
$oSettings = \MailSo\Net\ConnectSettings::fromArray($aCredentials);
$oSmtpClient->Connect($oSettings, $aCredentials['Ehlo']);
}
$oPlugins->RunHook('smtp.after-connect', array($this, $oSmtpClient, $aCredentials));
@ -276,13 +261,7 @@ abstract class Account implements \JsonSerializable
$oPlugins->RunHook('sieve.before-connect', array($this, $oSieveClient, &$aCredentials));
if ($aCredentials['UseConnect']) {
$oSettings = new \MailSo\Net\ConnectSettings;
$oSettings->host = $aCredentials['Host'];
$oSettings->port = $aCredentials['Port'];
$oSettings->type = $aCredentials['Secure'];
$oSettings->ssl['verify_peer'] = !!$aCredentials['VerifySsl'];
$oSettings->ssl['verify_peer_name'] = !!$aCredentials['VerifySsl'];
$oSettings->ssl['allow_self_signed'] = !!$aCredentials['AllowSelfSigned'];
$oSettings = \MailSo\Net\ConnectSettings::fromArray($aCredentials);
$oSieveClient->Connect($oSettings);
}
$oPlugins->RunHook('sieve.after-connect', array($this, $oSieveClient, $aCredentials));

View file

@ -6,8 +6,6 @@ use MailSo\Net\Enumerations\ConnectionSecurityType;
class Domain implements \JsonSerializable
{
const DEFAULT_FORWARDED_FLAG = '$Forwarded';
/**
* @var string
*/
@ -106,7 +104,7 @@ class Domain implements \JsonSerializable
/**
* See ToIniString() for valid values
*/
public static function NewInstanceFromDomainConfigArray(string $sName, array $aDomain) : ?self
public static function fromIniArray(string $sName, array $aDomain) : ?self
{
$oDomain = null;
@ -220,6 +218,9 @@ class Domain implements \JsonSerializable
return $sType;
}
/**
* deprecated
*/
public function SetConfig(
string $sIncHost, int $iIncPort, int $iIncSecure, bool $bIncShortLogin,
bool $bUseSieve, string $sSieveHost, int $iSievePort, int $iSieveSecure,
@ -265,11 +266,6 @@ class Domain implements \JsonSerializable
return $this->iIncPort;
}
public function IncSecure() : int
{
return $this->iIncSecure;
}
public function IncShortLogin() : bool
{
return $this->bIncShortLogin;
@ -280,21 +276,6 @@ class Domain implements \JsonSerializable
return $this->bUseSieve;
}
public function SieveHost() : string
{
return $this->sSieveHost;
}
public function SievePort() : int
{
return $this->iSievePort;
}
public function SieveSecure() : int
{
return $this->iSieveSecure;
}
public function OutHost() : string
{
return $this->sOutHost;
@ -305,21 +286,11 @@ class Domain implements \JsonSerializable
return $this->iOutPort;
}
public function OutSecure() : int
{
return $this->iOutSecure;
}
public function OutShortLogin() : bool
{
return $this->bOutShortLogin;
}
public function OutAuth() : bool
{
return $this->bOutAuth;
}
public function OutSetSender() : bool
{
return $this->bOutSetSender;
@ -330,21 +301,9 @@ class Domain implements \JsonSerializable
return $this->bOutUsePhpMail;
}
public function WhiteList() : string
{
return $this->sWhiteList;
}
public function AliasName() : string
{
return $this->sAliasName;
}
public function SetAliasName(string $sAliasName) : self
public function SetAliasName(string $sAliasName) : void
{
$this->sAliasName = $sAliasName;
return $this;
}
public function ValidateWhiteList(string $sEmail, string $sLogin = '') : bool
@ -400,10 +359,42 @@ class Domain implements \JsonSerializable
);
}
/**
* See jsonSerialize() for valid values
*/
public static function fromArray(string $sName, array $aDomain) : ?self
{
$oDomain = null;
if (\strlen($sName) && \strlen($aDomain['imapHost'])) {
$oDomain = new self($sName);
$oDomain->sIncHost = \MailSo\Base\Utils::IdnToAscii($aDomain['imapHost']);
$oDomain->iIncPort = (int) $aDomain['imapPort'];
$oDomain->iIncSecure = (int) $aDomain['imapSecure'];
$oDomain->bIncShortLogin = !empty($aDomain['imapShortLogin']);
$oDomain->bUseSieve = !empty($aDomain['useSieve']);
$oDomain->sSieveHost = \MailSo\Base\Utils::IdnToAscii($aDomain['sieveHost']);
$oDomain->iSievePort = (int) $aDomain['sievePort'];
$oDomain->iSieveSecure = (int) $aDomain['sieveSecure'];
$oDomain->sOutHost = \MailSo\Base\Utils::IdnToAscii($aDomain['smtpHost']);
$oDomain->iOutPort = (int) $aDomain['smtpPort'];
$oDomain->iOutSecure = (int) $aDomain['smtpSecure'];
$oDomain->bOutShortLogin = !empty($aDomain['smtpShortLogin']);
$oDomain->bOutAuth = !empty($aDomain['smtpAuth']);
$oDomain->bOutSetSender = !empty($aDomain['smtpSetSender']);
$oDomain->bOutUsePhpMail = !empty($aDomain['smtpPhpMail']);
$oDomain->sWhiteList = (string) $aDomain['whiteList'];
}
return $oDomain;
}
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return array(
$aResult = array(
// '@Object' => 'Object/Domain',
'name' => \MailSo\Base\Utils::IdnToUtf8($this->sName),
'imapHost' => \MailSo\Base\Utils::IdnToUtf8($this->sIncHost),
@ -421,8 +412,11 @@ class Domain implements \JsonSerializable
'smtpAuth' => $this->bOutAuth,
'smtpSetSender' => $this->bOutSetSender,
'smtpPhpMail' => $this->bOutUsePhpMail,
'whiteList' => $this->sWhiteList,
'aliasName' => $this->sAliasName
'whiteList' => $this->sWhiteList
);
if ($this->sAliasName) {
$aResult['aliasName'] = $this->sAliasName;
}
return $aResult;
}
}

View file

@ -14,8 +14,7 @@ class Domain extends AbstractProvider
*/
private $oPlugins;
public function __construct(Domain\DomainInterface $oDriver,
\RainLoop\Plugins\Manager $oPlugins)
public function __construct(Domain\DomainInterface $oDriver, \RainLoop\Plugins\Manager $oPlugins)
{
$this->oDriver = $oDriver;
$this->oPlugins = $oPlugins;
@ -24,11 +23,7 @@ class Domain extends AbstractProvider
public function Load(string $sName, bool $bFindWithWildCard = false, bool $bCheckDisabled = true, bool $bCheckAliases = true) : ?\RainLoop\Model\Domain
{
$oDomain = $this->oDriver->Load($sName, $bFindWithWildCard, $bCheckDisabled, $bCheckAliases);
if ($oDomain instanceof \RainLoop\Model\Domain)
{
$this->oPlugins->RunHook('filter.domain', array(&$oDomain));
}
$oDomain && $this->oPlugins->RunHook('filter.domain', array($oDomain));
return $oDomain;
}
@ -39,11 +34,9 @@ class Domain extends AbstractProvider
public function SaveAlias(string $sName, string $sAlias) : bool
{
if ($this->Load($sName, false, false))
{
if ($this->Load($sName, false, false)) {
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainAlreadyExists);
}
return $this->oDriver->SaveAlias($sName, $sAlias);
}
@ -64,60 +57,34 @@ class Domain extends AbstractProvider
public function LoadOrCreateNewFromAction(\RainLoop\Actions $oActions, string $sNameForTest = null) : ?\RainLoop\Model\Domain
{
$oDomain = null;
$sName = (string) $oActions->GetActionParam('Name', '');
if (\strlen($sName) && $sNameForTest && !\str_contains($sName, '*'))
{
if (\strlen($sName) && $sNameForTest && !\str_contains($sName, '*')) {
$sNameForTest = null;
}
if (\strlen($sName) || $sNameForTest)
{
$bCreate = !empty($oActions->GetActionParam('Create', 0));
$sIncHost = (string) $oActions->GetActionParam('IncHost', '');
$iIncPort = (int) $oActions->GetActionParam('IncPort', 143);
$iIncSecure = (int) $oActions->GetActionParam('IncSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE);
$bIncShortLogin = !empty($oActions->GetActionParam('IncShortLogin', 0));
$bUseSieve = !empty($oActions->GetActionParam('UseSieve', 0));
$sSieveHost = (string) $oActions->GetActionParam('SieveHost', '');
$iSievePort = (int) $oActions->GetActionParam('SievePort', 4190);
$iSieveSecure = (int) $oActions->GetActionParam('SieveSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE);
$sOutHost = (string) $oActions->GetActionParam('OutHost', '');
$iOutPort = (int) $oActions->GetActionParam('OutPort', 25);
$iOutSecure = (int) $oActions->GetActionParam('OutSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE);
$bOutShortLogin = !empty($oActions->GetActionParam('OutShortLogin', 0));
$bOutAuth = !empty($oActions->GetActionParam('OutAuth', 1));
$bOutSetSender = !empty($oActions->GetActionParam('OutSetSender', 0));
$bOutUsePhpMail = !empty($oActions->GetActionParam('OutUsePhpMail', 0));
$sWhiteList = (string) $oActions->GetActionParam('WhiteList', '');
$oDomain = $sNameForTest ? null : $this->Load($sName);
if ($oDomain instanceof \RainLoop\Model\Domain)
{
if ($bCreate)
{
if (\strlen($sName) || $sNameForTest) {
if (!$sNameForTest && !empty($oActions->GetActionParam('Create', 0)) && $this->Load($sName)) {
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainAlreadyExists);
}
return \RainLoop\Model\Domain::fromArray($sNameForTest ?: $sName, [
'imapHost' => $oActions->GetActionParam('IncHost', ''),
'imapPort' => $oActions->GetActionParam('IncPort', 143),
'imapSecure' => $oActions->GetActionParam('IncSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE),
'imapShortLogin' => $oActions->GetActionParam('IncShortLogin', 0),
'useSieve' => $oActions->GetActionParam('UseSieve', 0),
'sieveHost' => $oActions->GetActionParam('SieveHost', ''),
'sievePort' => $oActions->GetActionParam('SievePort', 4190),
'sieveSecure' => $oActions->GetActionParam('SieveSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE),
'smtpHost' => $oActions->GetActionParam('OutHost', ''),
'smtpPort' => $oActions->GetActionParam('OutPort', 25),
'smtpSecure' => $oActions->GetActionParam('OutSecure', \MailSo\Net\Enumerations\ConnectionSecurityType::NONE),
'smtpShortLogin' => $oActions->GetActionParam('OutShortLogin', 0),
'smtpAuth' => $oActions->GetActionParam('OutAuth', 1),
'smtpSetSender' => $oActions->GetActionParam('OutSetSender', 0),
'smtpPhpMail' => $oActions->GetActionParam('OutUsePhpMail', 0),
'whiteList' => $oActions->GetActionParam('WhiteList', '')
]);
}
else
{
$oDomain = new \RainLoop\Model\Domain($sNameForTest ?: $sName);
}
$sIncHost = \MailSo\Base\Utils::IdnToAscii($sIncHost);
$sSieveHost = \MailSo\Base\Utils::IdnToAscii($sSieveHost);
$sOutHost = \MailSo\Base\Utils::IdnToAscii($sOutHost);
$oDomain->SetConfig(
$sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin,
$bUseSieve, $sSieveHost, $iSievePort, $iSieveSecure,
$sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $bOutSetSender, $bOutUsePhpMail,
$sWhiteList);
}
return $oDomain;
return null;
}
public function IsActive() : bool

View file

@ -42,36 +42,38 @@ class DefaultDomain implements DomainInterface
private function getWildcardDomainsLine() : string
{
if ($this->oCacher)
{
if ($this->oCacher) {
$sResult = $this->oCacher->Get(static::wildcardDomainsCacheKey());
if (\strlen($sResult))
{
if (\strlen($sResult)) {
return $sResult;
}
}
$sResult = '';
$aNames = array();
// $aList = \glob($this->sDomainPath.'/*.{ini,json}', GLOB_BRACE);
$aList = \glob($this->sDomainPath.'/*.json');
foreach ($aList as $sFile) {
$sName = \substr(\basename($sFile), 0, -5);
if ('default' === $sName || false !== \strpos($sName, '_wildcard_')) {
$aNames[] = static::codeFileName($sName, true);
}
}
$aList = \glob($this->sDomainPath.'/*.ini');
foreach ($aList as $sFile)
{
foreach ($aList as $sFile) {
$sName = \substr(\basename($sFile), 0, -4);
if ('default' === $sName || false !== \strpos($sName, '_wildcard_'))
{
if ('default' === $sName || false !== \strpos($sName, '_wildcard_')) {
$aNames[] = static::codeFileName($sName, true);
}
}
if (\count($aNames))
{
$sResult = '';
if ($aNames) {
\rsort($aNames, SORT_STRING);
$sResult = \implode(' ', $aNames);
$sResult = \implode(' ', \array_unique($aNames));
}
if ($this->oCacher)
{
if ($this->oCacher) {
$this->oCacher->Set(static::wildcardDomainsCacheKey(), $sResult);
}
@ -80,62 +82,48 @@ class DefaultDomain implements DomainInterface
public function Load(string $sName, bool $bFindWithWildCard = false, bool $bCheckDisabled = true, bool $bCheckAliases = true) : ?\RainLoop\Model\Domain
{
$mResult = null;
if ($bCheckDisabled) {
$aDisabled = [];
$sFoundValue = '';
if (\file_exists($this->sDomainPath.'/disabled')) {
$aDisabled = \explode(',', \file_get_contents($this->sDomainPath.'/disabled'));
if ($aDisabled && \in_array(\MailSo\Base\Utils::IdnToAscii($sName, true), $aDisabled)) {
return null;
}
}
}
$sRealFileName = static::codeFileName($sName);
if (\file_exists($this->sDomainPath.'/disabled')) {
$aDisabled = \explode(',', \file_get_contents($this->sDomainPath.'/disabled'));
if (\file_exists($this->sDomainPath.'/'.$sRealFileName.'.json')) {
$aDomain = \json_decode(\file_get_contents($this->sDomainPath.'/'.$sRealFileName.'.json'), true) ?: array();
return \RainLoop\Model\Domain::fromArray($sName, $aDomain);
}
$bCheckDisabled = $bCheckDisabled && 0 < \count($aDisabled);
if (\file_exists($this->sDomainPath.'/'.$sRealFileName.'.ini') &&
(!$bCheckDisabled || !\in_array(\MailSo\Base\Utils::IdnToAscii($sName, true), $aDisabled)))
{
if (\file_exists($this->sDomainPath.'/'.$sRealFileName.'.ini')) {
$aDomain = \parse_ini_file($this->sDomainPath.'/'.$sRealFileName.'.ini') ?: array();
// if ($bCheckAliases && !empty($aDomain['alias']))
// {
// $oDomain = $this->Load($aDomain['alias'], false, false, false);
// if ($oDomain && $oDomain instanceof \RainLoop\Model\Domain)
// {
// $oDomain->SetAliasName($sName);
// }
//
// return $oDomain;
// }
$mResult = \RainLoop\Model\Domain::NewInstanceFromDomainConfigArray($sName, $aDomain);
}
else if ($bCheckAliases && \file_exists($this->sDomainPath.'/'.$sRealFileName.'.alias') &&
(!$bCheckDisabled || !\in_array(\MailSo\Base\Utils::IdnToAscii($sName, true), $aDisabled)))
{
$sAlias = \trim(\file_get_contents($this->sDomainPath.'/'.$sRealFileName.'.alias'));
if (!empty($sAlias))
{
$oDomain = $this->Load($sAlias, false, false, false);
if ($oDomain && $oDomain instanceof \RainLoop\Model\Domain)
{
$oDomain->SetAliasName($sName);
return \RainLoop\Model\Domain::fromIniArray($sName, $aDomain);
}
if ($bCheckAliases && \file_exists($this->sDomainPath.'/'.$sRealFileName.'.alias')) {
$sAlias = \trim(\file_get_contents($this->sDomainPath.'/'.$sRealFileName.'.alias'));
if (!empty($sAlias)) {
$oDomain = $this->Load($sAlias, false, false, false);
$oDomain && $oDomain->SetAliasName($sName);
return $oDomain;
}
}
else if ($bFindWithWildCard)
{
if ($bFindWithWildCard) {
$sNames = $this->getWildcardDomainsLine();
$sFoundValue = '';
if (\strlen($sNames)
&& \RainLoop\Plugins\Helper::ValidateWildcardValues(\MailSo\Base\Utils::IdnToUtf8($sName, true), $sNames, $sFoundValue)
&& \strlen($sFoundValue)
&& (!$bCheckDisabled || !\in_array($sFoundValue, $aDisabled))
) {
$mResult = $this->Load($sFoundValue, false);
return $this->Load($sFoundValue, false);
}
}
return $mResult;
return null;
}
public function Save(\RainLoop\Model\Domain $oDomain) : bool
@ -147,7 +135,8 @@ class DefaultDomain implements DomainInterface
$this->oCacher->Delete(static::wildcardDomainsCacheKey());
}
\RainLoop\Utils::saveFile($this->sDomainPath.'/'.$sRealFileName.'.ini', $oDomain->ToIniString());
// \RainLoop\Utils::saveFile($this->sDomainPath.'/'.$sRealFileName.'.ini', $oDomain->ToIniString());
\RainLoop\Utils::saveFile($this->sDomainPath.'/'.$sRealFileName.'.json', \json_encode($oDomain, \JSON_PRETTY_PRINT));
return true;
}
@ -204,6 +193,10 @@ class DefaultDomain implements DomainInterface
if (\strlen($sName))
{
if (\file_exists($this->sDomainPath.'/'.$sRealFileName.'.json'))
{
$bResult = \unlink($this->sDomainPath.'/'.$sRealFileName.'.json');
}
if (\file_exists($this->sDomainPath.'/'.$sRealFileName.'.ini'))
{
$bResult = \unlink($this->sDomainPath.'/'.$sRealFileName.'.ini');
@ -245,12 +238,12 @@ class DefaultDomain implements DomainInterface
$aWildCards = array();
$aAliases = array();
// $aList = \glob($this->sDomainPath.'/*.{ini,alias}', GLOB_BRACE);
// $aList = \glob($this->sDomainPath.'/*.{ini,json,alias}', GLOB_BRACE);
$aList = \array_diff(\scandir($this->sDomainPath), array('.', '..'));
foreach ($aList as $sFile) {
$bAlias = '.alias' === \substr($sFile, -6);
if ($bAlias || '.ini' === \substr($sFile, -4)) {
$sName = static::codeFileName(\preg_replace('/\.(ini|alias)$/', '', $sFile), true);
if ($bAlias || '.json' === \substr($sFile, -5) || '.ini' === \substr($sFile, -4)) {
$sName = static::codeFileName(\preg_replace('/\.(ini|json|alias)$/', '', $sFile), true);
if ($bAlias) {
if ($bIncludeAliases) {
$aAliases[$sName] = array(