2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 17:17:13 +08:00

refactor: packages to pkg

This commit is contained in:
耗子
2023-07-20 01:06:49 +08:00
parent ec7138ae2a
commit 5ce65653ad
33 changed files with 260 additions and 260 deletions

View File

@@ -14,7 +14,7 @@ import (
"panel/app/http/controllers/plugins"
"panel/app/models"
"panel/app/services"
"panel/packages/helper"
"panel/pkg/tools"
)
type Php74Controller struct {
@@ -36,7 +36,7 @@ func (c *Php74Controller) Status(ctx http.Context) {
return
}
out := helper.ExecShell("systemctl status php-fpm-" + c.version + " | grep Active | grep -v grep | awk '{print $2}'")
out := tools.ExecShell("systemctl status php-fpm-" + c.version + " | grep Active | grep -v grep | awk '{print $2}'")
status := strings.TrimSpace(out)
if len(status) == 0 {
controllers.Error(ctx, http.StatusInternalServerError, "获取PHP-"+c.version+"运行状态失败")
@@ -55,8 +55,8 @@ func (c *Php74Controller) Reload(ctx http.Context) {
return
}
helper.ExecShell("systemctl reload php-fpm-" + c.version)
out := helper.ExecShell("systemctl status php-fpm-" + c.version + " | grep Active | grep -v grep | awk '{print $2}'")
tools.ExecShell("systemctl reload php-fpm-" + c.version)
out := tools.ExecShell("systemctl status php-fpm-" + c.version + " | grep Active | grep -v grep | awk '{print $2}'")
status := strings.TrimSpace(out)
if len(status) == 0 {
controllers.Error(ctx, http.StatusInternalServerError, "获取PHP-"+c.version+"运行状态失败")
@@ -75,8 +75,8 @@ func (c *Php74Controller) Start(ctx http.Context) {
return
}
helper.ExecShell("systemctl start php-fpm-" + c.version)
out := helper.ExecShell("systemctl status php-fpm-" + c.version + " | grep Active | grep -v grep | awk '{print $2}'")
tools.ExecShell("systemctl start php-fpm-" + c.version)
out := tools.ExecShell("systemctl status php-fpm-" + c.version + " | grep Active | grep -v grep | awk '{print $2}'")
status := strings.TrimSpace(out)
if len(status) == 0 {
controllers.Error(ctx, http.StatusInternalServerError, "获取PHP-"+c.version+"运行状态失败")
@@ -95,8 +95,8 @@ func (c *Php74Controller) Stop(ctx http.Context) {
return
}
helper.ExecShell("systemctl stop php-fpm-" + c.version)
out := helper.ExecShell("systemctl status php-fpm-" + c.version + " | grep Active | grep -v grep | awk '{print $2}'")
tools.ExecShell("systemctl stop php-fpm-" + c.version)
out := tools.ExecShell("systemctl status php-fpm-" + c.version + " | grep Active | grep -v grep | awk '{print $2}'")
status := strings.TrimSpace(out)
if len(status) == 0 {
controllers.Error(ctx, http.StatusInternalServerError, "获取PHP-"+c.version+"运行状态失败")
@@ -115,8 +115,8 @@ func (c *Php74Controller) Restart(ctx http.Context) {
return
}
helper.ExecShell("systemctl restart php-fpm-" + c.version)
out := helper.ExecShell("systemctl status php-fpm-" + c.version + " | grep Active | grep -v grep | awk '{print $2}'")
tools.ExecShell("systemctl restart php-fpm-" + c.version)
out := tools.ExecShell("systemctl status php-fpm-" + c.version + " | grep Active | grep -v grep | awk '{print $2}'")
status := strings.TrimSpace(out)
if len(status) == 0 {
controllers.Error(ctx, http.StatusInternalServerError, "获取PHP-"+c.version+"运行状态失败")
@@ -135,7 +135,7 @@ func (c *Php74Controller) GetConfig(ctx http.Context) {
return
}
config := helper.ReadFile("/www/server/php/" + c.version + "/etc/php.ini")
config := tools.ReadFile("/www/server/php/" + c.version + "/etc/php.ini")
controllers.Success(ctx, config)
}
@@ -145,7 +145,7 @@ func (c *Php74Controller) SaveConfig(ctx http.Context) {
}
config := ctx.Request().Input("config")
helper.WriteFile("/www/server/php/"+c.version+"/etc/php.ini", config, 0644)
tools.WriteFile("/www/server/php/"+c.version+"/etc/php.ini", config, 0644)
c.Reload(ctx)
}
@@ -190,7 +190,7 @@ func (c *Php74Controller) ErrorLog(ctx http.Context) {
return
}
log := helper.ExecShell("tail -n 100 /www/server/php/" + c.version + "/var/log/php-fpm.log")
log := tools.ExecShell("tail -n 100 /www/server/php/" + c.version + "/var/log/php-fpm.log")
controllers.Success(ctx, log)
}
@@ -199,7 +199,7 @@ func (c *Php74Controller) SlowLog(ctx http.Context) {
return
}
log := helper.ExecShell("tail -n 100 /www/server/php/" + c.version + "/var/log/slow.log")
log := tools.ExecShell("tail -n 100 /www/server/php/" + c.version + "/var/log/slow.log")
controllers.Success(ctx, log)
}
@@ -208,7 +208,7 @@ func (c *Php74Controller) ClearErrorLog(ctx http.Context) {
return
}
helper.ExecShell("echo '' > /www/server/php/" + c.version + "/var/log/php-fpm.log")
tools.ExecShell("echo '' > /www/server/php/" + c.version + "/var/log/php-fpm.log")
controllers.Success(ctx, true)
}
@@ -217,7 +217,7 @@ func (c *Php74Controller) ClearSlowLog(ctx http.Context) {
return
}
helper.ExecShell("echo '' > /www/server/php/" + c.version + "/var/log/slow.log")
tools.ExecShell("echo '' > /www/server/php/" + c.version + "/var/log/slow.log")
controllers.Success(ctx, true)
}
@@ -356,7 +356,7 @@ func (c *Php74Controller) GetExtensions() []Extension {
Installed: false,
})
raw := helper.ExecShell("/www/server/php/" + c.version + "/bin/php -m")
raw := tools.ExecShell("/www/server/php/" + c.version + "/bin/php -m")
rawExtensionList := strings.Split(raw, "\n")
for _, item := range rawExtensionList {