Added logging to the scripts

This commit is contained in:
Alexey Berezhok
2025-01-17 00:03:38 +03:00
parent 88acd290f4
commit 05d102cba7
3 changed files with 24 additions and 6 deletions

View File

@@ -25,7 +25,7 @@ const (
PATH_TO_LOCAL_PHP_ROOT = "php_sel"
PATH_TO_LOCAL_PHP = PATH_TO_LOCAL_PHP_ROOT + PATH_TO_CONFIG_NAME
LOCK_PATH = "lock"
PHP_SEL_CONF = "/etc/hestia_php_selector/php_sel_path.conf"
PHP_SEL_CONF = "/etc/hestia_php_selector/php_sel_path_%s.conf"
PHP_TEMPLATE_REMI = "/usr/bin/php%s"
PHP_TEMPLATE_BREPO = "/opt/brepo/php%s/bin/php"
HESTIA_CONF = "/usr/local/hestia/conf/hestia.conf"
@@ -89,7 +89,9 @@ func isExecOther(mode os.FileMode) bool {
}
func getPathtpPHP(phpVer string) string {
cont, err := os.ReadFile(PHP_SEL_CONF)
php_tp := get_php_type()
options := fmt.Sprintf(PHP_SEL_CONF, php_tp)
cont, err := os.ReadFile(options)
if err == nil {
result := strings.Split(strings.TrimSpace(string(cont)), "\n")
if len(result) > 0 {
@@ -99,7 +101,7 @@ func getPathtpPHP(phpVer string) string {
}
}
}
if get_php_type() == "remi" {
if php_tp == "remi" {
return fmt.Sprintf(PHP_TEMPLATE_REMI, phpVer)
} else {
return fmt.Sprintf(PHP_TEMPLATE_BREPO, phpVer)