mirror of
https://github.com/php-win-ext/php-sdk-binary-tools.git
synced 2026-03-27 10:32:13 +01:00
Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8aba2baa77 | ||
|
|
6732622355 | ||
|
|
c705dce0c0 | ||
|
|
aa22e335c8 | ||
|
|
52b83f957e | ||
|
|
251cd72e6e | ||
|
|
bdec9f92b9 | ||
|
|
154b63fb2e | ||
|
|
b9530450e2 | ||
|
|
c74c3b5b94 | ||
|
|
53afca7edb | ||
|
|
96d8b2f49a |
@@ -9,7 +9,7 @@ class Config
|
|||||||
/* Config variables. */
|
/* Config variables. */
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected static $depsHost = 'downloads.php.net';
|
protected static $depsHost = 'phpext.phptools.online';
|
||||||
|
|
||||||
/** @var int */
|
/** @var int */
|
||||||
protected static $depsPort = 443;
|
protected static $depsPort = 443;
|
||||||
@@ -18,7 +18,7 @@ class Config
|
|||||||
protected static $depsUriScheme = "https";
|
protected static $depsUriScheme = "https";
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected static $depsBaseUri = "/~windows/php-sdk/deps";
|
protected static $depsBaseUri = "/api/downloadable/download";
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected static $sdkNugetFeedUrl = "http://127.0.0.1/sdk/nuget"; // experimental?
|
protected static $sdkNugetFeedUrl = "http://127.0.0.1/sdk/nuget"; // experimental?
|
||||||
@@ -218,7 +218,7 @@ class Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Try to figure out the branch. The worky scenarios are
|
/* 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
|
- phpize is on the path
|
||||||
FIXME for the dev package, there should be a php-config utility
|
FIXME for the dev package, there should be a php-config utility
|
||||||
*/
|
*/
|
||||||
@@ -256,7 +256,7 @@ class Config
|
|||||||
$cmd = "\"$git\" branch";
|
$cmd = "\"$git\" branch";
|
||||||
|
|
||||||
$ret = trim(shell_exec($cmd));
|
$ret = trim(shell_exec($cmd));
|
||||||
if (preg_match_all(",\*\s+master,", $ret) > 0) {
|
if (preg_match_all(",\*\s+master,", $ret) > 0) {
|
||||||
$branch = "master";
|
$branch = "master";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -271,7 +271,7 @@ class Config
|
|||||||
$branch = self::guessCurrentBranchName();
|
$branch = self::guessCurrentBranchName();
|
||||||
self::setCurrentBranchName($branch);
|
self::setCurrentBranchName($branch);
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$currentBranchName;
|
return self::$currentBranchName;
|
||||||
}/*}}}*/
|
}/*}}}*/
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ class Config
|
|||||||
throw new Exception("Failed to find config with arch '" . self::getCurrentArchName() . "'");
|
throw new Exception("Failed to find config with arch '" . self::getCurrentArchName() . "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}/*}}}*/
|
}/*}}}*/
|
||||||
|
|
||||||
public static function getSdkNugetFeedUrl() : string
|
public static function getSdkNugetFeedUrl() : string
|
||||||
@@ -368,7 +368,7 @@ class Config
|
|||||||
throw new Exception("Couldn't find the SDK version file.");
|
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
|
public static function getDepsLocalPath() : ?string
|
||||||
@@ -391,7 +391,7 @@ class Config
|
|||||||
self::setDepsLocalPath($tmp);
|
self::setDepsLocalPath($tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == self::$depsLocalPath) {
|
if (NULL == self::$depsLocalPath) {
|
||||||
$tmp = realpath("../deps");
|
$tmp = realpath("../deps");
|
||||||
if (is_dir($tmp)) {
|
if (is_dir($tmp)) {
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ trait FileOps
|
|||||||
throw new Exception("Unable to $cb '$src_path' to '$dst_path'");
|
throw new Exception("Unable to $cb '$src_path' to '$dst_path'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -122,26 +122,40 @@ trait FileOps
|
|||||||
retry:
|
retry:
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
|
|
||||||
|
echo "CALL $url \n";
|
||||||
|
|
||||||
curl_setopt($ch, CURLOPT_URL, $url);
|
curl_setopt($ch, CURLOPT_URL, $url);
|
||||||
|
|
||||||
if ($dest_fn) {
|
if ($dest_fn) {
|
||||||
$fd = fopen($dest_fn, "w+");
|
$fd = fopen($dest_fn, "w+");
|
||||||
curl_setopt($ch, CURLOPT_FILE, $fd);
|
curl_setopt($ch, CURLOPT_FILE, $fd);
|
||||||
} else {
|
} else {
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
curl_setopt($ch, CURLOPT_HEADER, false);
|
curl_setopt($ch, CURLOPT_HEADER, true);
|
||||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
curl_setopt($ch, CURLOPT_USERAGENT, Config::getSdkUserAgentName());
|
|
||||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||||
|
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
||||||
|
|
||||||
|
$token = getenv('API_TOKEN');
|
||||||
|
if (!empty($token)) {
|
||||||
|
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, Config::getSdkUserAgentName());
|
||||||
|
|
||||||
|
echo "curl_error=". curl_error($ch) ."\n";
|
||||||
|
|
||||||
|
|
||||||
// workaround for <https://github.com/microsoft/php-sdk-binary-tools/issues/69>
|
// workaround for <https://github.com/microsoft/php-sdk-binary-tools/issues/69>
|
||||||
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
||||||
|
|
||||||
$ret = curl_exec($ch);
|
$ret = curl_exec($ch);
|
||||||
|
var_dump($ret);
|
||||||
|
|
||||||
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
if (false === $ret || 200 !== $code) {
|
if (false === $ret || 200 !== $code) {
|
||||||
|
|||||||
Reference in New Issue
Block a user