Skip to content

Commit

Permalink
Merge branch 'ztflow-dingguodong-main#dingguodong' of zentao/zentaopms (
Browse files Browse the repository at this point in the history
  • Loading branch information
liyangLyon authored and Gitfox committed Jun 12, 2024
2 parents bcf3466 + f78050b commit 010af01
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 2 additions & 0 deletions module/backup/control.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public function index(int $recTotal = 0, int $recPerPage = 20, int $pageID = 1)
function cmp($left, $right){return $left->create_time < $right->create_time ? 1 : -1;}
usort($backups, 'cmp');

if(empty($operating)) $this->system->unsetMaintenance();

$this->view->operating = $operating;
}

Expand Down
18 changes: 17 additions & 1 deletion module/system/model.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ public function backup(?object $instance, string $mode = ''): array
{
if(empty($instance)) $instance = $this->config->instance->zentaopaas;

$this->setMaintenance('backup');

$rawResult = $this->cne->backup($instance, $this->app->user->account, $mode);

if(!empty($rawResult->code) && $rawResult->code == 200)
Expand Down Expand Up @@ -252,11 +254,25 @@ public function setMaintenance(string $action): bool

$maintenance = new stdclass();
$maintenance->action = $action;
$maintenance->reason = $this->lang->system->maintenance[$action];
$maintenance->reason = zget($this->lang->system->maintenance->reason, $action, $this->lang->unknown);

return $this->loadModel('setting')->setItem('system.system.maintenance', json_encode($maintenance));
}

/**
* 复原系统维护信息。
* Unset Maintenance message.
*
* @return void
*/
public function unsetMaintenance(): void
{
$maintenance = $this->loadModel('setting')->getItem('owner=system&module=system&key=maintenance');
if(empty($maintenance)) return;

$this->setting->deleteItems('owner=system&module=system&key=maintenance');
}

/**
* 从云API服务器获取最新的发布版本。
* Get the latest release from cloud API server.
Expand Down

0 comments on commit 010af01

Please sign in to comment.