From f5f379465f315fb862aa7784a56501cb689eb62f Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Fri, 23 Aug 2024 17:37:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=88=9B=E5=BB=BA=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E7=BD=91=E7=AB=99=EF=BC=8C=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=20PHP=20=E9=95=9C=E5=83=8F=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=20(#6220)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/website.go | 9 +++++++++ backend/i18n/lang/en.yaml | 1 + backend/i18n/lang/zh-Hant.yaml | 1 + backend/i18n/lang/zh.yaml | 1 + 4 files changed, 12 insertions(+) diff --git a/backend/app/service/website.go b/backend/app/service/website.go index e1460dca1..260cc1661 100644 --- a/backend/app/service/website.go +++ b/backend/app/service/website.go @@ -9,6 +9,7 @@ import ( "encoding/pem" "errors" "fmt" + "github.com/1Panel-dev/1Panel/backend/utils/docker" "os" "path" "reflect" @@ -312,6 +313,14 @@ func (w WebsiteService) CreateWebsite(create request.WebsiteCreate) (err error) switch runtime.Type { case constant.RuntimePHP: if runtime.Resource == constant.ResourceAppstore { + client, err := docker.NewDockerClient() + if err != nil { + return err + } + defer client.Close() + if !checkImageExist(client, runtime.Image) { + return buserr.WithName("ErrImageNotExist", runtime.Name) + } var ( req request.AppInstallCreate install *model.AppInstall diff --git a/backend/i18n/lang/en.yaml b/backend/i18n/lang/en.yaml index b0d436d41..ca2616db8 100644 --- a/backend/i18n/lang/en.yaml +++ b/backend/i18n/lang/en.yaml @@ -94,6 +94,7 @@ ErrPathPermission: 'A folder with non-1000:1000 permissions was detected in the ErrDomainIsUsed: "Domain is already used by website {{ .name }}" ErrDomainFormat: "{{ .name }} domain format error" ErrDefaultAlias: "default is a reserved code name, please use another code name" +ErrImageNotExist: "Running environment {{.name}} image does not exist, please re-edit the running environment" #ssl ErrSSLCannotDelete: "The certificate {{ .name }} is being used by the website and cannot be removed" diff --git a/backend/i18n/lang/zh-Hant.yaml b/backend/i18n/lang/zh-Hant.yaml index dbbdd5694..42e36424c 100644 --- a/backend/i18n/lang/zh-Hant.yaml +++ b/backend/i18n/lang/zh-Hant.yaml @@ -94,6 +94,7 @@ ErrPathPermission: 'index 目錄下偵測到非 1000:1000 權限資料夾,可 ErrDomainIsUsed: "域名已被網站【{{ .name }}】使用" ErrDomainFormat: "{{ .name }} 域名格式不正確" ErrDefaultAlias: "default 為保留代號,請使用其他代號" +ErrImageNotExist: "執行環境 {{.name}} 鏡像不存在,請重新編輯執行環境" #ssl ErrSSLCannotDelete: "{{ .name }} 證書正在被網站使用,無法刪除" diff --git a/backend/i18n/lang/zh.yaml b/backend/i18n/lang/zh.yaml index dbeca4ee4..2aee237d8 100644 --- a/backend/i18n/lang/zh.yaml +++ b/backend/i18n/lang/zh.yaml @@ -94,6 +94,7 @@ ErrPathPermission: 'index 目录下检测到非 1000:1000 权限文件夹,可 ErrDomainIsUsed: "域名已被网站【{{ .name }}】使用" ErrDomainFormat: "{{ .name }} 域名格式不正确" ErrDefaultAlias: "default 为保留代号,请使用其他代号" +ErrImageNotExist: "运行环境 {{.name}} 镜像不存在,请重新编辑运行环境" #ssl ErrSSLCannotDelete: "{{ .name }} 证书正在被网站使用,无法删除"