From 8e3a165d60728e48798a00d4e9c2010f3152de9f Mon Sep 17 00:00:00 2001 From: root Date: Sun, 17 Jan 2021 22:05:49 +0800 Subject: [PATCH] try fix: tag with same string replaced in renaming tag --- platform/AliyunFC.php | 7 ++++++- platform/BaiduCFC.php | 7 ++++++- platform/Heroku.php | 7 ++++++- platform/HuaweiFG_env.php | 7 ++++++- platform/HuaweiFG_file.php | 7 ++++++- platform/Normal.php | 7 ++++++- platform/TencentSCF_env.php | 7 ++++++- platform/TencentSCF_file.php | 7 ++++++- 8 files changed, 48 insertions(+), 8 deletions(-) diff --git a/platform/AliyunFC.php b/platform/AliyunFC.php index dd14235..107f639 100644 --- a/platform/AliyunFC.php +++ b/platform/AliyunFC.php @@ -110,7 +110,12 @@ function setConfig($arr, $disktag = '') } if ($operatedisk) { if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') { - $tmp['disktag'] = str_replace($arr['disktag_rename'], $arr['disktag_newname'], getConfig('disktag')); + $tags = []; + foreach ($disktags as $tag) { + if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']); + else array_push($tags, $tag); + } + $tmp['disktag'] = implode('|', $tags); $tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']); $tmp[$arr['disktag_rename']] = ''; } else { diff --git a/platform/BaiduCFC.php b/platform/BaiduCFC.php index 205e651..6fc80b9 100644 --- a/platform/BaiduCFC.php +++ b/platform/BaiduCFC.php @@ -100,7 +100,12 @@ function setConfig($arr, $disktag = '') } if ($operatedisk) { if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') { - $tmp['disktag'] = str_replace($arr['disktag_rename'], $arr['disktag_newname'], getConfig('disktag')); + $tags = []; + foreach ($disktags as $tag) { + if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']); + else array_push($tags, $tag); + } + $tmp['disktag'] = implode('|', $tags); $tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']); $tmp[$arr['disktag_rename']] = ''; } else { diff --git a/platform/Heroku.php b/platform/Heroku.php index 6705211..1a42c44 100644 --- a/platform/Heroku.php +++ b/platform/Heroku.php @@ -106,7 +106,12 @@ function setConfig($arr, $disktag = '') } if ($operatedisk) { if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') { - $tmp['disktag'] = str_replace($arr['disktag_rename'], $arr['disktag_newname'], getConfig('disktag')); + $tags = []; + foreach ($disktags as $tag) { + if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']); + else array_push($tags, $tag); + } + $tmp['disktag'] = implode('|', $tags); $tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']); $tmp[$arr['disktag_rename']] = null; } else { diff --git a/platform/HuaweiFG_env.php b/platform/HuaweiFG_env.php index b2632af..0c52327 100644 --- a/platform/HuaweiFG_env.php +++ b/platform/HuaweiFG_env.php @@ -124,7 +124,12 @@ function setConfig($arr, $disktag = '') } if ($operatedisk) { if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') { - $tmp['disktag'] = str_replace($arr['disktag_rename'], $arr['disktag_newname'], getConfig('disktag')); + $tags = []; + foreach ($disktags as $tag) { + if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']); + else array_push($tags, $tag); + } + $tmp['disktag'] = implode('|', $tags); $tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']); $tmp[$arr['disktag_rename']] = ''; } else { diff --git a/platform/HuaweiFG_file.php b/platform/HuaweiFG_file.php index a428491..3b76df7 100644 --- a/platform/HuaweiFG_file.php +++ b/platform/HuaweiFG_file.php @@ -138,7 +138,12 @@ function setConfig($arr, $disktag = '') } if ($operatedisk) { if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') { - $envs['disktag'] = str_replace($arr['disktag_rename'], $arr['disktag_newname'], getConfig('disktag')); + $tags = []; + foreach ($disktags as $tag) { + if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']); + else array_push($tags, $tag); + } + $envs['disktag'] = implode('|', $tags); $envs[$arr['disktag_newname']] = $envs[$arr['disktag_rename']]; $envs[$arr['disktag_rename']] = ''; } else { diff --git a/platform/Normal.php b/platform/Normal.php index 9d46284..a1d94ad 100644 --- a/platform/Normal.php +++ b/platform/Normal.php @@ -120,7 +120,12 @@ function setConfig($arr, $disktag = '') } if ($operatedisk) { if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') { - $envs['disktag'] = str_replace($arr['disktag_rename'], $arr['disktag_newname'], getConfig('disktag')); + $tags = []; + foreach ($disktags as $tag) { + if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']); + else array_push($tags, $tag); + } + $envs['disktag'] = implode('|', $tags); $envs[$arr['disktag_newname']] = $envs[$arr['disktag_rename']]; unset($envs[$arr['disktag_rename']]); } else { diff --git a/platform/TencentSCF_env.php b/platform/TencentSCF_env.php index f0006f0..d3fb3af 100644 --- a/platform/TencentSCF_env.php +++ b/platform/TencentSCF_env.php @@ -107,7 +107,12 @@ function setConfig($arr, $disktag = '') } if ($operatedisk) { if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') { - $tmp['disktag'] = str_replace($arr['disktag_rename'], $arr['disktag_newname'], getConfig('disktag')); + $tags = []; + foreach ($disktags as $tag) { + if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']); + else array_push($tags, $tag); + } + $tmp['disktag'] = implode('|', $tags); $tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']); $tmp[$arr['disktag_rename']] = ''; } else { diff --git a/platform/TencentSCF_file.php b/platform/TencentSCF_file.php index a13071b..762e33d 100644 --- a/platform/TencentSCF_file.php +++ b/platform/TencentSCF_file.php @@ -119,7 +119,12 @@ function setConfig($arr, $disktag = '') } if ($operatedisk) { if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') { - $envs['disktag'] = str_replace($arr['disktag_rename'], $arr['disktag_newname'], getConfig('disktag')); + $tags = []; + foreach ($disktags as $tag) { + if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']); + else array_push($tags, $tag); + } + $envs['disktag'] = implode('|', $tags); $envs[$arr['disktag_newname']] = $envs[$arr['disktag_rename']]; $envs[$arr['disktag_rename']] = ''; } else {