Merge branch '15.0.beta3' of https://gitlab.zcorp.cc/easycorp/zentaopms into 15.0.beta3
This commit is contained in:
@@ -501,7 +501,8 @@ class gitlab
|
||||
if($version)
|
||||
{
|
||||
$lastCommit = $this->getSingleCommit($version);
|
||||
if(empty($lastCommit)) return array();
|
||||
if(!isset($lastCommit->committed_date)) return array('commits' => array(), 'files' => array());
|
||||
|
||||
$params['until'] = $lastCommit->committed_date;
|
||||
}
|
||||
|
||||
@@ -644,7 +645,13 @@ class gitlab
|
||||
$api = ltrim($api, '/');
|
||||
$api = $this->root . $api . '?' . http_build_query($params);
|
||||
|
||||
$response = file_get_contents($api);
|
||||
$response = commonModel::http($api);
|
||||
if(!empty(commonModel::$requestErrors))
|
||||
{
|
||||
commonModel::$requestErrors = array();
|
||||
return array();
|
||||
}
|
||||
|
||||
return json_decode($response);
|
||||
}
|
||||
|
||||
|
||||
@@ -546,7 +546,7 @@ class bug extends control
|
||||
}
|
||||
|
||||
/* Get executions. */
|
||||
$executions = array('' => '');
|
||||
$executions = array(0 => '');
|
||||
if(isset($projects[$projectID]) or $this->config->systemMode == 'classic') $executions += $this->product->getExecutionPairsByProduct($productID, $branch ? "0,$branch" : 0, 'id_desc', $projectID);
|
||||
|
||||
/* Set custom. */
|
||||
@@ -877,7 +877,7 @@ class bug extends control
|
||||
$this->view->plans = $this->loadModel('productplan')->getPairs($productID, $bug->branch);
|
||||
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $bug->branch);
|
||||
$this->view->currentModuleID = $currentModuleID;
|
||||
$this->view->executions = $this->product->getExecutionPairsByProduct($bug->product, $bug->branch ? "0,{$bug->branch}" : 0, 'id_desc', $projectID);
|
||||
$this->view->executions = array(0 => '') + $this->product->getExecutionPairsByProduct($bug->product, $bug->branch ? "0,{$bug->branch}" : 0, 'id_desc', $projectID);
|
||||
$this->view->stories = $bug->execution ? $this->story->getExecutionStoryPairs($bug->execution) : $this->story->getProductStoryPairs($bug->product, $bug->branch);
|
||||
$this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($bug->product);
|
||||
$this->view->tasks = $this->task->getExecutionTaskPairs($bug->execution);
|
||||
|
||||
@@ -63,7 +63,7 @@ class file extends control
|
||||
die(json_encode(array('error' => 1, 'message' => $this->lang->file->errorFileUpload)));
|
||||
}
|
||||
}
|
||||
if(@helper::saveFile($file['tmpname'], $this->file->savePath . $this->file->getSaveName($file['pathname'])))
|
||||
if(@move_uploaded_file($file['tmpname'], $this->file->savePath . $this->file->getSaveName($file['pathname'])))
|
||||
{
|
||||
/* Compress image for jpg and bmp. */
|
||||
$file = $this->file->compressImage($file);
|
||||
|
||||
+28
-3
@@ -262,7 +262,7 @@ class fileModel extends model
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!helper::saveFile($file['tmpname'], $tmpFileChunkPath)) return false;
|
||||
if(!move_uploaded_file($file['tmpname'], $tmpFileChunkPath)) return false;
|
||||
}
|
||||
|
||||
if($file['chunk'] == ($file['chunks'] - 1))
|
||||
@@ -278,7 +278,7 @@ class fileModel extends model
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!helper::saveFile($file['tmpname'], $file['realpath'])) return false;
|
||||
if(!move_uploaded_file($file['tmpname'], $file['realpath'])) return false;
|
||||
|
||||
$uploadFile['extension'] = $file['extension'];
|
||||
$uploadFile['pathname'] = $file['pathname'];
|
||||
@@ -471,7 +471,7 @@ class fileModel extends model
|
||||
$pathName = $filePath->pathname;
|
||||
$realPathName = $this->savePath . $this->getRealPathName($pathName);
|
||||
if(!is_dir(dirname($realPathName))) mkdir(dirname($realPathName));
|
||||
helper::saveFile($file['tmpname'], $realPathName);
|
||||
move_uploaded_file($file['tmpname'], $realPathName);
|
||||
|
||||
$file['pathname'] = $pathName;
|
||||
$file = $this->compressImage($file);
|
||||
@@ -966,4 +966,29 @@ class fileModel extends model
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get image size.
|
||||
*
|
||||
* @access public
|
||||
* @param object $file
|
||||
* @return array
|
||||
*/
|
||||
public function getImageSize($file)
|
||||
{
|
||||
if($this->config->file->storageType == 'fs')
|
||||
{
|
||||
return getimagesize($file->realPath);
|
||||
}
|
||||
else if($this->config->file->storageType == 's3')
|
||||
{
|
||||
$this->app->loadClass('ossclient', true);
|
||||
|
||||
$config = $this->config->file;
|
||||
$ossClient = new ossclient($config->accessKeyId, $config->accessKeySecret, $config->endpoint, $config->bucket);
|
||||
$info = $ossClient->getImageInfo($file->pathname);
|
||||
|
||||
return array($info->ImageWidth->value, $info->ImageHeight->value, 'img');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ $sessionString .= session_name() . '=' . session_id();
|
||||
$imageWidth = 0;
|
||||
if(stripos('jpg|jpeg|gif|png|bmp', $file->extension) !== false)
|
||||
{
|
||||
$imageSize = getimagesize($file->realPath);
|
||||
$imageSize = $this->file->getImageSize($file);
|
||||
$imageWidth = $imageSize ? $imageSize[0] : 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -748,7 +748,7 @@ class projectModel extends model
|
||||
$lib->name = $this->lang->doclib->main['project'];
|
||||
$lib->type = 'project';
|
||||
$lib->main = '1';
|
||||
$lib->acl = $project->acl;
|
||||
$lib->acl = $project->acl != 'program' ? $project->acl : 'custom';
|
||||
$this->dao->insert(TABLE_DOCLIB)->data($lib)->exec();
|
||||
|
||||
$this->updateProducts($projectID);
|
||||
@@ -815,6 +815,8 @@ class projectModel extends model
|
||||
$this->dao->replace(TABLE_USERGROUP)->data($groupPriv)->exec();
|
||||
}
|
||||
|
||||
if($project->acl != 'open') $this->loadModel('user')->updateUserView($projectID, 'project');
|
||||
|
||||
return $projectID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -867,7 +867,7 @@ class repo extends control
|
||||
set_time_limit(0);
|
||||
$repo = $this->repo->getRepoByID($repoID);
|
||||
if(empty($repo)) die();
|
||||
//if($repo->synced) die('finish');
|
||||
if($repo->synced) die('finish');
|
||||
|
||||
$this->commonAction($repoID);
|
||||
$this->scm->setEngine($repo);
|
||||
|
||||
@@ -281,15 +281,18 @@ class repoModel extends model
|
||||
$repo = $this->getRepoByID($id);
|
||||
|
||||
$data = fixer::input('post')
|
||||
->setIf($this->post->SCM == 'Gitlab', 'password', $this->post->gitlabToken)
|
||||
->setIf($this->post->SCM == 'Gitlab', 'client', $this->post->gitlabHost)
|
||||
->setIf($this->post->SCM == 'Gitlab', 'extra', $this->post->gitlabProject)
|
||||
->setDefault('client', 'svn')
|
||||
->setDefault('prefix', $repo->prefix)
|
||||
->setDefault('product', '')
|
||||
->setIF($this->post->path != $repo->path, 'synced', 0)
|
||||
->skipSpecial('path,client,account,password')
|
||||
->join('product', ',')
|
||||
->get();
|
||||
|
||||
if($this->post->SCM == 'Gitlab') $data->path = sprintf($this->config->repo->gitlab->apiPath, $data->gitlabHost, $this->post->gitlabProject);
|
||||
if($data->path != $repo->path) $data->synced = 0;
|
||||
|
||||
$data->acl = empty($data->acl) ? '' : json_encode($data->acl);
|
||||
|
||||
@@ -313,7 +316,7 @@ class repoModel extends model
|
||||
$this->dao->update(TABLE_REPO)->data($data, $skip = 'gitlabHost,gitlabToken,gitlabProject')
|
||||
->batchCheck($this->config->repo->edit->requiredFields, 'notempty')
|
||||
->checkIF($data->SCM == 'Subversion', $this->config->repo->svn->requiredFields, 'notempty')
|
||||
->checkIF($data->SCM == 'GitLab', 'gitlabProject', 'notempty')
|
||||
->checkIF($data->SCM == 'GitLab', 'extra', 'notempty')
|
||||
->autoCheck()
|
||||
->where('id')->eq($id)->exec();
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ class upgrade extends control
|
||||
|
||||
if(!$this->upgrade->isError())
|
||||
{
|
||||
if(!$this->config->systemMode && !isset($this->config->qcVersion)) $this->locate(inlink('to15Guide', "fromVersion=$fromVersion"));
|
||||
if(!$this->config->systemMode && !isset($this->config->qcVersion) && strpos($fromVersion, 'max') === false) $this->locate(inlink('to15Guide', "fromVersion=$fromVersion"));
|
||||
$this->locate(inlink('afterExec', "fromVersion=$fromVersion"));
|
||||
}
|
||||
|
||||
|
||||
@@ -647,6 +647,10 @@ class upgradeModel extends model
|
||||
$this->saveLogs('Execute 15_0_rc2');
|
||||
$this->execSQL($this->getUpgradeFile('15.0.rc2'));
|
||||
$this->appendExec('15_0_rc2');
|
||||
case '15_0_rc3':
|
||||
$this->saveLogs('Execute 15_0_rc3');
|
||||
$this->updateLibType();
|
||||
$this->appendExec('15_0_rc3');
|
||||
}
|
||||
|
||||
$this->deletePatch();
|
||||
@@ -4306,7 +4310,7 @@ class upgradeModel extends model
|
||||
$lib->name = $this->lang->doclib->main['project'];
|
||||
$lib->type = 'project';
|
||||
$lib->main = '1';
|
||||
$lib->acl = $project->acl;
|
||||
$lib->acl = $project->acl != 'program' ? $project->acl : 'custom';
|
||||
$this->dao->insert(TABLE_DOCLIB)->data($lib)->exec();
|
||||
|
||||
$this->loadModel('action')->create('project', $projectID, 'openedbysystem');
|
||||
@@ -4909,4 +4913,18 @@ class upgradeModel extends model
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update execution main doclib type.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function updateLibType()
|
||||
{
|
||||
$executionList = $this->dao->select('id')->from(TABLE_EXECUTION)->where('type')->eq('sprint')->fetchAll('id');
|
||||
$this->dao->update(TABLE_DOCLIB)->set('type')->eq('execution')->where('execution')->in(array_keys($executionList))->exec();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,6 +192,7 @@ class userModel extends model
|
||||
* Get user info by ID.
|
||||
*
|
||||
* @param mix $userID
|
||||
* @param string $field id|account
|
||||
* @access public
|
||||
* @return object|bool
|
||||
*/
|
||||
|
||||
+26
-2
@@ -29,6 +29,13 @@ $tester = $app->loadCommon();
|
||||
$config->zendataRoot = dirname(__FILE__) . DS . 'zendata';
|
||||
$config->zdPath = "/usr/local/zd/zd";
|
||||
|
||||
/**
|
||||
* Save variable to $_result.
|
||||
*
|
||||
* @param mix $result
|
||||
* @access public
|
||||
* @return bool true
|
||||
*/
|
||||
function run($result)
|
||||
{
|
||||
global $_result;
|
||||
@@ -36,6 +43,14 @@ function run($result)
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print expect data.
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $delimiter
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function expect($key, $delimiter = ',')
|
||||
{
|
||||
global $_result;
|
||||
@@ -66,12 +81,21 @@ function expect($key, $delimiter = ',')
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
/**
|
||||
* Import data create by zendata to one table.
|
||||
*
|
||||
* @param string $table
|
||||
* @param string $yaml
|
||||
* @param int $count
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function zdImport($table, $yaml, $count = 10)
|
||||
{
|
||||
chdir(dirname(__FILE__));
|
||||
global $app, $config;
|
||||
$dns = "mysql://{$config->db->user}:{$config->db->password}@{$config->db->host}:{$config->db->port}/{$config->db->name}#utf8";
|
||||
$table = trim($table, '`');
|
||||
$commad = "$config->zdPath -c $yaml -t $table -T -dns $dns --clear -n $count";
|
||||
system($commad);
|
||||
$command = "$config->zdPath -c $yaml -t $table -T -dns $dns --clear -n $count";
|
||||
system($command);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user