Compare commits

...

6 Commits

Author SHA1 Message Date
Anatol Belski
ff33ae5143 Prepare 2.1.1 2018-02-20 15:32:09 +01:00
Anatol Belski
3cf0f67f27 More robust network error handling 2018-02-20 14:37:15 +01:00
Anatol Belski
b0a93f01c5 Send user agent when fetching 2018-02-20 10:34:30 +01:00
Anatol Belski
e10c86c2d5 Avoid fetching series more than once in the same run 2018-02-20 09:31:08 +01:00
Anatol Belski
20ccc545bd Further notes on custom training case implementation 2018-02-02 17:03:02 +01:00
Anatol Belski
0be0ba3a84 Back to dev 2018-02-02 13:55:54 +01:00
7 changed files with 38 additions and 7 deletions

View File

@@ -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.

View File

@@ -1 +1 @@
2.1.0
2.1.1

View File

@@ -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

View File

@@ -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 */

View File

@@ -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);*/

View File

@@ -377,6 +377,11 @@ class Config
return $path;
}/*}}}*/
public static function getSdkUserAgentName() : string
{/*{{{*/
return "PHP-SDK-BINARY-TOOLS/" . self::getSdkVersion();
}/*}}}*/
}
/*

View File

@@ -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) {