Update alifc.php

pull/73/head
qkqpttgf 2020-06-03 18:24:52 +08:00 committed by GitHub
parent 3259eb1db2
commit b1acd58924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 9 deletions

View File

@ -230,14 +230,13 @@ function getfunctioninfo($accountId, $region, $service_name, $function_name, $Ac
function updateEnvironment($Envs, $accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret) function updateEnvironment($Envs, $accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret)
{ {
//print_r($Envs); //print_r($Envs);
//WaitSCFStat();
$fcClient = new Client([ $fcClient = new Client([
"endpoint" => 'https://'.$accountId.'.'.$region.'.fc.aliyuncs.com', "endpoint" => 'https://'.$accountId.'.'.$region.'.fc.aliyuncs.com',
"accessKeyID" => $AccessKeyID, "accessKeyID" => $AccessKeyID,
"accessKeySecret" => $AccessKeySecret "accessKeySecret" => $AccessKeySecret
]); ]);
$tmp = $fcClient->getFunction($service_name, $function_name)['data'];
$tmp = getfunctioninfo($accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret)['data']; //$tmp = getfunctioninfo($accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret)['data'];
foreach ($tmp['environmentVariables'] as $key => $value ) { foreach ($tmp['environmentVariables'] as $key => $value ) {
$tmp_env[$key] = $value; $tmp_env[$key] = $value;
} }
@ -266,9 +265,8 @@ function SetbaseConfig($Envs, $accountId, $region, $service_name, $function_name
"accessKeyID" => $AccessKeyID, "accessKeyID" => $AccessKeyID,
"accessKeySecret" => $AccessKeySecret "accessKeySecret" => $AccessKeySecret
]); ]);
//return $fcClient->getFunction($service_name, $function_name); $tmp = $fcClient->getFunction($service_name, $function_name)['data'];
// $tmp = getfunctioninfo($accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret)['data'];
$tmp = getfunctioninfo($accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret)['data'];
foreach ($tmp['environmentVariables'] as $key => $value ) { foreach ($tmp['environmentVariables'] as $key => $value ) {
$tmp_env[$key] = $value; $tmp_env[$key] = $value;
} }
@ -297,8 +295,8 @@ function updateProgram($accountId, $region, $service_name, $function_name, $Acce
"accessKeyID" => $AccessKeyID, "accessKeyID" => $AccessKeyID,
"accessKeySecret" => $AccessKeySecret "accessKeySecret" => $AccessKeySecret
]); ]);
$tmp = $fcClient->getFunction($service_name, $function_name)['data'];
$tmp = getfunctioninfo($accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret)['data']; //$tmp = getfunctioninfo($accountId, $region, $service_name, $function_name, $AccessKeyID, $AccessKeySecret)['data'];
$tmpdata['functionName'] = $tmp['functionName']; $tmpdata['functionName'] = $tmp['functionName'];
$tmpdata['description'] = $tmp['description']; $tmpdata['description'] = $tmp['description'];
@ -382,7 +380,7 @@ function addFileToZip($zip, $rootpath, $path = '')
if (substr($rootpath,-1)=='/') $rootpath = substr($rootpath, 0, -1); if (substr($rootpath,-1)=='/') $rootpath = substr($rootpath, 0, -1);
if (substr($path,0,1)=='/') $path = substr($path, 1); if (substr($path,0,1)=='/') $path = substr($path, 1);
$handler=opendir(path_format($rootpath.'/'.$path)); //打开当前文件夹由$path指定。 $handler=opendir(path_format($rootpath.'/'.$path)); //打开当前文件夹由$path指定。
while(($filename=readdir($handler))){ while($filename=readdir($handler)){
if($filename != "." && $filename != ".."){//文件夹文件名字为'.'和‘..’,不要对他们进行操作 if($filename != "." && $filename != ".."){//文件夹文件名字为'.'和‘..’,不要对他们进行操作
$nowname = path_format($rootpath.'/'.$path."/".$filename); $nowname = path_format($rootpath.'/'.$path."/".$filename);
if(is_dir($nowname)){// 如果读取的某个对象是文件夹,则递归 if(is_dir($nowname)){// 如果读取的某个对象是文件夹,则递归