Merge branch 'sprint/scx_zaction' into 'master'

Sprint/scx zaction

See merge request easycorp/zentaopms!3734
This commit is contained in:
李玉春
2022-06-06 02:14:14 +00:00
7 changed files with 66 additions and 1 deletions
+8 -1
View File
@@ -15,7 +15,7 @@ error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT);
define('IN_SHELL', true);
/* Judge the args. */
if($argc != 2) die('Usage: ' . basename(__FILE__) . " <request>\n");
if($argc < 2 or $argc > 3) die('Usage: ' . basename(__FILE__) . " <request>\n");
/* Parse the request into params. */
$request = parse_url(trim($argv[1]));
@@ -33,6 +33,13 @@ include './framework/helper.class.php';
$app = router::createApp('pms', dirname(dirname(__FILE__)), 'router');
$common = $app->loadCommon();
/* Set the PATH_INFO request. */
if(!empty($argv[2]) && $argv[2] == 'pathinfo')
{
$config->requestType = 'PATH_INFO';
$config->requestFix = '-';
}
/* Set the PATH_INFO variable. */
if($config->requestType == 'PATH_INFO')
{
+24
View File
@@ -11,6 +11,30 @@
*/
class action extends control
{
/**
* Create a action or delete all patch actions, this method is used by the Ztools.
*
* @param string $objectType
* @param string $actionType
* @param string $objectName
* @access public
* @return void
*/
public function create($objectType, $actionType, $objectName)
{
$actionID = $this->action->create($objectType, 0, $actionType, '', $objectName);
if($actionID)
{
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess));
}
else
{
$this->send(array('result' => 'fail', 'message' => 'error'));
}
}
/**
* Trash.
*
+3
View File
@@ -139,6 +139,7 @@ $lang->action->objectTypes['kanbancard'] = 'Kanban Card';
$lang->action->objectTypes['sonarqube'] = 'SonarQube Server';
$lang->action->objectTypes['sonarqubeproject'] = 'SonarQube Project';
$lang->action->objectTypes['stage'] = 'Stage';
$lang->action->objectTypes['patch'] = 'Patch';
/* Used to describe operation history. */
$lang->action->desc = new stdclass();
@@ -232,6 +233,8 @@ $lang->action->desc->unlinkbug = '$date, 由 <strong>$actor</strong> 从计划
/* Used to display dynamic information. */
$lang->action->label = new stdclass();
$lang->action->label->install = 'install ';
$lang->action->label->revert = 'revert ';
$lang->action->label->created = 'created ';
$lang->action->label->opened = 'opened ';
$lang->action->label->openedbysystem = 'Opened by system ';
+3
View File
@@ -139,6 +139,7 @@ $lang->action->objectTypes['kanbancard'] = '看板卡片';
$lang->action->objectTypes['sonarqube'] = 'SonarQube服务器';
$lang->action->objectTypes['sonarqubeproject'] = 'SonarQube项目';
$lang->action->objectTypes['stage'] = '阶段';
$lang->action->objectTypes['patch'] = '补丁';
/* 用来描述操作历史记录。*/
$lang->action->desc = new stdclass();
@@ -232,6 +233,8 @@ $lang->action->desc->unlinkbug = '$date, 由 <strong>$actor</strong> 从计划
/* 用来显示动态信息。*/
$lang->action->label = new stdclass();
$lang->action->label->install = '安装';
$lang->action->label->revert = '还原';
$lang->action->label->created = '创建';
$lang->action->label->opened = '创建';
$lang->action->label->openedbysystem = '系统创建';
+12
View File
@@ -1555,6 +1555,18 @@ class actionModel extends model
}
}
/**
* Delete action by objectType.
*
* @param string $objectType
* @access public
* @return void
*/
public function deleteByType($objectType)
{
$this->dao->delete()->from(TABLE_ACTION)->where('objectType')->eq($objectType)->exec();
}
/**
* Undelete a record.
*
+4
View File
@@ -153,6 +153,10 @@ class upgrade extends control
if(!$this->upgrade->isError())
{
$systemMode = $this->loadModel('setting')->getItem('owner=system&module=common&section=global&key=mode');
/* Delete all patch actions if upgrade success. */
$this->loadModel('action')->deleteByType('patch');
if((empty($systemMode) && !isset($this->config->qcVersion) && strpos($fromVersion, 'max') === false) or
($systemMode != 'new' && strpos($fromVersion, 'max') === false && strpos($this->config->version, 'max') !== false))
{
+12
View File
@@ -1320,6 +1320,18 @@ class upgradeModel extends model
}
}
/* Delete all patch files when upgrade zentao. */
$patchPath = $this->app->getTmpRoot() . 'patch';
$isDir = is_dir($patchPath);
if(file_exists($patchPath))
{
if(!is_writable($patchPath) or ($isDir and !$zfile->removeDir($patchPath)) or
(!$isDir and !$zfile->removeDir($patchPath)))
{
$result[] = 'rm -f ' . ($isDir ? '-r ' : '') . $patchPath;
}
}
return $result;
}