|
@@ -34,9 +34,32 @@ function getGoPeedPath(){
|
|
function get7ZipPath(){
|
|
function get7ZipPath(){
|
|
return dirname(dirname(__FILE__)). "/bin/7z.exe";
|
|
return dirname(dirname(__FILE__)). "/bin/7z.exe";
|
|
}
|
|
}
|
|
|
|
+//两个参数的路径拼接
|
|
|
|
+function twoPathJoin($base, $path) {
|
|
|
|
+ return rtrim( $base, '/' ) . '/' . ltrim( $path, '/' );
|
|
|
|
+}
|
|
|
|
+//不定参数路径拼接
|
|
|
|
+function pathJoin($base, $path) {
|
|
|
|
+ $newPath = twoPathJoin($base, $path);
|
|
|
|
+ $args = func_get_args();
|
|
|
|
+ $argc = func_num_args();
|
|
|
|
+ for($i=2;$i<$argc;$i++){
|
|
|
|
+ $newPath = twoPathJoin($newPath,$args[$i]);
|
|
|
|
+ }
|
|
|
|
+ return $newPath;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//获取部署配置文件
|
|
|
|
+function getDistributeConfigPath($vendorDir){
|
|
|
|
+ return pathJoin(dirname($vendorDir),'.distribute/config.json')
|
|
|
|
+}
|
|
|
|
+//解析部署配置文件
|
|
|
|
+function parseDistributeConfig(){
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
|
|
//多线程下载文件
|
|
//多线程下载文件
|
|
-function downloadToDir($ossUrl,$repoName,$fileName,$targetDir){
|
|
|
|
|
|
+function downloadToDir($ossHost,$repoName,$fileName,$targetDir){
|
|
if (!file_exists($targetDir))
|
|
if (!file_exists($targetDir))
|
|
mkdir($targetDir,0777,true);
|
|
mkdir($targetDir,0777,true);
|
|
|
|
|
|
@@ -46,7 +69,7 @@ function downloadToDir($ossUrl,$repoName,$fileName,$targetDir){
|
|
}
|
|
}
|
|
$gopeed = getGoPeedPath();
|
|
$gopeed = getGoPeedPath();
|
|
|
|
|
|
- $remoteUrl = pathJoin($ossUrl,$repoName,$fileName);
|
|
|
|
|
|
+ $remoteUrl = pathJoin($ossHost,$repoName,$fileName);
|
|
$cmd = $gopeed." -D=" . $targetDir . " " . $remoteUrl;
|
|
$cmd = $gopeed." -D=" . $targetDir . " " . $remoteUrl;
|
|
system($cmd, $ret);
|
|
system($cmd, $ret);
|
|
if ($ret != 0) {
|
|
if ($ret != 0) {
|
|
@@ -81,18 +104,7 @@ function unzipFile($zipFile, $targetDir){
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
-function twoPathJoin($base, $path) {
|
|
|
|
- return rtrim( $base, '/' ) . '/' . ltrim( $path, '/' );
|
|
|
|
-}
|
|
|
|
-function pathJoin($base, $path) {
|
|
|
|
- $newPath = twoPathJoin($base, $path);
|
|
|
|
- $args = func_get_args();
|
|
|
|
- $argc = func_num_args();
|
|
|
|
- for($i=2;$i<$argc;$i++){
|
|
|
|
- $newPath = twoPathJoin($newPath,$args[$i]);
|
|
|
|
- }
|
|
|
|
- return $newPath;
|
|
|
|
-}
|
|
|
|
|
|
+
|
|
//过滤得到一个最终文件列表
|
|
//过滤得到一个最终文件列表
|
|
function filterFiles($files){
|
|
function filterFiles($files){
|
|
if(!is_array($files) )
|
|
if(!is_array($files) )
|