* finish task #6934.
This commit is contained in:
@@ -200,29 +200,6 @@ class gitModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($this->config->git->repos))
|
||||
{
|
||||
foreach($this->config->git->repos as $i => $repo)
|
||||
{
|
||||
$repoPath = $repo['path'];
|
||||
if(empty($repoPath)) continue;
|
||||
if(isset($paths[$repoPath])) continue;
|
||||
|
||||
$gitRepo = new stdclass();
|
||||
$gitRepo->id = "c{$i}";
|
||||
$gitRepo->client = $this->config->git->client;
|
||||
$gitRepo->path = $repoPath;
|
||||
$gitRepo->prefix = '';
|
||||
$gitRepo->SCM = 'Git';
|
||||
$gitRepo->account = '';
|
||||
$gitRepo->password = '';
|
||||
$gitRepo->encoding = zget($repo, 'encoding', $this->config->git->client);
|
||||
|
||||
$gitRepos[] = $gitRepo;
|
||||
$paths[$repoPath] = $repoPath;
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($gitRepos)) echo "You must set one git repo.\n";
|
||||
|
||||
$this->repos = $gitRepos;
|
||||
|
||||
@@ -215,29 +215,6 @@ class svnModel extends model
|
||||
$paths[$repo->path] = $repo->path;
|
||||
}
|
||||
|
||||
if(isset($this->config->svn->repos))
|
||||
{
|
||||
foreach($this->config->svn->repos as $i => $repo)
|
||||
{
|
||||
$repoPath = $repo['path'];
|
||||
if(empty($repoPath)) continue;
|
||||
if(isset($paths[$repoPath])) continue;
|
||||
|
||||
$svnRepo = new stdclass();
|
||||
$svnRepo->id = "c{$i}";
|
||||
$svnRepo->client = $this->config->svn->client;
|
||||
$svnRepo->path = $repoPath;
|
||||
$svnRepo->prefix = '';
|
||||
$svnRepo->SCM = 'Subversion';
|
||||
$svnRepo->account = $repo['username'];
|
||||
$svnRepo->password = $repo['password'];
|
||||
$svnRepo->encoding = zget($repo, 'encoding', $this->config->svn->client);
|
||||
|
||||
$svnRepos[] = $svnRepo;
|
||||
$paths[$repoPath] = $repoPath;
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($svnRepos)) echo "You must set one svn repo.\n";
|
||||
$this->repos = $svnRepos;
|
||||
return true;
|
||||
|
||||
@@ -561,6 +561,13 @@ class upgradeModel extends model
|
||||
$this->loadModel('setting')->setItem('system.common.global.showAnnual', '1');
|
||||
$this->appendExec('11_7');
|
||||
case '12_0':
|
||||
$this->saveLogs('Execute 12_0');
|
||||
$this->appendExec('12_0');
|
||||
case '12_0_1':
|
||||
$this->saveLogs('Execute 12_0_1');
|
||||
$this->execSQL($this->getUpgradeFile('12.0.1'));
|
||||
$this->saveRepo();
|
||||
$this->appendExec('12_0_1');
|
||||
}
|
||||
|
||||
$this->deletePatch();
|
||||
@@ -3630,6 +3637,66 @@ class upgradeModel extends model
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save repo from svn and git config.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function saveRepo()
|
||||
{
|
||||
$this->app->loadConfig('svn');
|
||||
if(isset($this->config->svn->repos))
|
||||
{
|
||||
$scm = $this->app->loadClass('scm');
|
||||
foreach($this->config->svn->repos as $i => $repo)
|
||||
{
|
||||
$repoPath = $repo['path'];
|
||||
if(empty($repoPath)) continue;
|
||||
|
||||
$svnRepo = new stdclass();
|
||||
$svnRepo->client = $this->config->svn->client;
|
||||
$svnRepo->name = basename($repoPath);
|
||||
$svnRepo->path = $repoPath;
|
||||
$svnRepo->SCM = 'Subversion';
|
||||
$svnRepo->account = $repo['username'];
|
||||
$svnRepo->password = $repo['password'];
|
||||
$svnRepo->encrypt = 'base64';
|
||||
$svnRepo->encoding = zget($repo, 'encoding', $this->config->svn->encoding);
|
||||
|
||||
$scm->setEngine($repo);
|
||||
$info = $scm->info('');
|
||||
$svnRepo->prefix = empty($info->root) ? '' : trim(str_ireplace($info->root, '', str_replace('\\', '/', $svnRepo->path)), '/');
|
||||
if($svnRepo->prefix) $svnRepo->prefix = '/' . $svnRepo->prefix;
|
||||
|
||||
$svnRepo->password = base64_encode($repo['password']);
|
||||
$this->dao->insert(TABLE_REPO)->data($svnRepo)->exec();
|
||||
}
|
||||
}
|
||||
|
||||
$this->app->loadConfig('git');
|
||||
if(isset($this->config->git->repos))
|
||||
{
|
||||
foreach($this->config->git->repos as $i => $repo)
|
||||
{
|
||||
$repoPath = $repo['path'];
|
||||
if(empty($repoPath)) continue;
|
||||
|
||||
$gitRepo = new stdclass();
|
||||
$gitRepo->client = $this->config->git->client;
|
||||
$gitRepo->name = basename($repoPath);
|
||||
$gitRepo->path = $repoPath;
|
||||
$gitRepo->prefix = '';
|
||||
$gitRepo->SCM = 'Git';
|
||||
$gitRepo->account = '';
|
||||
$gitRepo->password = '';
|
||||
$gitRepo->encrypt = 'base64';
|
||||
$gitRepo->encoding = zget($repo, 'encoding', $this->config->git->encoding);
|
||||
$this->dao->insert(TABLE_REPO)->data($gitRepo)->exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Logs.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user