mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-09-07 13:44:13 +08:00
simplify custom include.php
This commit is contained in:
parent
6d958081c4
commit
e434d51157
3 changed files with 32 additions and 27 deletions
32
_include.php
32
_include.php
|
@ -4,35 +4,33 @@
|
||||||
|
|
||||||
//header('Strict-Transport-Security: max-age=31536000');
|
//header('Strict-Transport-Security: max-age=31536000');
|
||||||
|
|
||||||
// Uncomment to use gzip compressed output
|
/**
|
||||||
|
* Uncomment to use gzip compressed output
|
||||||
|
*/
|
||||||
//define('USE_GZIP', 1);
|
//define('USE_GZIP', 1);
|
||||||
|
|
||||||
// Uncomment to use brotli compressed output
|
/**
|
||||||
|
* Uncomment to use brotli compressed output
|
||||||
|
*/
|
||||||
//define('USE_BROTLI', 1);
|
//define('USE_BROTLI', 1);
|
||||||
|
|
||||||
// Uncomment to enable multiple domain installation.
|
/**
|
||||||
|
* Uncomment to enable multiple domain installation.
|
||||||
|
*/
|
||||||
//define('MULTIDOMAIN', 1);
|
//define('MULTIDOMAIN', 1);
|
||||||
|
|
||||||
// Uncomment to disable APCU.
|
/**
|
||||||
|
* Uncomment to disable APCU.
|
||||||
|
*/
|
||||||
//define('APP_USE_APCU_CACHE', false);
|
//define('APP_USE_APCU_CACHE', false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom 'data' folder path
|
* Custom 'data' folder path
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
function __get_custom_data_full_path()
|
//define('APP_DATA_FOLDER_PATH', dirname(__DIR__) . '/snappymail-data/');
|
||||||
{
|
//define('APP_DATA_FOLDER_PATH', '/var/external-snappymail-data-folder/');
|
||||||
return '';
|
|
||||||
return dirname(__DIR__) . '/snappymail-data';
|
|
||||||
return '/var/external-snappymail-data-folder';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional configuration file name
|
* Additional configuration file name
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
function __get_additional_configuration_name()
|
//define('APP_CONFIGURATION_NAME', $_SERVER['HTTP_HOST'].'.ini');
|
||||||
{
|
|
||||||
return '';
|
|
||||||
return defined('APP_SITE') && 0 < strlen(APP_SITE) ? APP_SITE.'.ini' : '';
|
|
||||||
}
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ abstract class AbstractConfig implements \JsonSerializable
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
private $sAdditionalFile;
|
private $sAdditionalFile = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
|
@ -34,9 +34,12 @@ abstract class AbstractConfig implements \JsonSerializable
|
||||||
$this->sFile = \APP_PRIVATE_DATA.'configs/'.\trim($sFileName);
|
$this->sFile = \APP_PRIVATE_DATA.'configs/'.\trim($sFileName);
|
||||||
|
|
||||||
$sAdditionalFileName = \trim($sAdditionalFileName);
|
$sAdditionalFileName = \trim($sAdditionalFileName);
|
||||||
$this->sAdditionalFile = \APP_PRIVATE_DATA.'configs/'.$sAdditionalFileName;
|
if (\strlen($sAdditionalFileName)) {
|
||||||
$this->sAdditionalFile = \strlen($sAdditionalFileName) &&
|
$sAdditionalFileName = \APP_PRIVATE_DATA.'configs/'.$sAdditionalFileName;
|
||||||
\file_exists($this->sAdditionalFile) ? $this->sAdditionalFile : '';
|
if (\file_exists($this->sAdditionalFile)) {
|
||||||
|
$this->sAdditionalFile = $this->sAdditionalFile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->sFileHeader = $sFileHeader;
|
$this->sFileHeader = $sFileHeader;
|
||||||
$this->aData = $this->defaultValues();
|
$this->aData = $this->defaultValues();
|
||||||
|
|
|
@ -65,13 +65,17 @@ define('APP_PRIVATE_DATA_NAME', $sPrivateDataFolderInternalName ?: '_default_');
|
||||||
|
|
||||||
defined('APP_USE_APCU_CACHE') || define('APP_USE_APCU_CACHE', true);
|
defined('APP_USE_APCU_CACHE') || define('APP_USE_APCU_CACHE', true);
|
||||||
|
|
||||||
$sCustomDataPath = function_exists('__get_custom_data_full_path') ? rtrim(trim(__get_custom_data_full_path()), '\\/') : $sCustomDataPath;
|
if (!defined('APP_DATA_FOLDER_PATH')) {
|
||||||
define('APP_DATA_FOLDER_PATH', strlen($sCustomDataPath) ? $sCustomDataPath.'/' : APP_INDEX_ROOT_PATH.'data/');
|
$sCustomDataPath = function_exists('__get_custom_data_full_path') ? rtrim(trim(__get_custom_data_full_path()), '\\/') : $sCustomDataPath;
|
||||||
unset($sCustomDataPath);
|
define('APP_DATA_FOLDER_PATH', strlen($sCustomDataPath) ? $sCustomDataPath.'/' : APP_INDEX_ROOT_PATH.'data/');
|
||||||
|
unset($sCustomDataPath);
|
||||||
|
}
|
||||||
|
|
||||||
define('APP_CONFIGURATION_NAME', function_exists('__get_additional_configuration_name')
|
if (!defined('APP_CONFIGURATION_NAME')) {
|
||||||
? trim(__get_additional_configuration_name()) : $sCustomConfiguration);
|
define('APP_CONFIGURATION_NAME', function_exists('__get_additional_configuration_name')
|
||||||
unset($sCustomConfiguration);
|
? trim(__get_additional_configuration_name()) : $sCustomConfiguration);
|
||||||
|
unset($sCustomConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
// installation checking data folder
|
// installation checking data folder
|
||||||
$sInstalled = is_file(APP_DATA_FOLDER_PATH.'INSTALLED') ? file_get_contents(APP_DATA_FOLDER_PATH.'INSTALLED') : '';
|
$sInstalled = is_file(APP_DATA_FOLDER_PATH.'INSTALLED') ? file_get_contents(APP_DATA_FOLDER_PATH.'INSTALLED') : '';
|
||||||
|
|
Loading…
Add table
Reference in a new issue