From 8aba2baa771dbc78a0763fdfbdf742c160420653 Mon Sep 17 00:00:00 2001 From: macintoshplus <814683+macintoshplus@users.noreply.github.com> Date: Wed, 13 Nov 2024 22:07:58 +0100 Subject: [PATCH] restore user agent after fix the content --- lib/php/libsdk/SDK/Config.php | 12 ++++++------ lib/php/libsdk/SDK/FileOps.php | 9 ++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/php/libsdk/SDK/Config.php b/lib/php/libsdk/SDK/Config.php index 723444c..7e7a5c5 100644 --- a/lib/php/libsdk/SDK/Config.php +++ b/lib/php/libsdk/SDK/Config.php @@ -218,7 +218,7 @@ class Config } /* Try to figure out the branch. The worky scenarios are - - CWD is in php-src + - CWD is in php-src - phpize is on the path FIXME for the dev package, there should be a php-config utility */ @@ -256,7 +256,7 @@ class Config $cmd = "\"$git\" branch"; $ret = trim(shell_exec($cmd)); - if (preg_match_all(",\*\s+master,", $ret) > 0) { + if (preg_match_all(",\*\s+master,", $ret) > 0) { $branch = "master"; } } @@ -271,7 +271,7 @@ class Config $branch = self::guessCurrentBranchName(); self::setCurrentBranchName($branch); } - + return self::$currentBranchName; }/*}}}*/ @@ -336,7 +336,7 @@ class Config throw new Exception("Failed to find config with arch '" . self::getCurrentArchName() . "'"); } - return $ret; + return $ret; }/*}}}*/ public static function getSdkNugetFeedUrl() : string @@ -368,7 +368,7 @@ class Config throw new Exception("Couldn't find the SDK version file."); } - return file_get_contents($path); + return trim(file_get_contents($path)); }/*}}}*/ public static function getDepsLocalPath() : ?string @@ -391,7 +391,7 @@ class Config self::setDepsLocalPath($tmp); } } - + if (NULL == self::$depsLocalPath) { $tmp = realpath("../deps"); if (is_dir($tmp)) { diff --git a/lib/php/libsdk/SDK/FileOps.php b/lib/php/libsdk/SDK/FileOps.php index 91911e0..b215814 100644 --- a/lib/php/libsdk/SDK/FileOps.php +++ b/lib/php/libsdk/SDK/FileOps.php @@ -94,7 +94,7 @@ trait FileOps throw new Exception("Unable to $cb '$src_path' to '$dst_path'"); } } - + } return true; @@ -128,7 +128,7 @@ retry: if ($dest_fn) { $fd = fopen($dest_fn, "w+"); - curl_setopt($ch, CURLOPT_FILE, $fd); + curl_setopt($ch, CURLOPT_FILE, $fd); } else { curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); } @@ -145,9 +145,8 @@ retry: echo "**** define authorization header ! ****\n"; var_dump(curl_setopt($ch, CURLOPT_HTTPHEADER, ['Accept: text/plain','X-custom-header: top1','Authorization: Bearer '.$token])); } - - curl_setopt($ch, CURLOPT_USERAGENT, 'PHP-SDK-BINARY-TOOLS'); - //curl_setopt($ch, CURLOPT_USERAGENT, Config::getSdkUserAgentName()); + + curl_setopt($ch, CURLOPT_USERAGENT, Config::getSdkUserAgentName()); echo "curl_error=". curl_error($ch) ."\n";