Better cPanel integration #697

This commit is contained in:
the-djmaze 2022-11-24 14:30:09 +01:00
parent 3948b11998
commit b44da10e27
3 changed files with 40 additions and 12 deletions

View file

@ -71,16 +71,21 @@ define('APP_PRIVATE_DATA_NAME', $sPrivateDataFolderInternalName ?: '_default_');
unset($sPrivateDataFolderInternalName);
if (!defined('APP_DATA_FOLDER_PATH')) {
$sCustomDataPath = function_exists('__get_custom_data_full_path') ? rtrim(trim(__get_custom_data_full_path()), '\\/') : $sCustomDataPath;
// cPanel https://github.com/the-djmaze/snappymail/issues/697
if (!empty($_ENV['CPANEL']) && isset($_ENV['TMPDIR'])) {
$sCustomDataPath = $_ENV['TMPDIR'] . '/snappymail';
} else {
$sCustomDataPath = function_exists('__get_custom_data_full_path') ? rtrim(trim(__get_custom_data_full_path()), '\\/') : $sCustomDataPath;
}
define('APP_DATA_FOLDER_PATH', strlen($sCustomDataPath) ? $sCustomDataPath.'/' : APP_INDEX_ROOT_PATH.'data/');
unset($sCustomDataPath);
}
unset($sCustomDataPath);
if (!defined('APP_CONFIGURATION_NAME')) {
define('APP_CONFIGURATION_NAME', function_exists('__get_additional_configuration_name')
? trim(__get_additional_configuration_name()) : $sCustomConfiguration);
unset($sCustomConfiguration);
}
unset($sCustomConfiguration);
$sData = is_file(APP_DATA_FOLDER_PATH.'DATA.php') ? file_get_contents(APP_DATA_FOLDER_PATH.'DATA.php') : '';
define('APP_PRIVATE_DATA', APP_DATA_FOLDER_PATH.'_data_'.($sData ? md5($sData) : '').'/'.APP_PRIVATE_DATA_NAME.'/');
@ -158,6 +163,11 @@ if (!ini_get('zlib.output_compression') && !ini_get('brotli.output_compression')
}
}
// cPanel https://github.com/the-djmaze/snappymail/issues/697
if (!empty($_ENV['CPANEL']) && !is_dir(APP_PLUGINS_PATH.'login-remote')) {
require __DIR__ . '/cpanel.php';
}
if (class_exists('RainLoop\\Api')) {
RainLoop\Api::Handle();
// NextCloud/OwnCloud?