add git source: HIT
							parent
							
								
									65d57a5d24
								
							
						
					
					
						commit
						3504685172
					
				|  | @ -378,29 +378,24 @@ function setConfigResponse($response) | ||||||
|     return json_decode( $response, true ); |     return json_decode( $response, true ); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master') | function OnekeyUpate($GitSource = 'Github', $auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master') | ||||||
| { | { | ||||||
|     $source = '/tmp/code.zip'; |     $source = '/tmp/code.zip'; | ||||||
|     $outPath = '/tmp/'; |     $outPath = '/tmp/'; | ||||||
| 
 | 
 | ||||||
|     // 从github下载对应tar.gz,并解压
 |     if ($GitSource=='Github') { | ||||||
|     $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/'; |         // 从github下载对应tar.gz,并解压
 | ||||||
|  |         $url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/'; | ||||||
|  |     } elseif ($GitSource=='HITGitlab') { | ||||||
|  |         $url = 'https://git.hit.edu.cn/' . $auth . '/' . $project . '/-/archive/' . urlencode($branch) . '/' . $project . '-' . urlencode($branch) . '.tar.gz'; | ||||||
|  |     } else return json_encode(['FunctionBrn'=>$_SERVER['functionBrn'], 'code'=>'Git Source input Error!']); | ||||||
|     $tarfile = '/tmp/github.tar.gz'; |     $tarfile = '/tmp/github.tar.gz'; | ||||||
|     file_put_contents($tarfile, file_get_contents($url)); |     file_put_contents($tarfile, file_get_contents($url)); | ||||||
|     $phar = new PharData($tarfile); |     $phar = new PharData($tarfile); | ||||||
|     $html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
 |     $html = $phar->extractTo($outPath, null, true);//路径 要解压的文件 是否覆盖
 | ||||||
| 
 | 
 | ||||||
|     // 获取包中目录名
 |     // 获取解压出的目录名
 | ||||||
|     $tmp = scandir('phar://'.$tarfile); |     $outPath = findIndexPath($outPath); | ||||||
|     $name = $auth.'-'.$project; |  | ||||||
|     foreach ($tmp as $f) { |  | ||||||
|         if ( substr($f, 0, strlen($name)) == $name) { |  | ||||||
|             $outPath .= $f; |  | ||||||
|             break; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|     // 放入配置文件
 |  | ||||||
|     //file_put_contents($outPath . '/config.php', file_get_contents(__DIR__.'/../config.php'));
 |  | ||||||
| 
 | 
 | ||||||
|     // 将目录中文件打包成zip
 |     // 将目录中文件打包成zip
 | ||||||
|     //$zip=new ZipArchive();
 |     //$zip=new ZipArchive();
 | ||||||
|  | @ -432,7 +427,7 @@ function addFileToZip($zip, $rootpath, $path = '') | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     @closedir($path); |     @closedir($handler); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function WaitFunction() { | function WaitFunction() { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 qkqpttgf
						qkqpttgf