|
@@ -3,7 +3,6 @@
|
|
function defaultConfig(){
|
|
function defaultConfig(){
|
|
return array(
|
|
return array(
|
|
'distribute-mode' => 'install',
|
|
'distribute-mode' => 'install',
|
|
- 'cache-dir' => 'd:/dist-cache/',
|
|
|
|
'tool-dir' => '',
|
|
'tool-dir' => '',
|
|
//'oss-host' => 'http://sis31-disthelp.oss-cn-hangzhou.aliyuncs.com',
|
|
//'oss-host' => 'http://sis31-disthelp.oss-cn-hangzhou.aliyuncs.com',
|
|
'oss-host' => 'http://192.168.3.10:8996',
|
|
'oss-host' => 'http://192.168.3.10:8996',
|
|
@@ -43,6 +42,20 @@ function getOsName(){
|
|
return "linux";
|
|
return "linux";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+//获取当前缓存目录
|
|
|
|
+function getCacheDir(){
|
|
|
|
+ $os = getOsName();
|
|
|
|
+ if( $os == 'win'){
|
|
|
|
+ $path = __FILE__;
|
|
|
|
+ $disk = substr($path,0,2);
|
|
|
|
+ return $disk . '/$DIST.CACHE';
|
|
|
|
+ }
|
|
|
|
+ else{
|
|
|
|
+ return '/tmp/distcache';
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
//判断是否键值对类型的数组
|
|
//判断是否键值对类型的数组
|
|
function isAssocArray($array){
|
|
function isAssocArray($array){
|
|
if(! is_array($array) )
|
|
if(! is_array($array) )
|
|
@@ -232,13 +245,10 @@ function loadConfig($cfgPath){
|
|
logError("distribute-mode node not exists");
|
|
logError("distribute-mode node not exists");
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- if(! $config['cache-dir'] ){
|
|
|
|
- logError("cache-dir node not exists");
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
return $config;
|
|
return $config;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
//多线程下载文件
|
|
//多线程下载文件
|
|
function downloadToDir($toolDir,$ossHost,$repoName,$fileName,$targetDir){
|
|
function downloadToDir($toolDir,$ossHost,$repoName,$fileName,$targetDir){
|
|
if (!file_exists($targetDir)){
|
|
if (!file_exists($targetDir)){
|