diff --git a/lib/Froxlor/Api/Commands/Domains.php b/lib/Froxlor/Api/Commands/Domains.php index d5e3f5e9..86667043 100644 --- a/lib/Froxlor/Api/Commands/Domains.php +++ b/lib/Froxlor/Api/Commands/Domains.php @@ -1634,7 +1634,31 @@ class Domains extends ApiCommand implements ResourceEntity $wwwserveralias = ($serveraliasoption == '1') ? '1' : '0'; $iswildcarddomain = ($serveraliasoption == '0') ? '1' : '0'; - if ($documentroot != $result['documentroot'] || $ssl_redirect != $result['ssl_redirect'] || $wwwserveralias != $result['wwwserveralias'] || $iswildcarddomain != $result['iswildcarddomain'] || $phpenabled != $result['phpenabled'] || $openbasedir != $result['openbasedir'] || $phpsettingid != $result['phpsettingid'] || $mod_fcgid_starter != $result['mod_fcgid_starter'] || $mod_fcgid_maxrequests != $result['mod_fcgid_maxrequests'] || $specialsettings != $result['specialsettings'] || $ssl_specialsettings != $result['ssl_specialsettings'] || $notryfiles != $result['notryfiles'] || $writeaccesslog != $result['writeaccesslog'] || $writeerrorlog != $result['writeerrorlog'] || $aliasdomain != $result['aliasdomain'] || $issubof != $result['ismainbutsubto'] || $email_only != $result['email_only'] || ($speciallogfile != $result['speciallogfile'] && $speciallogverified == '1') || $letsencrypt != $result['letsencrypt'] || $http2 != $result['http2'] || $hsts_maxage != $result['hsts'] || $hsts_sub != $result['hsts_sub'] || $hsts_preload != $result['hsts_preload'] || $ocsp_stapling != $result['ocsp_stapling']) { + if ($documentroot != $result['documentroot'] + || $ssl_redirect != $result['ssl_redirect'] + || $wwwserveralias != $result['wwwserveralias'] + || $iswildcarddomain != $result['iswildcarddomain'] + || $phpenabled != $result['phpenabled'] + || $openbasedir != $result['openbasedir'] + || $phpsettingid != $result['phpsettingid'] + || $mod_fcgid_starter != $result['mod_fcgid_starter'] + || $mod_fcgid_maxrequests != $result['mod_fcgid_maxrequests'] + || $specialsettings != $result['specialsettings'] + || $ssl_specialsettings != $result['ssl_specialsettings'] + || $notryfiles != $result['notryfiles'] + || $writeaccesslog != $result['writeaccesslog'] + || $writeerrorlog != $result['writeerrorlog'] + || $aliasdomain != $result['aliasdomain'] + || $issubof != $result['ismainbutsubto'] + || $email_only != $result['email_only'] + || ($speciallogfile != $result['speciallogfile'] && $speciallogverified == '1') + || $letsencrypt != $result['letsencrypt'] + || $http2 != $result['http2'] + || $hsts_maxage != $result['hsts'] + || $hsts_sub != $result['hsts_sub'] + || $hsts_preload != $result['hsts_preload'] + || $ocsp_stapling != $result['ocsp_stapling'] + ) { Cronjob::inserttask(TaskId::REBUILD_VHOST); } @@ -1914,6 +1938,15 @@ class Domains extends ApiCommand implements ResourceEntity "); Database::pexecute($_update_stmt, $_update_data, true, true); + // get current ip<>domain entries + $ip_sel_stmt = Database::prepare(" + SELECT id_ipandports FROM `" . TABLE_DOMAINTOIP . "` WHERE `id_domain` = :id + "); + Database::pexecute($ip_sel_stmt, [ + 'id' => $id + ], true, true); + $current_ips = $ip_sel_stmt->fetchAll(\PDO::FETCH_ASSOC); + // Cleanup domain <-> ip mapping $del_stmt = Database::prepare(" DELETE FROM `" . TABLE_DOMAINTOIP . "` WHERE `id_domain` = :id @@ -1941,6 +1974,12 @@ class Domains extends ApiCommand implements ResourceEntity } } + // check ip changes + $all_new_ips = array_merge($ipandports, $ssl_ipandports); + if (count(array_diff($current_ips, $all_new_ips)) != 0 || count(array_diff($all_new_ips, $current_ips)) != 0) { + Cronjob::inserttask(TaskId::REBUILD_VHOST); + } + // Cleanup domain <-> ip mapping for subdomains $domainidsresult_stmt = Database::prepare(" SELECT `id` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `parentdomainid` = :id diff --git a/lib/Froxlor/Cli/InstallCommand.php b/lib/Froxlor/Cli/InstallCommand.php index cd1f5484..45209dc1 100644 --- a/lib/Froxlor/Cli/InstallCommand.php +++ b/lib/Froxlor/Cli/InstallCommand.php @@ -80,7 +80,7 @@ final class InstallCommand extends Command $_SERVER['SERVER_NAME'] = $host[0] ?? ''; $ips = []; exec('hostname -I', $ips); - $ips = explode(" ", $ips[0]); + $ips = explode(" ", $ips[0] ?? ""); // ipv4 address? $_SERVER['SERVER_ADDR'] = filter_var($ips[0] ?? "", FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) ? ($ips[0] ?? '') : ''; if (empty($_SERVER['SERVER_ADDR'])) {