no message
This commit is contained in:
parent
32947a08ca
commit
762fce8c01
@ -11,6 +11,7 @@ class CronController
|
|||||||
|
|
||||||
private $sUserName;
|
private $sUserName;
|
||||||
private $sProjectName;
|
private $sProjectName;
|
||||||
|
private $sHostName;
|
||||||
|
|
||||||
private $sProjectPath;
|
private $sProjectPath;
|
||||||
private $sProjectUrl;
|
private $sProjectUrl;
|
||||||
@ -85,8 +86,9 @@ class CronController
|
|||||||
foreach ($aArticle as $row) {
|
foreach ($aArticle as $row) {
|
||||||
$this->sUserName = $row["user_name"];
|
$this->sUserName = $row["user_name"];
|
||||||
$this->sProjectName = $row["project_name"];
|
$this->sProjectName = $row["project_name"];
|
||||||
$this->sProjectPath = env("BASE_DIR")."github/".$this->sUserName."-".$this->sProjectName;
|
$this->sHostName = $row['host_name'];
|
||||||
$this->sProjectUrl = env("github_url_base").":".$this->sUserName."/".$this->sProjectName.".git";
|
$this->sProjectPath = env("BASE_DIR")."github/".$this->sHostName."-".$this->sProjectName;
|
||||||
|
$this->sProjectUrl = env("github_url_base").":".$this->sHostName."/".$this->sProjectName.".git";
|
||||||
$this->aArticle = $row;
|
$this->aArticle = $row;
|
||||||
|
|
||||||
list($sClass, $sFunc) = explode('#', $row['mod']);
|
list($sClass, $sFunc) = explode('#', $row['mod']);
|
||||||
@ -113,6 +115,8 @@ class CronController
|
|||||||
|
|
||||||
$this->gitInit();
|
$this->gitInit();
|
||||||
|
|
||||||
|
$this->sshConfigAdd();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 写入内容
|
// 写入内容
|
||||||
@ -128,6 +132,39 @@ class CronController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function sshConfigAdd()
|
||||||
|
{
|
||||||
|
|
||||||
|
// 定义要添加的配置
|
||||||
|
$host = $this->sHostName;
|
||||||
|
$hostname = "github.com";
|
||||||
|
$user = "git";
|
||||||
|
$identityFile = env("path_ssh")."/id_rsa_".$sHostName;
|
||||||
|
|
||||||
|
// 构建配置字符串
|
||||||
|
$config = "\nHost ".$host.".com\n";
|
||||||
|
$config .= "\tHostName $hostname\n";
|
||||||
|
$config .= "\tUser $user\n";
|
||||||
|
$config .= "\tIdentityFile $identityFile\n";
|
||||||
|
|
||||||
|
// 指定 SSH 配置文件路径
|
||||||
|
$sshConfigFile = env("path_ssh")."/config";
|
||||||
|
|
||||||
|
// 检查文件是否存在,如果不存在则创建
|
||||||
|
if (!file_exists($sshConfigFile)) {
|
||||||
|
touch($sshConfigFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 追加配置到文件
|
||||||
|
file_put_contents($sshConfigFile, $config, FILE_APPEND | LOCK_EX);
|
||||||
|
|
||||||
|
// 设置文件权限
|
||||||
|
chmod($sshConfigFile, 0600);
|
||||||
|
|
||||||
|
echo "SSH config updated successfully.";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private function formatstr($str)
|
private function formatstr($str)
|
||||||
{
|
{
|
||||||
$str = substr($str, 1, -1);
|
$str = substr($str, 1, -1);
|
||||||
|
|||||||
@ -10,8 +10,41 @@ use App\Services\TomTool\Http;
|
|||||||
class TestsController
|
class TestsController
|
||||||
{
|
{
|
||||||
|
|
||||||
public function hook()
|
public function hook($sHostName = 'ssssss')
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// 定义要添加的配置
|
||||||
|
$host = $sHostName;
|
||||||
|
$hostname = "github.com";
|
||||||
|
$user = "git";
|
||||||
|
$identityFile = env("path_ssh")."/id_rsa_".$sHostName;
|
||||||
|
|
||||||
|
// 构建配置字符串
|
||||||
|
$config = "\nHost ".$host.".com\n";
|
||||||
|
$config .= "\tHostName $hostname\n";
|
||||||
|
$config .= "\tUser $user\n";
|
||||||
|
$config .= "\tIdentityFile $identityFile\n";
|
||||||
|
|
||||||
|
// 指定 SSH 配置文件路径
|
||||||
|
$sshConfigFile = env("path_ssh")."/config";
|
||||||
|
|
||||||
|
// 检查文件是否存在,如果不存在则创建
|
||||||
|
if (!file_exists($sshConfigFile)) {
|
||||||
|
touch($sshConfigFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 追加配置到文件
|
||||||
|
file_put_contents($sshConfigFile, $config, FILE_APPEND | LOCK_EX);
|
||||||
|
|
||||||
|
// 设置文件权限
|
||||||
|
chmod($sshConfigFile, 0600);
|
||||||
|
|
||||||
|
echo "SSH config updated successfully.";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
exit;
|
||||||
// $t = [];
|
// $t = [];
|
||||||
// $a = $t['zz']["cc"] += 10;
|
// $a = $t['zz']["cc"] += 10;
|
||||||
// $a = $t['zz']["cc"] += 10;
|
// $a = $t['zz']["cc"] += 10;
|
||||||
|
|||||||
@ -4,10 +4,6 @@ use App\Services\TomTool\Http;
|
|||||||
|
|
||||||
class JichangTuijian {
|
class JichangTuijian {
|
||||||
|
|
||||||
public $sTitle; // 必须
|
|
||||||
public $sContent; // 必须
|
|
||||||
public $sSubTitle; // 非必须
|
|
||||||
|
|
||||||
public function A($aArticle)
|
public function A($aArticle)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user