* Fix bugs

This commit is contained in:
zenggang
2023-08-07 06:53:59 +00:00
parent c9acba74a7
commit d7b4cfbe18
11 changed files with 239 additions and 29 deletions
+5 -4
View File
@@ -164,15 +164,16 @@ $config->maxCount = 500;
$config->moreLinks = array();
/* 渠成平台设置。CNE Api settings. */
$config->inQuickon = false;
$config->inContainer = false;
$config->inQuickon = getenv('IN_QUICKON');
$config->inContainer = getenv('IN_CONTAINER');
$config->k8space = 'quickon-system';
$config->demoAccounts = ''; // 用于演示的账号列表,该账号安装的应用30钟后会自动删除。 In account list for demo, app instance of demo will be removed in 30 minutes.
$config->demoAppLife = 30; // Demo安装的应用实例存续时长(分钟)。The minutes life of instance which demo account installed.
$config->CNE = new stdclass();
$config->CNE->api = new stdclass();
$config->CNE->api->host = '';
$config->CNE->api->host = getenv('CNE_API_HOST');
$config->CNE->api->auth = 'X-Auth-Token';
$config->CNE->api->token = 'reiquai7pei7thei4iePe5ait3Kaiquu'; // Please set token in my.php.
$config->CNE->api->token = getenv('CNE_API_TOKEN'); // Please set token in my.php.
$config->CNE->api->headers = array('Content-Type: application/json');
$config->CNE->api->channel = 'stable';
+5 -5
View File
@@ -60,7 +60,7 @@ class Requests_Cookie_Jar implements ArrayAccess, IteratorAggregate {
* @param string $key Item key
* @return boolean Does the item exist?
*/
public function offsetExists($key) {
public function offsetExists($key): bool {
return isset($this->cookies[$key]);
}
@@ -70,7 +70,7 @@ class Requests_Cookie_Jar implements ArrayAccess, IteratorAggregate {
* @param string $key Item key
* @return string|null Item value (null if offsetExists is false)
*/
public function offsetGet($key) {
public function offsetGet($key): string|null {
if (!isset($this->cookies[$key])) {
return null;
}
@@ -86,7 +86,7 @@ class Requests_Cookie_Jar implements ArrayAccess, IteratorAggregate {
* @param string $key Item name
* @param string $value Item value
*/
public function offsetSet($key, $value) {
public function offsetSet($key, $value): void {
if ($key === null) {
throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset');
}
@@ -99,7 +99,7 @@ class Requests_Cookie_Jar implements ArrayAccess, IteratorAggregate {
*
* @param string $key
*/
public function offsetUnset($key) {
public function offsetUnset($key): void {
unset($this->cookies[$key]);
}
@@ -108,7 +108,7 @@ class Requests_Cookie_Jar implements ArrayAccess, IteratorAggregate {
*
* @return ArrayIterator
*/
public function getIterator() {
public function getIterator(): ArrayIterator {
return new ArrayIterator($this->cookies);
}
+3 -3
View File
@@ -23,7 +23,7 @@ class Requests_Response_Headers extends Requests_Utility_CaseInsensitiveDictiona
* @param string $key
* @return string|null Header value
*/
public function offsetGet($key) {
public function offsetGet($key): string|null {
$key = strtolower($key);
if (!isset($this->data[$key])) {
return null;
@@ -40,7 +40,7 @@ class Requests_Response_Headers extends Requests_Utility_CaseInsensitiveDictiona
* @param string $key Item name
* @param string $value Item value
*/
public function offsetSet($key, $value) {
public function offsetSet($key, $value): void {
if ($key === null) {
throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset');
}
@@ -92,7 +92,7 @@ class Requests_Response_Headers extends Requests_Utility_CaseInsensitiveDictiona
* Converts the internal
* @return ArrayIterator
*/
public function getIterator() {
public function getIterator(): ArrayIterator {
return new Requests_Utility_FilteredIterator($this->data, array($this, 'flatten'));
}
}
@@ -37,7 +37,7 @@ class Requests_Utility_CaseInsensitiveDictionary implements ArrayAccess, Iterato
* @param string $key Item key
* @return boolean Does the item exist?
*/
public function offsetExists($key) {
public function offsetExists($key): bool {
$key = strtolower($key);
return isset($this->data[$key]);
}
@@ -48,7 +48,7 @@ class Requests_Utility_CaseInsensitiveDictionary implements ArrayAccess, Iterato
* @param string $key Item key
* @return string|null Item value (null if offsetExists is false)
*/
public function offsetGet($key) {
public function offsetGet($key): string|null {
$key = strtolower($key);
if (!isset($this->data[$key])) {
return null;
@@ -65,7 +65,7 @@ class Requests_Utility_CaseInsensitiveDictionary implements ArrayAccess, Iterato
* @param string $key Item name
* @param string $value Item value
*/
public function offsetSet($key, $value) {
public function offsetSet($key, $value): void {
if ($key === null) {
throw new Requests_Exception('Object is a dictionary, not a list', 'invalidset');
}
@@ -79,7 +79,7 @@ class Requests_Utility_CaseInsensitiveDictionary implements ArrayAccess, Iterato
*
* @param string $key
*/
public function offsetUnset($key) {
public function offsetUnset($key): void {
unset($this->data[strtolower($key)]);
}
@@ -88,7 +88,7 @@ class Requests_Utility_CaseInsensitiveDictionary implements ArrayAccess, Iterato
*
* @return ArrayIterator
*/
public function getIterator() {
public function getIterator(): ArrayIterator {
return new ArrayIterator($this->data);
}
+1 -3
View File
@@ -15,9 +15,7 @@ class scm
$className = $repo->SCM;
if($className == 'Git') $className = 'GitRepo';
if(!class_exists($className)) require(strtolower($className) . '.class.php');
$repoRoot = $repo->path;
if('Subversion' == $className && !empty($repo->prefix)) $repoRoot = substr($repo->path, 0, strlen($repo->path) - strlen($repo->prefix));
$this->engine = new $className($repo->client, $repoRoot, $repo->account, $repo->password, $repo->encoding, $repo);
$this->engine = new $className($repo->client, $className == 'Gitlab' ? $repo->apiPath : $repo->path, $repo->account, $repo->password, $repo->encoding, $repo);
}
/**
+1 -1
View File
@@ -82,7 +82,7 @@ class gitea extends control
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$actionID = $this->loadModel('action')->create('gitea', $giteaID, 'created');
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('space', 'browse')));
}
$this->view->title = $this->lang->gitea->common . $this->lang->colon . $this->lang->gitea->lblCreate;
+1 -1
View File
@@ -81,7 +81,7 @@ class gogs extends control
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$actionID = $this->loadModel('action')->create('gogs', $gogsID, 'created');
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('space', 'browse')));
}
$this->view->title = $this->lang->gogs->common . $this->lang->colon . $this->lang->gogs->lblCreate;
+16 -5
View File
@@ -334,12 +334,23 @@ class installModel extends model
public function setDBParam()
{
$this->config->db->driver = $this->post->dbDriver;
$this->config->db->host = $this->post->dbHost;
if($this->config->inQuickon)
{
$this->config->db->host = getenv('ZT_MYSQL_HOST');
$this->config->db->user = getenv('ZT_MYSQL_USER');
$this->config->db->encoding = 'UTF8';
$this->config->db->password = getenv('ZT_MYSQL_PASSWORD');
$this->config->db->port = getenv('ZT_MYSQL_PORT');
}
else
{
$this->config->db->host = $this->post->dbHost;
$this->config->db->user = $this->post->dbUser;
$this->config->db->encoding = $this->post->dbEncoding;
$this->config->db->password = $this->post->dbPassword;
$this->config->db->port = $this->post->dbPort;
}
$this->config->db->name = $this->post->dbName;
$this->config->db->user = $this->post->dbUser;
$this->config->db->encoding = $this->post->dbEncoding;
$this->config->db->password = $this->post->dbPassword;
$this->config->db->port = $this->post->dbPort;
$this->config->db->prefix = $this->post->dbPrefix;
}
+200
View File
@@ -0,0 +1,200 @@
<?php
declare(strict_types=1);
/**
* The step2 view file of install module of ZenTaoPMS.
* @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
* @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
* @author Mengyi Liu <liumengyi@easycorp.ltd>
* @package install
* @link https://www.zentao.net
*/
namespace zin;
include $this->app->getConfigRoot() . 'timezones.php';
set::zui(true);
div
(
set::id('main'),
div
(
set::id('mainContent'),
panel
(
setClass('py-2'),
set::title($lang->install->setConfig),
form
(
set::submitBtnText($lang->install->next),
set::actions(array('submit')),
h::table
(
setClass('table bordered'),
h::tr
(
h::th
(
width('1/5'),
$lang->install->key
),
h::th($lang->install->value),
h::th(),
),
h::tr
(
h::th($lang->install->timezone),
h::td
(
picker
(
set::name('timezone'),
set::items($timezoneList),
set::value($config->timezone),
),
),
h::td(),
),
h::tr
(
h::th($lang->install->defaultLang),
h::td
(
picker
(
set::name('defaultLang'),
set::items($config->langs),
set::value($app->getClientLang()),
),
),
h::td(),
),
$config->edition != 'open' ? h::tr
(
$config->inQuickon ? setClass('hidden') : null,
h::th($lang->install->dbDriver),
h::td
(
picker
(
set::name('dbDriver'),
set::items($lang->install->dbDriverList),
set::value('mysql'),
),
),
h::td(),
) : input
(
setClass('hidden'),
set::name('dbDriver'),
set::value('mysql'),
),
h::tr
(
$config->inQuickon ? setClass('hidden') : null,
h::th($lang->install->dbHost),
h::td
(
input
(
set::name('dbHost'),
set::value($dbHost),
),
),
h::td($lang->install->dbHostNote),
),
h::tr
(
$config->inQuickon ? setClass('hidden') : null,
h::th($lang->install->dbPort),
h::td
(
input
(
set::name('dbPort'),
set::value($dbPort),
),
),
),
h::tr
(
$config->inQuickon ? setClass('hidden') : null,
h::th($lang->install->dbEncoding),
h::td
(
input
(
set::name('dbEncoding'),
set::value($this->config->db->encoding),
),
),
h::td(),
),
h::tr
(
$config->inQuickon ? setClass('hidden') : null,
h::th($lang->install->dbUser),
h::td
(
input
(
set::name('dbUser'),
set::value($dbUser),
),
),
h::td(),
),
h::tr
(
$config->inQuickon ? setClass('hidden') : null,
h::th($lang->install->dbPassword),
h::td
(
input
(
set::name('dbPassword'),
set::value($dbPassword),
),
),
h::td(),
),
h::tr
(
h::th($lang->install->dbName),
h::td
(
input
(
set::name('dbName'),
set::value($dbName),
),
),
h::td(),
),
h::tr
(
h::th($lang->install->dbPrefix),
h::td
(
input
(
set::name('dbPrefix'),
set::value('zt_'),
),
),
h::td
(
checkbox
(
set::text($lang->install->clearDB),
set::name('clearDB'),
),
),
),
),
),
),
),
);
render('pagebase');
+1 -1
View File
@@ -70,7 +70,7 @@ class jenkins extends control
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $jenkinsID));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('space', 'browse')));
}
$this->view->title = $this->lang->jenkins->common . $this->lang->colon . $this->lang->jenkins->create;
+1 -1
View File
@@ -145,7 +145,7 @@ class sonarqube extends control
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->loadModel('action')->create('sonarqube', $sonarqubeID, 'created');
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse')));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('space', 'browse')));
}
$this->view->title = $this->lang->sonarqube->common . $this->lang->colon . $this->lang->sonarqube->createServer;