* [story#67779,done,2h,0h] * [story#67779,done,1h,0h] Add application backup list.
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
global $lang, $config;
|
||||
|
||||
$config->backup = new stdClass();
|
||||
$config->backup->dtable = new stdclass();
|
||||
$config->backup->dtable->fieldList['create_time']['name'] = 'create_time';
|
||||
$config->backup->dtable->fieldList['create_time']['title'] = $lang->instance->backup->date;
|
||||
$config->backup->dtable->fieldList['create_time']['type'] = 'desc';
|
||||
$config->backup->dtable->fieldList['create_time']['sortType'] = false;
|
||||
$config->backup->dtable->fieldList['create_time']['hint'] = true;
|
||||
$config->backup->dtable->fieldList['create_time']['formatDate'] = 'YYYY-MM-dd hh:mm:ss';
|
||||
$config->backup->dtable->fieldList['create_time']['width'] = '120';
|
||||
|
||||
$config->backup->dtable->fieldList['operator']['name'] = 'operator';
|
||||
$config->backup->dtable->fieldList['operator']['title'] = $lang->instance->backup->operator;
|
||||
$config->backup->dtable->fieldList['operator']['type'] = 'desc';
|
||||
$config->backup->dtable->fieldList['operator']['sortType'] = false;
|
||||
$config->backup->dtable->fieldList['operator']['hint'] = true;
|
||||
$config->backup->dtable->fieldList['operator']['width'] = '100';
|
||||
|
||||
$config->backup->dtable->fieldList['dbStatus']['name'] = 'status';
|
||||
$config->backup->dtable->fieldList['dbStatus']['title'] = $lang->instance->backup->dbStatus;
|
||||
$config->backup->dtable->fieldList['dbStatus']['type'] = 'desc';
|
||||
$config->backup->dtable->fieldList['dbStatus']['sortType'] = false;
|
||||
$config->backup->dtable->fieldList['dbStatus']['hint'] = true;
|
||||
$config->backup->dtable->fieldList['dbStatus']['width'] = '80';
|
||||
|
||||
$config->backup->dtable->fieldList['backupSize']['name'] = 'backupSize';
|
||||
$config->backup->dtable->fieldList['backupSize']['title'] = $lang->instance->backup->backupSize;
|
||||
$config->backup->dtable->fieldList['backupSize']['type'] = 'desc';
|
||||
$config->backup->dtable->fieldList['backupSize']['sortType'] = false;
|
||||
$config->backup->dtable->fieldList['backupSize']['hint'] = true;
|
||||
$config->backup->dtable->fieldList['backupSize']['width'] = '100';
|
||||
|
||||
$config->backup->dtable->fieldList['restoreDate']['name'] = 'latestRestoreTime';
|
||||
$config->backup->dtable->fieldList['restoreDate']['title'] = $lang->instance->backup->restoreDate;
|
||||
$config->backup->dtable->fieldList['restoreDate']['type'] = 'desc';
|
||||
$config->backup->dtable->fieldList['restoreDate']['sortType'] = false;
|
||||
$config->backup->dtable->fieldList['restoreDate']['hint'] = true;
|
||||
$config->backup->dtable->fieldList['restoreDate']['width'] = '120';
|
||||
|
||||
$config->backup->dtable->fieldList['restoreStatus']['name'] = 'latestRestoreStatus';
|
||||
$config->backup->dtable->fieldList['restoreStatus']['title'] = $lang->instance->backup->restoreStatus;
|
||||
$config->backup->dtable->fieldList['restoreStatus']['type'] = 'desc';
|
||||
$config->backup->dtable->fieldList['restoreStatus']['sortType'] = false;
|
||||
$config->backup->dtable->fieldList['restoreStatus']['hint'] = true;
|
||||
$config->backup->dtable->fieldList['restoreStatus']['width'] = '80';
|
||||
|
||||
$config->backup->dtable->fieldList['actions']['name'] = 'actions';
|
||||
$config->backup->dtable->fieldList['actions']['title'] = $lang->instance->backup->action;
|
||||
$config->backup->dtable->fieldList['actions']['type'] = 'actions';
|
||||
$config->backup->dtable->fieldList['actions']['hint'] = true;
|
||||
$config->backup->dtable->fieldList['actions']['menu'] = array('restore');
|
||||
|
||||
$config->backup->dtable->fieldList['actions']['list']['restore']['icon'] = 'icon-restart';
|
||||
$config->backup->dtable->fieldList['actions']['list']['restore']['hint'] = $lang->instance->restore->common;
|
||||
$config->backup->dtable->fieldList['actions']['list']['restore']['url'] = helper::createLink('instance', 'ajaxRestore', 'instanceID={instanceId}&backupName={name}');
|
||||
$config->backup->dtable->fieldList['actions']['list']['restore']['className'] = 'ajax-submit';
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* The maintain view file of repo module of ZenTaoPMS.
|
||||
* @copyright Copyright 2009-2024 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
|
||||
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
|
||||
* @author Zhai Xiaojian<zhaixiaojian@easycorp.ltd>
|
||||
* @package repo
|
||||
* @link https://www.zentao.net
|
||||
*/
|
||||
namespace zin;
|
||||
|
||||
$backups = initTableData($backupList, $config->backup->dtable->fieldList, $this->instance);
|
||||
$hasRestoreLog = false;
|
||||
foreach($backupList as &$backup)
|
||||
{
|
||||
/* Initialization calculation and assignment. */
|
||||
$status = $backup->status;
|
||||
$restoreStatus = '';
|
||||
$backupSize = isset($backup->backup_details->db[0]) ? intval(zget($backup->backup_details->db[0], 'size', 0)) : 0;
|
||||
$backupSize += isset($backup->backup_details->volume[0]) ? intval(zget($backup->backup_details->volume[0], 'doneBytes', 0)) : 0;
|
||||
|
||||
$backup->instanceId = $instance->id;
|
||||
$backup->operator = zget($lang->instance->backup->operators, $backup->username, $backup->username);
|
||||
$backup->status = zget($lang->instance->backup->statusList, strtolower($backup->status));
|
||||
$backup->backupSize = helper::formatKB($backupSize);
|
||||
|
||||
/* Mark recently restored information. */
|
||||
$backup->latestRestoreTime = 0;
|
||||
$backup->latestRestoreStatus = '';
|
||||
foreach($backup->restores as $restore)
|
||||
{
|
||||
$hasRestoreLog = true;
|
||||
if($restore->create_time > $backup->latestRestoreTime)
|
||||
{
|
||||
$backup->latestRestoreTime = $restore->create_time;
|
||||
$restoreStatus = $restore->status;
|
||||
$backup->latestRestoreStatus = zget($lang->instance->restore->statusList, $restore->status, $restore->status);
|
||||
}
|
||||
}
|
||||
$backup->latestRestoreTime = $backup->latestRestoreTime == 0 ? '' : date('Y-m-d H:i:s', $backup->latestRestoreTime);
|
||||
$backup->restoreTime = zget($lang->instance->backup->operators, $backup->username, $backup->username);
|
||||
|
||||
if(in_array($status, array('processing', 'inprogress')) || in_array($restoreStatus, array('pending', 'inprogress'))) $backup->actions[0]['disabled'] = true;
|
||||
}
|
||||
dtable
|
||||
(
|
||||
set::cols($config->backup->dtable->fieldList),
|
||||
set::data($backups),
|
||||
set::sortLink(createLink('instance', 'backuplist', "id={$instance->id}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&pageID={$pager->pageID}")),
|
||||
set::footPager(usePager())
|
||||
);
|
||||
Reference in New Issue
Block a user