mirror of
https://github.com/php-win-ext/php-sdk-binary-tools.git
synced 2026-03-24 17:12:12 +01:00
Compare commits
6 Commits
php-sdk-2.
...
php-sdk-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff33ae5143 | ||
|
|
3cf0f67f27 | ||
|
|
b0a93f01c5 | ||
|
|
e10c86c2d5 | ||
|
|
20ccc545bd | ||
|
|
0be0ba3a84 |
@@ -123,7 +123,7 @@ As of the version 2.1.0, the SDK includes a tool for the [PGO](https://docs.micr
|
||||
- run `nmake clean-pgo`
|
||||
- rebuild PHP `--with-pgo`
|
||||
|
||||
## Adding custom scenario
|
||||
## Adding custom PGO training scenario
|
||||
|
||||
A custom scenario can be used to produce a custom PHP binary dedicated to an arbitrary application.
|
||||
|
||||
@@ -134,6 +134,8 @@ The existing training cases can be found in [pgo/cases](pgo/cases). Assumed the
|
||||
- create `pgo/cases/myapp/nginx.partial.conf` with a partial NGINX template
|
||||
- create `pgo/cases/myapp/TrainingCaseHandler.php` with a class as defined in the [interface](lib/php/libsdk/SDK/Build/PGO/Interfaces/TrainingCase.php)
|
||||
|
||||
After a training case is implemented and put under `pgo/cases`, the work environment needs to be reinitialized. The tool puts all the training data and necessary applications under `pgo/work`. Rename or remove that directory and rerun `phpsdk_pgo --init`.
|
||||
|
||||
To skip a training case, add a file named `inactive` into the case folder.
|
||||
|
||||
|
||||
@@ -146,6 +148,7 @@ To skip a training case, add a file named `inactive` into the case folder.
|
||||
- Tools, based on MSYS2, only accept paths with forward slashes.
|
||||
- Both Visual C++ toolset and the Windows SDK components have to be installed for the PHP SDK to work properly.
|
||||
- The VC++ toolset is still requried, even if another compiler, fe. clang, is intended to be used.
|
||||
- task.exe is not a console application, some systems might not propagate exit code except the batch is explicitly run from `cmd /c`, etc.
|
||||
- `task.exe` is not a console application, some systems might not propagate exit code except the batch is explicitly run from `cmd /c`, etc.
|
||||
- `7za` should be prefered over `unzip` and `zip` for compatibility reasons.
|
||||
|
||||
|
||||
|
||||
@@ -35,11 +35,23 @@ class Fetcher
|
||||
|
||||
/* TODO more robust implementation. */
|
||||
/* TODO implement indicator. */
|
||||
public function getByUri($uri) : string
|
||||
public function getByUri(string $uri, int $retries = 3) : string
|
||||
{/*{{{*/
|
||||
$url = "http://{$this->host}:{$this->port}$uri";
|
||||
$ret = false;
|
||||
|
||||
return $this->download($url);
|
||||
retry:
|
||||
try {
|
||||
$ret = $this->download($url);
|
||||
} catch (Exception $e) {
|
||||
if ($retries > 0) {
|
||||
sleep(1);
|
||||
$retries--;
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}/*}}}*/
|
||||
|
||||
/*protected function fetch($uri) : string
|
||||
|
||||
@@ -13,6 +13,7 @@ class Manager
|
||||
protected $path;
|
||||
protected $series;
|
||||
protected $fetcher;
|
||||
protected $updatesFlag = NULL;
|
||||
|
||||
public function __construct(string $path, string $stability, string $arch)
|
||||
{/*{{{*/
|
||||
@@ -39,7 +40,12 @@ class Manager
|
||||
|
||||
public function updatesAvailable() : bool
|
||||
{/*{{{*/
|
||||
return $this->series->updatesAvailable() || !file_exists(Config::getDepsLocalPath());
|
||||
if (!is_null($this->updatesFlag)) {
|
||||
return $this->updatesFlag;
|
||||
}
|
||||
|
||||
$this->updatesFlag = $this->series->updatesAvailable() || !file_exists(Config::getDepsLocalPath());
|
||||
return $this->updatesFlag;
|
||||
}/*}}}*/
|
||||
|
||||
/* FIXME implement rollback */
|
||||
|
||||
@@ -52,6 +52,7 @@ class Training
|
||||
curl_setopt($ch[$i], CURLOPT_CONNECTTIMEOUT_MS, 500000);
|
||||
curl_setopt($ch[$i], CURLOPT_TIMEOUT_MS, 500000);
|
||||
curl_setopt($ch[$i], CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch[$i], CURLOPT_USERAGENT, SDKConfig::getSdkUserAgentName());
|
||||
/* ??? */
|
||||
/*curl_setopt($ch[$i], CURLOPT_FOLLOWLOCATION, true);*/
|
||||
|
||||
|
||||
@@ -377,6 +377,11 @@ class Config
|
||||
|
||||
return $path;
|
||||
}/*}}}*/
|
||||
|
||||
public static function getSdkUserAgentName() : string
|
||||
{/*{{{*/
|
||||
return "PHP-SDK-BINARY-TOOLS/" . self::getSdkVersion();
|
||||
}/*}}}*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -134,9 +134,13 @@ trait FileOps
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, Config::getSdkUserAgentName());
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
|
||||
$ret = curl_exec($ch);
|
||||
if (false === $ret) {
|
||||
|
||||
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
if (false === $ret || 200 !== $code) {
|
||||
$err = curl_error($ch);
|
||||
curl_close($ch);
|
||||
if ($dest_fn) {
|
||||
|
||||
Reference in New Issue
Block a user