fix aliyun FC platform

pull/525/head
qkqpttgf 2022-01-27 14:50:09 +08:00 committed by GitHub
parent dc462d8e64
commit 95c6657dc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -11,13 +11,13 @@ date_default_timezone_set('UTC');
if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') { if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/TencentSCF_file.php'; if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/TencentSCF_file.php';
else include 'platform/TencentSCF_env.php'; else include 'platform/TencentSCF_env.php';
} elseif (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') { } elseif (isset($_SERVER['FC_RUNTIME_API'])) {
include 'platform/AliyunFC.php'; include 'platform/AliyunFC.php';
} elseif ($_SERVER['_APP_SHARE_DIR']=='/var/share/CFF/processrouter') { } elseif (isset($_SERVER['_APP_SHARE_DIR']) && $_SERVER['_APP_SHARE_DIR']=='/var/share/CFF/processrouter') {
//if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/HuaweiFG_file.php'; //if (getenv('ONEMANAGER_CONFIG_SAVE')=='file') include 'platform/HuaweiFG_file.php';
//else include 'platform/HuaweiFG_env.php'; //else include 'platform/HuaweiFG_env.php';
echo 'FG' . PHP_EOL; echo 'FG' . PHP_EOL;
} elseif ($_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') { } elseif (isset($_SERVER['BCE_CFC_RUNTIME_NAME']) && $_SERVER['BCE_CFC_RUNTIME_NAME']=='php7') {
include 'platform/BaiduCFC.php'; include 'platform/BaiduCFC.php';
} elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') { } elseif (isset($_SERVER['HEROKU_APP_DIR'])&&$_SERVER['HEROKU_APP_DIR']==='/app') {
include 'platform/Heroku.php'; include 'platform/Heroku.php';
@ -106,7 +106,7 @@ function main_handler($event, $context)
// Aliyun FC & Huawei FG & Baidu CFC // Aliyun FC & Huawei FG & Baidu CFC
function handler($event, $context) function handler($event, $context)
{ {
if (isset($_SERVER['FC_SERVER_PATH'])&&$_SERVER['FC_SERVER_PATH']==='/var/fc/runtime/php7.2') { if (isset($_SERVER['FC_RUNTIME_API'])) {
// Aliyun FC // Aliyun FC
set_error_handler("myErrorHandler"); set_error_handler("myErrorHandler");
$tmp = array( $tmp = array(
@ -120,6 +120,7 @@ function handler($event, $context)
); );
$event = $tmp; $event = $tmp;
$context = json_decode(json_encode($context), true); $context = json_decode(json_encode($context), true);
$context['FC_RUNTIME_API'] = $_SERVER['FC_RUNTIME_API'];
printInput($event, $context); printInput($event, $context);
unset($_POST); unset($_POST);
unset($_GET); unset($_GET);
@ -130,7 +131,7 @@ function handler($event, $context)
$re = main($path); $re = main($path);
return new RingCentral\Psr7\Response($re['statusCode'], $re['headers'], $re['isBase64Encoded']?base64_decode($re['body']):$re['body']); return new RingCentral\Psr7\Response($re['statusCode'], $re['headers'], ($re['isBase64Encoded']?base64_decode($re['body']):$re['body']));
} elseif ($_SERVER['_APP_SHARE_DIR']=='/var/share/CFF/processrouter') { } elseif ($_SERVER['_APP_SHARE_DIR']=='/var/share/CFF/processrouter') {
// Huawei FG // Huawei FG