fix issues report when code review

This commit is contained in:
aaronchen2k
2020-02-11 08:46:17 +08:00
parent 95b46e92fd
commit ac4248fbe8
26 changed files with 222 additions and 231 deletions
+1 -1
View File
@@ -58,7 +58,7 @@ CREATE TABLE IF NOT EXISTS `zt_repofiles` (
KEY `revision` (`revision`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ALTER TABLE `zt_bug` CHANGE `caseVersion` `caseVersion` smallint(6) NOT NULL AFTER `case`;
ALTER TABLE `zt_bug` CHANGE `caseVersion` `caseVersion` smallint(6) NOT NULL DEFAULT 1 AFTER `case`;
ALTER TABLE `zt_bug` ADD `repo` mediumint(8) unsigned NOT NULL AFTER `result`;
ALTER TABLE `zt_bug` ADD `lines` varchar(10) COLLATE 'utf8_general_ci' NOT NULL AFTER `repo`;
ALTER TABLE `zt_bug` ADD `v1` varchar(40) COLLATE 'utf8_general_ci' NOT NULL AFTER `lines`;
+9 -10
View File
@@ -7,24 +7,23 @@ CREATE TABLE `zt_tag` (
`repo` mediumint(9) NOT NULL,
`name` varchar(40) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `zt_jenkins` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`id` smallint(8) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`account` varchar(255) DEFAULT NULL,
`serviceUrl` varchar(255) DEFAULT NULL,
`url` varchar(255) DEFAULT NULL,
`account` varchar(30) DEFAULT NULL,
`password` varchar(30) NOT NULL,
`encrypt` varchar(30) NOT NULL DEFAULT 'plain',
`token` varchar(255) DEFAULT NULL,
`desc` text NOT NULL,
`createdBy` varchar(30) NOT NULL,
`createdDate` datetime NOT NULL,
`editedBy` varchar(30) NOT NULL,
`editedDate` datetime NOT NULL,
`deleted` enum('0','1') NOT NULL DEFAULT '0',
`password` varchar(30) NOT NULL,
`encrypt` varchar(30) NOT NULL DEFAULT 'plain',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `zt_cijob` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
@@ -49,7 +48,7 @@ CREATE TABLE `zt_cijob` (
`lastExec` datetime DEFAULT NULL,
`lastStatus` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=35 DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `zt_cibuild` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
@@ -63,7 +62,7 @@ CREATE TABLE `zt_cibuild` (
`updateDate` datetime NOT NULL,
`deleted` enum('0','1') NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=75 DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `zt_cron` (`m`, `h`, `dom`, `mon`, `dow`, `command`, `remark`, `type`, `buildin`, `status`, `lastTime`) VALUES
('*/5', '*', '*', '*', '*', 'moduleName=ci&methodName=checkBuildStatus', '同步Jenkins任务状态', 'zentao', -1, 'normal', '0000-00-00 00:00:00');
+10 -15
View File
@@ -1,7 +1,3 @@
CREATE DATABASE `zentao_zhonghe_testing` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
use zentao_zhonghe_testing;
-- DROP TABLE IF EXISTS `zt_action`;
CREATE TABLE IF NOT EXISTS `zt_action` (
`id` mediumint(8) unsigned NOT NULL auto_increment,
@@ -93,7 +89,7 @@ CREATE TABLE IF NOT EXISTS `zt_bug` (
`duplicateBug` mediumint(8) unsigned NOT NULL,
`linkBug` varchar(255) NOT NULL,
`case` mediumint(8) unsigned NOT NULL,
`caseVersion` smallint(6) NOT NULL,
`caseVersion` smallint(6) NOT NULL DEFAULT 1,
`result` mediumint(8) unsigned NOT NULL,
`repo` mediumint(8) unsigned NOT NULL,
`entry` varchar(255) NOT NULL,
@@ -1111,24 +1107,23 @@ CREATE TABLE `zt_tag` (
`repo` mediumint(9) NOT NULL,
`name` varchar(40) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `zt_jenkins` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`id` smallint(8) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`account` varchar(255) DEFAULT NULL,
`serviceUrl` varchar(255) DEFAULT NULL,
`url` varchar(255) DEFAULT NULL,
`account` varchar(30) DEFAULT NULL,
`password` varchar(30) NOT NULL,
`encrypt` varchar(30) NOT NULL DEFAULT 'plain',
`token` varchar(255) DEFAULT NULL,
`desc` text NOT NULL,
`createdBy` varchar(30) NOT NULL,
`createdDate` datetime NOT NULL,
`editedBy` varchar(30) NOT NULL,
`editedDate` datetime NOT NULL,
`deleted` enum('0','1') NOT NULL DEFAULT '0',
`password` varchar(30) NOT NULL,
`encrypt` varchar(30) NOT NULL DEFAULT 'plain',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `zt_cijob` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
@@ -1153,7 +1148,7 @@ CREATE TABLE `zt_cijob` (
`lastExec` datetime DEFAULT NULL,
`lastStatus` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=35 DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
CREATE TABLE `zt_cibuild` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
@@ -1167,7 +1162,7 @@ CREATE TABLE `zt_cibuild` (
`updateDate` datetime NOT NULL,
`deleted` enum('0','1') NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=75 DEFAULT CHARSET=utf8;
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `zt_cron` (`m`, `h`, `dom`, `mon`, `dow`, `command`, `remark`, `type`, `buildin`, `status`, `lastTime`) VALUES
('*', '*', '*', '*', '*', '', '监控定时任务', 'zentao', 1, 'normal', '0000-00-00 00:00:00'),
@@ -89,18 +89,20 @@ class HTMLPurifier_AttrDef_CSS_BackgroundPosition extends HTMLPurifier_AttrDef
);
foreach ($bits as $bit) {
if ($bit === '') {
continue;
}
if ($bit === '') continue;
// test for keyword
$lbit = ctype_lower($bit) ? $bit : strtolower($bit);
if (isset($lookup[$lbit])) {
if (isset($lookup[$lbit]))
{
$status = $lookup[$lbit];
if ($status == 'c') {
if ($i == 0) {
if ($status == 'c')
{
if ($i == 0)
{
$status = 'ch';
} else {
} else
{
$status = 'cv';
}
}
@@ -110,46 +112,51 @@ class HTMLPurifier_AttrDef_CSS_BackgroundPosition extends HTMLPurifier_AttrDef
// test for length
$r = $this->length->validate($bit, $config, $context);
if ($r !== false) {
if ($r !== false)
{
$measures[] = $r;
$i++;
}
// test for percentage
$r = $this->percentage->validate($bit, $config, $context);
if ($r !== false) {
if ($r !== false)
{
$measures[] = $r;
$i++;
}
}
if (!$i) {
return false;
} // no valid values were caught
if (!$i) return false; // no valid values were caught
$ret = array();
// first keyword
if ($keywords['h']) {
if ($keywords['h'])
{
$ret[] = $keywords['h'];
} elseif ($keywords['ch']) {
} elseif ($keywords['ch'])
{
$ret[] = $keywords['ch'];
$keywords['cv'] = false; // prevent re-use: center = center center
} elseif (count($measures)) {
} elseif (count($measures))
{
$ret[] = array_shift($measures);
}
if ($keywords['v']) {
if ($keywords['v'])
{
$ret[] = $keywords['v'];
} elseif ($keywords['cv']) {
} elseif ($keywords['cv'])
{
$ret[] = $keywords['cv'];
} elseif (count($measures)) {
} elseif (count($measures))
{
$ret[] = array_shift($measures);
}
if (empty($ret)) {
return false;
}
if (empty($ret)) return false;
return implode(' ', $ret);
}
}
@@ -37,12 +37,15 @@ class HTMLPurifier_AttrDef_CSS_Border extends HTMLPurifier_AttrDef
$done = array(); // segments we've finished
$ret = ''; // return value
foreach ($bits as $bit) {
foreach ($this->info as $propname => $validator) {
if (isset($done[$propname])) {
foreach ($this->info as $propname => $validator)
{
if (isset($done[$propname]))
{
continue;
}
$r = $validator->validate($bit, $config, $context);
if ($r !== false) {
if ($r !== false)
{
$ret .= $r . ' ';
$done[$propname] = true;
break;
@@ -35,9 +35,7 @@ class HTMLPurifier_AttrDef_CSS_ListStyle extends HTMLPurifier_AttrDef
{
// regular pre-processing
$string = $this->parseCDATA($string);
if ($string === '') {
return false;
}
if ($string === '') return false;
// assumes URI doesn't have spaces in it
$bits = explode(' ', strtolower($string)); // bits to process
@@ -51,27 +49,28 @@ class HTMLPurifier_AttrDef_CSS_ListStyle extends HTMLPurifier_AttrDef
$none = false;
foreach ($bits as $bit) {
if ($i >= 3) {
return;
} // optimization bit
if ($bit === '') {
continue;
}
foreach ($caught as $key => $status) {
if ($status !== false) {
continue;
}
if ($i >= 3) return;
// optimization bit
if ($bit === '') continue;
foreach ($caught as $key => $status)
{
if ($status !== false) continue;
$r = $this->info['list-style-' . $key]->validate($bit, $config, $context);
if ($r === false) {
continue;
}
if ($r === 'none') {
if ($none) {
if ($r === false) continue;
if ($r === 'none')
{
if ($none)
{
continue;
} else {
} else
{
$none = true;
}
if ($key == 'image') {
if ($key == 'image')
{
continue;
}
}
@@ -81,30 +80,21 @@ class HTMLPurifier_AttrDef_CSS_ListStyle extends HTMLPurifier_AttrDef
}
}
if (!$i) {
return false;
}
if (!$i) return false;
$ret = array();
// construct type
if ($caught['type']) {
$ret[] = $caught['type'];
}
if ($caught['type']) $ret[] = $caught['type'];
// construct image
if ($caught['image']) {
$ret[] = $caught['image'];
}
if ($caught['image']) $ret[] = $caught['image'];
// construct position
if ($caught['position']) {
$ret[] = $caught['position'];
}
if ($caught['position']) $ret[] = $caught['position'];
if (empty($ret)) return false;
if (empty($ret)) {
return false;
}
return implode(' ', $ret);
}
}
@@ -32,49 +32,44 @@ class HTMLPurifier_AttrDef_CSS_Number extends HTMLPurifier_AttrDef
{
$number = $this->parseCDATA($number);
if ($number === '') {
return false;
}
if ($number === '0') {
return '0';
}
if ($number === '') return false;
if ($number === '0') return '0';
$sign = '';
switch ($number[0]) {
switch ($number[0])
{
case '-':
if ($this->non_negative) {
return false;
}
if ($this->non_negative) return false;
$sign = '-';
case '+':
$number = substr($number, 1);
}
if (ctype_digit($number)) {
if (ctype_digit($number))
{
$number = ltrim($number, '0');
return $number ? $sign . $number : '0';
}
// Period is the only non-numeric character allowed
if (strpos($number, '.') === false) {
return false;
}
if (strpos($number, '.') === false) return false;
list($left, $right) = explode('.', $number, 2);
if ($left === '' && $right === '') {
return false;
}
if ($left !== '' && !ctype_digit($left)) {
return false;
}
if ($left === '' && $right === '') return false;
if ($left !== '' && !ctype_digit($left)) return false;
$left = ltrim($left, '0');
$right = rtrim($right, '0');
if ($right === '') {
if ($right === '')
{
return $left ? $sign . $left : '0';
} elseif (!ctype_digit($right)) {
} elseif (!ctype_digit($right))
{
return false;
}
return $sign . $left . '.' . $right;
@@ -30,23 +30,18 @@ class HTMLPurifier_AttrDef_CSS_Percentage extends HTMLPurifier_AttrDef
{
$string = $this->parseCDATA($string);
if ($string === '') {
return false;
}
if ($string === '') return false;
$length = strlen($string);
if ($length === 1) {
return false;
}
if ($string[$length - 1] !== '%') {
return false;
}
if ($length === 1) return false;
if ($string[$length - 1] !== '%') return false;
$number = substr($string, 0, $length - 1);
$number = $this->number_def->validate($number, $config, $context);
if ($number === false) {
return false;
}
if ($number === false) return false;
return "$number%";
}
}
@@ -24,21 +24,17 @@ class HTMLPurifier_AttrDef_CSS_TextDecoration extends HTMLPurifier_AttrDef
$string = strtolower($this->parseCDATA($string));
if ($string === 'none') {
return $string;
}
if ($string === 'none') return $string;
$parts = explode(' ', $string);
$final = '';
foreach ($parts as $part) {
if (isset($allowed_values[$part])) {
$final .= $part . ' ';
}
foreach ($parts as $part)
{
if (isset($allowed_values[$part])) $final .= $part . ' ';
}
$final = rtrim($final);
if ($final === '') {
return false;
}
if ($final === '') return false;
return $final;
}
}
@@ -46,20 +46,15 @@ class HTMLPurifier_AttrTransform_EnumToCSS extends HTMLPurifier_AttrTransform
*/
public function transform($attr, $config, $context)
{
if (!isset($attr[$this->attr])) {
return $attr;
}
if (!isset($attr[$this->attr])) return $attr;
$value = trim($attr[$this->attr]);
unset($attr[$this->attr]);
if (!$this->caseSensitive) {
$value = strtolower($value);
}
if (!$this->caseSensitive) $value = strtolower($value);
if (!isset($this->enumToCSS[$value])) return $attr;
if (!isset($this->enumToCSS[$value])) {
return $attr;
}
$this->prependCSS($attr, $this->enumToCSS[$value]);
return $attr;
}
@@ -15,16 +15,13 @@ class HTMLPurifier_AttrTransform_Name extends HTMLPurifier_AttrTransform
public function transform($attr, $config, $context)
{
// Abort early if we're using relaxed definition of name
if ($config->get('HTML.Attr.Name.UseCDATA')) {
return $attr;
}
if (!isset($attr['name'])) {
return $attr;
}
if ($config->get('HTML.Attr.Name.UseCDATA')) return $attr;
if (!isset($attr['name'])) return $attr;
$id = $this->confiscateAttr($attr, 'name');
if (isset($attr['id'])) {
return $attr;
}
if (isset($attr['id'])) return $attr;
$attr['id'] = $id;
return $attr;
}
@@ -27,17 +27,14 @@ class HTMLPurifier_AttrTransform_TargetBlank extends HTMLPurifier_AttrTransform
*/
public function transform($attr, $config, $context)
{
if (!isset($attr['href'])) {
return $attr;
}
if (!isset($attr['href'])) return $attr;
// XXX Kind of inefficient
$url = $this->parser->parse($attr['href']);
$scheme = $url->getSchemeObj($config, $context);
if ($scheme->browsable && !$url->isBenign($config, $context)) {
$attr['target'] = '_blank';
}
if ($scheme->browsable && !$url->isBenign($config, $context)) $attr['target'] = '_blank';
return $attr;
}
}
@@ -14,12 +14,10 @@ class HTMLPurifier_AttrTransform_Textarea extends HTMLPurifier_AttrTransform
public function transform($attr, $config, $context)
{
// Calculated from Firefox
if (!isset($attr['cols'])) {
$attr['cols'] = '22';
}
if (!isset($attr['rows'])) {
$attr['rows'] = '3';
}
if (!isset($attr['cols'])) $attr['cols'] = '22';
if (!isset($attr['rows'])) $attr['rows'] = '3';
return $attr;
}
}
@@ -45,9 +45,8 @@ class HTMLPurifier_ChildDef_Custom extends HTMLPurifier_ChildDef
protected function _compileRegex()
{
$raw = str_replace(' ', '', $this->dtd_regex);
if ($raw{0} != '(') {
$raw = "($raw)";
}
if ($raw{0} != '(') $raw = "($raw)";
$el = '[#a-zA-Z0-9_.-]+';
$reg = $raw;
@@ -25,9 +25,8 @@ class HTMLPurifier_HTMLModule_Iframe extends HTMLPurifier_HTMLModule
*/
public function setup($config)
{
if ($config->get('HTML.SafeIframe')) {
$this->safe = true;
}
if ($config->get('HTML.SafeIframe')) $this->safe = true;
$this->addElement(
'iframe',
'Inline',
@@ -137,25 +137,29 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
$ret .= $this->element('th', 'Inline content');
$ret .= $this->element('td', $def->descendants_are_inline ? 'Yes' : 'No');
$ret .= $this->end('tr');
if (!empty($def->excludes)) {
if (!empty($def->excludes))
{
$ret .= $this->start('tr');
$ret .= $this->element('th', 'Excludes');
$ret .= $this->element('td', $this->listifyTagLookup($def->excludes));
$ret .= $this->end('tr');
}
if (!empty($def->attr_transform_pre)) {
if (!empty($def->attr_transform_pre))
{
$ret .= $this->start('tr');
$ret .= $this->element('th', 'Pre-AttrTransform');
$ret .= $this->element('td', $this->listifyObjectList($def->attr_transform_pre));
$ret .= $this->end('tr');
}
if (!empty($def->attr_transform_post)) {
if (!empty($def->attr_transform_post))
{
$ret .= $this->start('tr');
$ret .= $this->element('th', 'Post-AttrTransform');
$ret .= $this->element('td', $this->listifyObjectList($def->attr_transform_post));
$ret .= $this->end('tr');
}
if (!empty($def->auto_close)) {
if (!empty($def->auto_close))
{
$ret .= $this->start('tr');
$ret .= $this->element('th', 'Auto closed by');
$ret .= $this->element('td', $this->listifyTagLookup($def->auto_close));
@@ -166,9 +170,7 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
$ret .= $this->element('td', $this->listifyAttr($def->attr), array(), 0);
$ret .= $this->end('tr');
if (!empty($def->required_attr)) {
$ret .= $this->row('Required attributes', $this->listify($def->required_attr));
}
if (!empty($def->required_attr)) $ret .= $this->row('Required attributes', $this->listify($def->required_attr));
$ret .= $this->renderChildren($def->child);
}
@@ -188,17 +190,22 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
$ret .= $this->start('tr');
$elements = array();
$attr = array();
if (isset($def->elements)) {
if ($def->type == 'strictblockquote') {
if (isset($def->elements))
{
if ($def->type == 'strictblockquote')
{
$def->validateChildren(array(), $this->config, $context);
}
$elements = $def->elements;
}
if ($def->type == 'chameleon') {
if ($def->type == 'chameleon')
{
$attr['rowspan'] = 2;
} elseif ($def->type == 'empty') {
} elseif ($def->type == 'empty')
{
$elements = array();
} elseif ($def->type == 'table') {
} elseif ($def->type == 'table')
{
$elements = array_flip(
array(
'col',
@@ -213,7 +220,8 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
}
$ret .= $this->element('th', 'Allowed children', $attr);
if ($def->type == 'chameleon') {
if ($def->type == 'chameleon')
{
$ret .= $this->element(
'td',
@@ -232,7 +240,8 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
0
);
} elseif ($def->type == 'custom') {
} elseif ($def->type == 'custom')
{
$ret .= $this->element(
'td',
@@ -240,7 +249,8 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
$def->dtd_regex
);
} else {
} else
{
$ret .= $this->element(
'td',
'<em>' . ucfirst($def->type) . '</em>: ' .
@@ -262,10 +272,10 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
{
ksort($array);
$list = array();
foreach ($array as $name => $discard) {
if ($name !== '#PCDATA' && !isset($this->def->info[$name])) {
continue;
}
foreach ($array as $name => $discard)
{
if ($name !== '#PCDATA' && !isset($this->def->info[$name])) continue;
$list[] = $name;
}
return $this->listify($list);
@@ -296,10 +306,10 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
{
ksort($array);
$list = array();
foreach ($array as $name => $obj) {
if ($obj === false) {
continue;
}
foreach ($array as $name => $obj)
{
if ($obj === false) continue;
$list[] = "$name&nbsp;=&nbsp;<i>" . $this->getClass($obj, 'AttrDef_') . '</i>';
}
return $this->listify($list);
+10 -11
View File
@@ -104,19 +104,19 @@ class scm
$entityIds = $matches[3][$i];
$currArr = $allCommands[$entityType][$action];
if (empty($currArr)) {
$currArr = [];
}
if (empty($currArr)) $currArr = [];
$newArr = explode(",", $entityIds);
$allCommands[$entityType][$action] = array_keys(array_flip($currArr) + array_flip($newArr));
if ($entityType === 'story') {
if ($entityType === 'story')
{
$stories = array_merge($stories, $newArr);
}
if ($entityType === 'task') {
} else if ($entityType === 'task')
{
$tasks = array_merge($tasks, $newArr);
}
if ($entityType === 'bug') {
} else if ($entityType === 'bug')
{
$bugs = array_merge($bugs, $newArr);
}
@@ -144,9 +144,8 @@ class scm
{
$entityIds = $matches[1];
if (empty($taskToBuild)) {
$taskToBuild = [];
}
if (empty($taskToBuild)) $taskToBuild = [];
$newArr = explode(",", $entityIds);
$jobToBuild = array_keys(array_flip($taskToBuild) + array_flip($newArr));
}
+18 -12
View File
@@ -74,16 +74,19 @@ class ciModel extends model
->autoCheck()
->exec();
if ($job->triggerType === 'schedule') {
if ($job->triggerType === 'schedule')
{
$jobId = $this->dao->lastInsertID();
$arr = explode(":", $job->scheduleTime);
$hour = $arr[0];
$min = $arr[1];
if ($job->scheduleDay == 'everyDay') {
if ($job->scheduleDay == 'everyDay')
{
$days = '1-7';
} else if ($job->scheduleDay == 'workDay') {
} else if ($job->scheduleDay == 'workDay')
{
$days = '1-5';
}
@@ -125,7 +128,8 @@ class ciModel extends model
->where('id')->eq($id)
->exec();
if ($job->triggerType === 'schedule') {
if ($job->triggerType === 'schedule')
{
$command = 'moduleName=ci&methodName=exeJob&parm=' . $id;
$arr = explode(":", $job->scheduleTime);
@@ -133,9 +137,11 @@ class ciModel extends model
$min = $arr[1];
$jobId = $this->dao->lastInsertID();
if ($job->scheduleDay == 'everyDay') {
if ($job->scheduleDay == 'everyDay')
{
$days = '1-7';
} else if ($job->scheduleDay == 'workDay') {
} else if ($job->scheduleDay == 'workDay')
{
$days = '2-6';
}
@@ -161,15 +167,13 @@ class ciModel extends model
*/
public function exeJob($jobID)
{
$po = $this->dao->select('job.id jobId, job.name jobName, job.repo, job.jenkinsJob, jenkins.name jenkinsName,jenkins.serviceUrl,jenkins.account,jenkins.token,jenkins.password')
$job = $this->dao->select('job.id jobId, job.name jobName, job.repo, job.jenkinsJob, jenkins.name jenkinsName,jenkins.serviceUrl,jenkins.account,jenkins.token,jenkins.password')
->from(TABLE_CI_JOB)->alias('job')
->leftJoin(TABLE_JENKINS)->alias('jenkins')->on('job.jenkins=jenkins.id')
->where('job.id')->eq($jobID)
->fetch();
if (!$po) {
return false;
}
if (!$job) return false;
$jenkinsServer = $po->serviceUrl;
$jenkinsUser = $po->account;
@@ -274,7 +278,8 @@ class ciModel extends model
$queueUrl = sprintf('%s/queue/item/%s/api/json', $jenkinsServer, $po->queueItem);
$response = common::http($queueUrl);
if (strripos($response,"404") > -1) { // queue expired, use another api
if (strripos($response,"404") > -1)
{ // queue expired, use another api
$infoUrl = sprintf('%s/job/%s/%s/api/json', $jenkinsServer, $po->jenkinsJob, $po->queueItem);
$response = common::http($infoUrl);
$buildInfo = json_decode($response);
@@ -286,7 +291,8 @@ class ciModel extends model
$logs = json_decode($response);
$this->dao->update(TABLE_CI_BUILD)->set('logs')->eq($response)->where('id')->eq($po->id)->exec();
} else {
} else
{
$queueInfo = json_decode($response);
if (!empty($queueInfo->executable)) {
+2 -1
View File
@@ -54,7 +54,8 @@
common::printIcon('ci', 'browseBuild', "jobID=$id", '', 'list', 'file-text');
common::printIcon('ci', 'editJob', "jobID=$id", '', 'list', 'edit');
if (common::hasPriv('ci', 'deleteJob')) {
if (common::hasPriv('ci', 'deleteJob'))
{
$deleteURL = $this->createLink('ci', 'deleteJob', "jobID=$id&confirm=yes");
echo html::a("javascript:ajaxDelete(\"$deleteURL\", \"jobList\", confirmDelete)", '<i class="icon-trash"></i>', '', "title='{$lang->job->delete}' class='btn'");
}
+6 -3
View File
@@ -103,7 +103,8 @@ class gitModel extends model
$allCommands = [];
foreach ($logs as $log) {
$this->printLog("parsing log {$log->revision}");
if ($log->revision == $savedRevision) {
if ($log->revision == $savedRevision)
{
$this->printLog("{$log->revision} alread parsed, commit it");
continue;
}
@@ -152,12 +153,14 @@ class gitModel extends model
$arriveLastTag = false;
$jobToBuild = [];
foreach ($tags as $tag) {
if (!empty($savedTag) && $tag === $savedTag) { // get the last build tag position
if (!empty($savedTag) && $tag === $savedTag) // get the last build tag position
{
$arriveLastTag = true;
continue;
}
if (!empty($savedTag) && !$arriveLastTag) { // not get
if (!empty($savedTag) && !$arriveLastTag) // not get
{
continue;
}
+2 -1
View File
@@ -36,7 +36,8 @@
<td class='c-actions text-right'>
<?php
common::printIcon('jenkins', 'edit', "jenkinsID=$id", '', 'list', 'edit');
if (common::hasPriv('jenkins', 'delete')) {
if (common::hasPriv('jenkins', 'delete'))
{
$deleteURL = $this->createLink('jenkins', 'delete', "jenkinsID=$id&confirm=yes");
echo html::a("javascript:ajaxDelete(\"$deleteURL\", \"jenkinsList\", confirmDelete)", '<i class="icon-trash"></i>', '', "title='{$lang->jenkins->delete}' class='btn'");
}
+4 -2
View File
@@ -4,12 +4,14 @@ $(function()
});
function scmChanged(scm) {
if(scm == 'Git') {
if(scm == 'Git')
{
$('.account-fields').addClass('hidden');
$('.tips-git').removeClass('hidden');
$('.tips-svn').addClass('hidden');
} else {
} else
{
$('.account-fields').removeClass('hidden');
$('.tips-git').addClass('hidden');
+4 -2
View File
@@ -4,12 +4,14 @@ $(function()
});
function scmChanged(scm) {
if(scm == 'Git') {
if(scm == 'Git')
{
$('.account-fields').addClass('hidden');
$('.tips-git').removeClass('hidden');
$('.tips-svn').addClass('hidden');
} else {
} else
{
$('.account-fields').removeClass('hidden');
$('.tips-git').addClass('hidden');
+2 -1
View File
@@ -37,7 +37,8 @@
<td class='c-actions text-right'>
<?php
common::printIcon('repo', 'edit', "repoID=$id", '', 'list', 'edit');
if (common::hasPriv('repo', 'delete')) {
if (common::hasPriv('repo', 'delete'))
{
$deleteURL = $this->createLink('repo', 'delete', "repoID=$id&confirm=yes");
echo html::a("javascript:ajaxDelete(\"$deleteURL\", \"repoList\", confirmDelete)", '<i class="icon-trash"></i>', '', "title='{$lang->repo->delete}' class='btn'");
}
+7 -8
View File
@@ -103,7 +103,8 @@ class svnModel extends model
$allCommands = [];
foreach ($logs as $log) {
$this->printLog("parsing log {$log->revision}");
if ($log->revision == $savedRevision) {
if ($log->revision == $savedRevision)
{
$this->printLog("{$log->revision} alread parsed, commit it");
continue;
}
@@ -152,7 +153,8 @@ class svnModel extends model
if(!empty($tags)) {
$jobToBuild = [];
foreach ($tags as $tag) {
if ($savedTags[$tag]) { // old
if ($savedTags[$tag]) // old
{
continue;
}
@@ -348,9 +350,8 @@ class svnModel extends model
public function getRepoTags($repo)
{
$path = $repo->path;
if (substr($path, -1) != '/') {
$path .= '/';
}
if (substr($path, -1) != '/') $path .= '/';
$path = str_replace("/trunk/","/tags/", $path);
$parsedTags = array();
@@ -360,9 +361,7 @@ class svnModel extends model
exec($cmd, $list, $return);
foreach($list as $line)
{
if (substr($path, -1) == '/') {
$line = substr($line, 0, strlen($line) - 1);
}
if (substr($path, -1) == '/') $line = substr($line, 0, strlen($line) - 1);
$parsedTags[] = $line;
}
+4 -2
View File
@@ -42,9 +42,11 @@ Copyright (c) Vladimir Gubarkov <xonixx@gmail.com>
}
function copyToBuffer(textToCopy) {
if (window.clipboardData) { // IE
if (window.clipboardData)
{ // IE
window.clipboardData.setData("Text", textToCopy);
} else if (window.netscape) { // FF
} else if (window.netscape)
{ // FF
// from http://developer.mozilla.org/en/docs/Using_the_Clipboard
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper);