From ffb8077e2c0591ee26225d93dfbb3953d43a4219 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Mon, 8 Aug 2022 08:51:34 +0800 Subject: [PATCH] * Modify restore repo tips. --- module/action/lang/de.php | 1 + module/action/lang/en.php | 1 + module/action/lang/fr.php | 1 + module/action/lang/vi.php | 17 ++++++++++------- module/action/lang/zh-cn.php | 1 + module/action/model.php | 10 ++++++++++ module/gitlab/control.php | 4 ++-- 7 files changed, 26 insertions(+), 9 deletions(-) diff --git a/module/action/lang/de.php b/module/action/lang/de.php index 0862355a3d..3303ad2c04 100644 --- a/module/action/lang/de.php +++ b/module/action/lang/de.php @@ -57,6 +57,7 @@ $lang->action->historyEdit = 'Der Verlauf darf nicht leer sein.'; $lang->action->noDynamic = 'Kein Verlauf. '; $lang->action->undeletedTips = 'This data did not participate in the merging process during the version upgrade process, so restore is not supported.'; $lang->action->executionNoProject = 'The execution does not belong to a project,please restore the project first'; +$lang->action->repoNoServer = 'The repo does not belong to a server,please restore the server first'; $lang->action->repeatChange = '%s with the same name and code already exists in the system, After recovery, the name are \"%s\",the code are \"%s\".'; $lang->action->nameRepeatChange = '%s with the same name already exists in the system, After recovery, the name are \"%s\".'; diff --git a/module/action/lang/en.php b/module/action/lang/en.php index ea98cc89f2..76b858b6c9 100755 --- a/module/action/lang/en.php +++ b/module/action/lang/en.php @@ -57,6 +57,7 @@ $lang->action->historyEdit = 'The history EditBy cannot be empty.'; $lang->action->noDynamic = 'No dynamics. '; $lang->action->undeletedTips = 'This data did not participate in the merging process during the version upgrade process, so restore is not supported.'; $lang->action->executionNoProject = 'The execution does not belong to a project,please restore the project first'; +$lang->action->repoNoServer = 'The repo does not belong to a server,please restore the server first'; $lang->action->repeatChange = '%s with the same name and code already exists in the system, After recovery, the name are \"%s\",the code are \"%s\".'; $lang->action->nameRepeatChange = '%s with the same name already exists in the system, After recovery, the name are \"%s\".'; diff --git a/module/action/lang/fr.php b/module/action/lang/fr.php index 79658c8d38..73e0a3f534 100644 --- a/module/action/lang/fr.php +++ b/module/action/lang/fr.php @@ -57,6 +57,7 @@ $lang->action->historyEdit = "l'historique Edité Par ne peut pas être v $lang->action->noDynamic = "Pas d'historique."; $lang->action->undeletedTips = 'This data did not participate in the merging process during the version upgrade process, so restore is not supported.'; $lang->action->executionNoProject = 'The execution does not belong to a project,please restore the project first'; +$lang->action->repoNoServer = 'The repo does not belong to a server,please restore the server first'; $lang->action->repeatChange = '%s with the same name and code already exists in the system, After recovery, the name are \"%s\",the code are \"%s\".'; $lang->action->nameRepeatChange = '%s with the same name already exists in the system, After recovery, the name are \"%s\".'; diff --git a/module/action/lang/vi.php b/module/action/lang/vi.php index 2380f3d519..fdaccee1bb 100644 --- a/module/action/lang/vi.php +++ b/module/action/lang/vi.php @@ -30,13 +30,16 @@ $lang->action->editComment = 'Sửa nhận xét'; $lang->action->create = 'Thêm nhận xét'; $lang->action->comment = 'Nhận xét'; -$lang->action->trashTips = 'Ghi chú: Xóa trong ZenTao là hợp lệ.'; -$lang->action->textDiff = 'Định dạng văn bản'; -$lang->action->original = 'Định dạng gốc'; -$lang->action->confirmHideAll = 'Bạn có muốn ẩn tất cả ghi nhận này?'; -$lang->action->needEdit = '%s mà bạn muốn khôi phục. Vui lòng edit it.'; -$lang->action->historyEdit = 'Lịch sử người cập nhật không thể trống.'; -$lang->action->noDynamic = 'Không có lịch sử. '; +$lang->action->trashTips = 'Ghi chú: Xóa trong ZenTao là hợp lệ.'; +$lang->action->textDiff = 'Định dạng văn bản'; +$lang->action->original = 'Định dạng gốc'; +$lang->action->confirmHideAll = 'Bạn có muốn ẩn tất cả ghi nhận này?'; +$lang->action->needEdit = '%s mà bạn muốn khôi phục. Vui lòng edit it.'; +$lang->action->historyEdit = 'Lịch sử người cập nhật không thể trống.'; +$lang->action->noDynamic = 'Không có lịch sử. '; +$lang->action->undeletedTips = 'This data did not participate in the merging process during the version upgrade process, so restore is not supported.'; +$lang->action->executionNoProject = 'The execution does not belong to a project,please restore the project first'; +$lang->action->repoNoServer = 'The repo does not belong to a server,please restore the server first'; $lang->action->history = new stdclass(); $lang->action->history->action = 'Liên kết'; diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index 3311fc6a07..07ea3ecea1 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -57,6 +57,7 @@ $lang->action->historyEdit = '历史记录编辑不能为空。'; $lang->action->noDynamic = '暂时没有动态。'; $lang->action->undeletedTips = '该数据在版本升级过程中未参与数据归并流程,不支持还原。'; $lang->action->executionNoProject = '该执行没有所属的项目,请先还原项目再还原执行'; +$lang->action->repoNoServer = '该代码库没有所属的服务器,请先还原服务器再还原代码库'; $lang->action->repeatChange = '系统内已有同名、同代号的%s,恢复后名称为\"%s\"、代号为\"%s\"。'; $lang->action->nameRepeatChange = '系统内已有同名的%s,恢复后名称为\"%s\"。'; diff --git a/module/action/model.php b/module/action/model.php index 7ae41b46a1..3b84d1e2c2 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -1727,6 +1727,16 @@ class actionModel extends model if((int)$projectCount == 0) return print(js::error($this->lang->action->executionNoProject)); } + if($action->objectType == 'repo') + { + $repo = $this->dao->select('*')->from(TABLE_REPO)->where('id')->eq($action->objectID)->fetch(); + if($repo and in_array($repo->SCM, array('Gitlab', 'Gitea', 'Gogs'))) + { + $server = $this->dao->select('*')->from(TABLE_PIPELINE)->where('id')->eq($repo->serviceHost)->andWhere('deleted')->eq('0')->fetch(); + if(empty($server)) return print(js::error($this->lang->action->repoNoServer)); + } + } + if($action->objectType == 'product') { $product = $this->dao->select('id,name,code,acl')->from(TABLE_PRODUCT)->where('id')->eq($action->objectID)->fetch(); diff --git a/module/gitlab/control.php b/module/gitlab/control.php index 622ee928bd..4994faa544 100644 --- a/module/gitlab/control.php +++ b/module/gitlab/control.php @@ -228,8 +228,8 @@ class gitlab extends control { if($confirm != 'yes') return print(js::confirm($this->lang->gitlab->confirmDelete, inlink('delete', "id=$id&confirm=yes"))); - $oldGitea = $this->loadModel('pipeline')->getByID($id); - $actionID = $this->pipeline->delete($id, 'gitlab'); + $oldGitlab = $this->loadModel('pipeline')->getByID($id); + $actionID = $this->pipeline->delete($id, 'gitlab'); if(!$actionID) return print(js::error($this->lang->pipeline->delError)); $gitLab = $this->gitlab->getByID($id);