mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-05 23:47:03 +03:00
A lot small fixes
This commit is contained in:
parent
4457cdbc23
commit
09334159c2
38 changed files with 1496 additions and 239 deletions
|
|
@ -9,6 +9,11 @@ abstract class AbstractConfig
|
|||
*/
|
||||
private $sFile;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $sAdditionalFile;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
|
|
@ -27,12 +32,19 @@ abstract class AbstractConfig
|
|||
/**
|
||||
* @param string $sFileName
|
||||
* @param string $sFileHeader = ''
|
||||
* @param string $sAdditionalFileName = ''
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($sFileName, $sFileHeader = '')
|
||||
public function __construct($sFileName, $sFileHeader = '', $sAdditionalFileName = '')
|
||||
{
|
||||
$this->sFile = \APP_PRIVATE_DATA.'configs/'.$sFileName;
|
||||
$this->sFile = \APP_PRIVATE_DATA.'configs/'.\trim($sFileName);
|
||||
|
||||
$sAdditionalFileName = \trim($sAdditionalFileName);
|
||||
$this->sAdditionalFile = \APP_PRIVATE_DATA.'configs/'.$sAdditionalFileName;
|
||||
$this->sAdditionalFile = 0 < \strlen($sAdditionalFileName) &&
|
||||
\file_exists($this->sAdditionalFile) ? $this->sAdditionalFile : '';
|
||||
|
||||
$this->sFileHeader = $sFileHeader;
|
||||
$this->aData = $this->defaultValues();
|
||||
|
||||
|
|
@ -109,7 +121,7 @@ abstract class AbstractConfig
|
|||
*/
|
||||
private function cacheKey()
|
||||
{
|
||||
return 'config:'.\sha1($this->sFile).':';
|
||||
return 'config:'.\sha1($this->sFile).':'.\sha1($this->sAdditionalFile).':';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -120,12 +132,17 @@ abstract class AbstractConfig
|
|||
if ($this->bUseApcCache)
|
||||
{
|
||||
$iMTime = @\filemtime($this->sFile);
|
||||
if (\is_int($iMTime) && 0 < $iMTime)
|
||||
$iMTime = \is_int($iMTime) && 0 < $iMTime ? $iMTime : 0;
|
||||
|
||||
$iATime = $this->sAdditionalFile ? @\filemtime($this->sAdditionalFile) : 0;
|
||||
$iATime = \is_int($iATime) && 0 < $iATime ? $iATime : 0;
|
||||
|
||||
if (0 < $iMTime)
|
||||
{
|
||||
$sKey = $this->cacheKey();
|
||||
|
||||
$iTime = \apc_fetch($sKey.'time');
|
||||
if ($iTime && $iMTime === (int) $iTime)
|
||||
$sTimeHash = \apc_fetch($sKey.'time');
|
||||
if ($sTimeHash && $sTimeHash === \md5($iMTime.'/'.$iATime))
|
||||
{
|
||||
$aFetchData = \apc_fetch($sKey.'data');
|
||||
if (\is_array($aFetchData))
|
||||
|
|
@ -148,11 +165,16 @@ abstract class AbstractConfig
|
|||
if ($this->bUseApcCache)
|
||||
{
|
||||
$iMTime = @\filemtime($this->sFile);
|
||||
if (\is_int($iMTime) && 0 < $iMTime)
|
||||
$iMTime = \is_int($iMTime) && 0 < $iMTime ? $iMTime : 0;
|
||||
|
||||
$iATime = $this->sAdditionalFile ? @\filemtime($this->sAdditionalFile) : 0;
|
||||
$iATime = \is_int($iATime) && 0 < $iATime ? $iATime : 0;
|
||||
|
||||
if (0 < $iMTime)
|
||||
{
|
||||
$sKey = $this->cacheKey();
|
||||
|
||||
\apc_store($sKey.'time', $iMTime);
|
||||
\apc_store($sKey.'time', \md5($iMTime.'/'.$iATime));
|
||||
\apc_store($sKey.'data', $this->aData);
|
||||
|
||||
return true;
|
||||
|
|
@ -193,7 +215,7 @@ abstract class AbstractConfig
|
|||
}
|
||||
|
||||
$aData = \RainLoop\Utils::CustomParseIniFile($this->sFile, true);
|
||||
if (\is_array($aData) && 0 < count($aData))
|
||||
if (\is_array($aData) && 0 < \count($aData))
|
||||
{
|
||||
foreach ($aData as $sSectionKey => $aSectionValue)
|
||||
{
|
||||
|
|
@ -206,6 +228,28 @@ abstract class AbstractConfig
|
|||
}
|
||||
}
|
||||
|
||||
unset($aData);
|
||||
|
||||
if (\file_exists($this->sAdditionalFile) && \is_readable($this->sAdditionalFile))
|
||||
{
|
||||
$aSubData = \RainLoop\Utils::CustomParseIniFile($this->sAdditionalFile, true);
|
||||
if (\is_array($aSubData) && 0 < \count($aSubData))
|
||||
{
|
||||
foreach ($aSubData as $sSectionKey => $aSectionValue)
|
||||
{
|
||||
if (\is_array($aSectionValue))
|
||||
{
|
||||
foreach ($aSectionValue as $sParamKey => $mParamValue)
|
||||
{
|
||||
$this->Set($sSectionKey, $sParamKey, $mParamValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($aSubData);
|
||||
}
|
||||
|
||||
$this->storeDataToCache();
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ class Application extends \RainLoop\Config\AbstractConfig
|
|||
{
|
||||
parent::__construct('application.ini',
|
||||
'; RainLoop Webmail configuration file
|
||||
; Please don\'t add custom parameters here, those will be overwritten');
|
||||
; Please don\'t add custom parameters here, those will be overwritten',
|
||||
defined('APP_ADDITIONAL_CONFIGURATION_NAME') ? APP_ADDITIONAL_CONFIGURATION_NAME : '');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -321,6 +322,7 @@ Enables caching in the system'),
|
|||
'imap_message_list_count_limit_trigger' => array(0),
|
||||
'imap_message_list_date_filter' => array(0),
|
||||
'imap_message_list_permanent_filter' => array(''),
|
||||
'imap_message_all_headers' => array(false),
|
||||
'imap_large_thread_limit' => array(50),
|
||||
'imap_folder_list_limit' => array(200),
|
||||
'imap_show_login_alert' => array(true),
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class Plugin extends \RainLoop\Config\AbstractConfig
|
|||
*/
|
||||
private function convertConfigMap($aMap)
|
||||
{
|
||||
if (0 < count($aMap))
|
||||
if (0 < \count($aMap))
|
||||
{
|
||||
$aResultMap = array();
|
||||
foreach ($aMap as /* @var $oProperty \RainLoop\Plugins\Property */ $oProperty)
|
||||
|
|
@ -33,12 +33,12 @@ class Plugin extends \RainLoop\Config\AbstractConfig
|
|||
if ($oProperty)
|
||||
{
|
||||
$mValue = $oProperty->DefaultValue();
|
||||
$sValue = is_array($mValue) && isset($mValue[0]) ? $mValue[0] : $mValue;
|
||||
$sValue = \is_array($mValue) && isset($mValue[0]) ? $mValue[0] : $mValue;
|
||||
$aResultMap[$oProperty->Name()] = array($sValue, '');
|
||||
}
|
||||
}
|
||||
|
||||
if (0 < count($aResultMap))
|
||||
if (0 < \count($aResultMap))
|
||||
{
|
||||
return array(
|
||||
'plugin' => $aResultMap
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue