* Modify git clone for Gitea and Gogs.
This commit is contained in:
@@ -28,8 +28,11 @@ class Gitea
|
||||
$project = $app->control->loadModel('gitea')->apiGetSingleProject($repo->serviceHost, $repo->serviceProject);
|
||||
if(isset($project->tokenCloneUrl))
|
||||
{
|
||||
$cmd = 'git clone --progress -v "' . $project->tokenCloneUrl . '" "' . $this->root . '"';
|
||||
$cmd = 'git clone --progress -v "' . $project->tokenCloneUrl . '" "' . $this->root . '" > "' . $app->getTmpRoot() . "log/clone.progress." . strtolower($repo->SCM) . ".{$repo->name}.log\" 2>&1 &";
|
||||
if(PHP_OS == 'WINNT') $cmd = "start /b $cmd";
|
||||
exec($cmd);
|
||||
|
||||
return $app->control->locate($app->control->createLink('repo', 'showSyncCommit', "repoID={$repo->id}"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,11 @@ class Gogs
|
||||
$project = $app->control->loadModel('gogs')->apiGetSingleProject($repo->serviceHost, $repo->serviceProject);
|
||||
if(isset($project->tokenCloneUrl))
|
||||
{
|
||||
$cmd = 'git clone --progress -v "' . $project->tokenCloneUrl . '" "' . $this->root . '"';
|
||||
$cmd = 'git clone --progress -v "' . $project->tokenCloneUrl . '" "' . $this->root . '" > "' . $app->getTmpRoot() . "log/clone.progress." . strtolower($repo->SCM) . ".{$repo->name}.log\" 2>&1 &";
|
||||
if(PHP_OS == 'WINNT') $cmd = "start /b $cmd";
|
||||
exec($cmd);
|
||||
|
||||
return $app->control->locate($app->control->createLink('repo', 'showSyncCommit', "repoID={$repo->id}"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ $lang->repo = new stdclass();
|
||||
$lang->jenkins = new stdclass();
|
||||
$lang->gitlab = new stdclass();
|
||||
$lang->gitea = new stdclass();
|
||||
$lang->gogs = new stdclass();
|
||||
$lang->mr = new stdclass();
|
||||
$lang->compile = new stdclass();
|
||||
$lang->job = new stdclass();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
$lang->gitea = new stdclass;
|
||||
$lang->gitea->common = 'Gitea';
|
||||
$lang->gitea->browse = 'Gitea Browse';
|
||||
$lang->gitea->search = 'Search';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
$lang->gitea = new stdclass;
|
||||
$lang->gitea->common = 'Gitea';
|
||||
$lang->gitea->browse = 'Gitea Browse';
|
||||
$lang->gitea->search = 'Search';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
$lang->gitea = new stdclass;
|
||||
$lang->gitea->common = 'Gitea';
|
||||
$lang->gitea->browse = 'Gitea Browse';
|
||||
$lang->gitea->search = 'Search';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
$lang->gitea = new stdclass;
|
||||
$lang->gitea->common = 'Gitea';
|
||||
$lang->gitea->browse = 'Gitea Browse';
|
||||
$lang->gitea->search = 'Search';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
$lang->gitea = new stdclass;
|
||||
$lang->gitea->common = 'Gitea';
|
||||
$lang->gitea->browse = '浏览Gitea';
|
||||
$lang->gitea->search = '搜索';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
$lang->gitea = new stdclass;
|
||||
$lang->gitea->common = 'Gitea';
|
||||
$lang->gitea->browse = '浏览Gitea';
|
||||
$lang->gitea->search = '搜索';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
$lang->gitlab = new stdclass;
|
||||
$lang->gitlab->common = 'GitLab';
|
||||
$lang->gitlab->browse = 'GitLab Browse';
|
||||
$lang->gitlab->search = 'Search';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
$lang->gitlab = new stdclass;
|
||||
$lang->gitlab->common = 'GitLab';
|
||||
$lang->gitlab->browse = 'GitLab Browse';
|
||||
$lang->gitlab->search = 'Search';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
$lang->gitlab = new stdclass;
|
||||
$lang->gitlab->common = 'GitLab';
|
||||
$lang->gitlab->browse = 'GitLab Browse';
|
||||
$lang->gitlab->search = 'Search';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
$lang->gitlab = new stdclass;
|
||||
$lang->gitlab->common = 'GitLab';
|
||||
$lang->gitlab->browse = 'GitLab Browse';
|
||||
$lang->gitlab->search = 'Search';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
$lang->gitlab = new stdclass;
|
||||
$lang->gitlab->common = 'GitLab';
|
||||
$lang->gitlab->browse = '浏览GitLab';
|
||||
$lang->gitlab->search = '搜索';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
$lang->gitlab = new stdclass;
|
||||
$lang->gitlab->common = 'GitLab';
|
||||
$lang->gitlab->browse = '瀏覽GitLab';
|
||||
$lang->gitlab->search = '搜索';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
$lang->gogs = new stdclass;
|
||||
$lang->gogs->common = 'Gogs';
|
||||
$lang->gogs->browse = 'Gogs Browse';
|
||||
$lang->gogs->search = 'Search';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
$lang->gogs = new stdclass;
|
||||
$lang->gogs->common = 'Gogs';
|
||||
$lang->gogs->browse = 'Gogs Browse';
|
||||
$lang->gogs->search = 'Search';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
$lang->gogs = new stdclass;
|
||||
$lang->gogs->common = 'Gogs';
|
||||
$lang->gogs->browse = 'Gogs Browse';
|
||||
$lang->gogs->search = 'Search';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
$lang->gogs = new stdclass;
|
||||
$lang->gogs->common = 'Gogs';
|
||||
$lang->gogs->browse = 'Gogs Browse';
|
||||
$lang->gogs->search = 'Search';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
$lang->gogs = new stdclass;
|
||||
$lang->gogs->common = 'Gogs';
|
||||
$lang->gogs->browse = '浏览Gogs';
|
||||
$lang->gogs->search = '搜索';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
$lang->gogs = new stdclass;
|
||||
$lang->gogs->common = 'Gogs';
|
||||
$lang->gogs->browse = '浏览Gogs';
|
||||
$lang->gogs->search = '搜索';
|
||||
|
||||
+25
-3
@@ -300,7 +300,7 @@ class repo extends control
|
||||
}
|
||||
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = new pager(0, 8, 1);
|
||||
$pager = new pager(0, 10, 1);
|
||||
|
||||
$logType = 'file';
|
||||
$revisions = $this->repo->getCommits($repo, '/' . $entry, 'HEAD', $logType, $pager);
|
||||
@@ -416,7 +416,7 @@ class repo extends control
|
||||
|
||||
/* Load pager. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = new pager(0, 8, 1);
|
||||
$pager = new pager(0, 10, 1);
|
||||
|
||||
if($_POST)
|
||||
{
|
||||
@@ -939,6 +939,28 @@ class repo extends control
|
||||
if(empty($repo)) return;
|
||||
if($repo->synced) return print('finish');
|
||||
|
||||
if(in_array($repo->SCM, array('Gitea', 'Gogs')))
|
||||
{
|
||||
$logFile = realPath($this->app->getTmpRoot() . "/log/clone.progress." . strtolower($repo->SCM) . ".{$repo->name}.log");
|
||||
if($logFile)
|
||||
{
|
||||
$content = file($logFile);
|
||||
$lastLine = $content[count($content) - 1];
|
||||
if(!strpos($lastLine, 'done'))
|
||||
{
|
||||
return print(1);
|
||||
}
|
||||
elseif(strpos($lastLine, 'fatal') !== false)
|
||||
{
|
||||
return print('finish');
|
||||
}
|
||||
else
|
||||
{
|
||||
@unlink($logFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->commonAction($repoID);
|
||||
$this->scm->setEngine($repo);
|
||||
|
||||
@@ -1079,7 +1101,7 @@ class repo extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxSideCommits($repoID, $path, $objectID = 0, $type = 'dir', $recTotal = 0, $recPerPage = 8, $pageID = 1)
|
||||
public function ajaxSideCommits($repoID, $path, $objectID = 0, $type = 'dir', $recTotal = 0, $recPerPage = 10, $pageID = 1)
|
||||
{
|
||||
if($this->get->repoPath) $path = $this->get->repoPath;
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
|
||||
@@ -1431,7 +1431,9 @@ class repoModel extends model
|
||||
$path = $this->app->getAppRoot() . 'www/data/repo/' . $this->post->name . '_' . $module;
|
||||
if(!realpath($path))
|
||||
{
|
||||
$cmd = 'git clone --progress -v "' . $project->tokenCloneUrl . '" "' . $path . '"';
|
||||
$project->tokenCloneUrl = 'https://oauth2:A1EVShVfuGo3PaQRuiQN@gitlab.zcorp.cc/easycorp/zentaopms.git';
|
||||
$cmd = 'git clone --progress -v "' . $project->tokenCloneUrl . '" "' . $path . '" > "' . $this->app->getTmpRoot() . "log/clone.progress.$module.{$this->post->name}.log\" 2>&1 &";
|
||||
if(PHP_OS == 'WINNT') $cmd = "start /b $cmd";
|
||||
exec($cmd);
|
||||
}
|
||||
$_POST['path'] = $path;
|
||||
|
||||
@@ -53,7 +53,7 @@ if(isset($entry)) $pathInfo .= '&type=file';
|
||||
<?php if(common::hasPriv('repo', 'diff')) echo html::submitButton($lang->repo->diff, '', count($revisions) < 2 ? 'disabled btn btn-primary' : 'btn btn-primary')?>
|
||||
<?php echo html::a($this->repo->createLink('log', "repoID=$repoID&objectID=$objectID&entry=" . $this->repo->encodePath($path) . "&revision=HEAD&type=$logType"), $lang->repo->allLog, '', "class='allLogs' data-app='{$this->app->tab}'");?>
|
||||
<div class='pull-right'>
|
||||
<ul id="repoPageSize" class="pager" data-ride="pager" data-elements="size_menu" data-rec-total="<?php echo $pager->recTotal;?>" data-rec-per-page="<?php echo $pager->recPerPage;?>" data-page="<?php echo $pager->pageID;?>"></ul>
|
||||
<ul id="repoPageSize" class="pager" data-ride="pager" data-elements="size_menu" data-rec-total="<?php echo $pager->recTotal;?>" data-rec-per-page="<?php echo $pager->recPerPage;?>" data-page="<?php echo $pager->pageID;?>"></ul>
|
||||
<div class='btn-group'>
|
||||
<?php
|
||||
$prePage = $pager->pageID == 1 ? 1 : $pager->pageID - 1;
|
||||
|
||||
Reference in New Issue
Block a user