mirror of
https://github.com/php-win-ext/php-sdk-binary-tools.git
synced 2026-03-24 17:12:12 +01:00
Compare commits
1 Commits
php-sdk-2.
...
php-sdk-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e55b13cce9 |
@@ -12,7 +12,7 @@ The PHP SDK 2.0+ is compatible with PHP 7.0 and above. The compatibility with [o
|
||||
|
||||
# Requirements
|
||||
|
||||
- `Visual C++ 2015` or `Visual C++ 2017` must be installed prior SDK usage (be sure to install both the C++ and the Windows SDK components)
|
||||
- `Visual C++ 2015` or `Visual C++ 2017` must be installed prior SDK usage
|
||||
- if `Cygwin` is installed, please read notes in the pitfalls section
|
||||
- if a 64-bit build is intended, a 64-bit system is required. Cross compilation of 64-bit on 32-bit system is not supported at the moment
|
||||
- The PHP SDK was successfully tested on Windows 7 or later, earlier versions might work but are not recommended
|
||||
@@ -138,10 +138,6 @@ After a training case is implemented and put under `pgo/cases`, the work environ
|
||||
|
||||
To skip a training case, add a file named `inactive` into the case folder.
|
||||
|
||||
# Support
|
||||
|
||||
- Join `#winphp-dev` on Freenode to discuss any ideas or questions
|
||||
- File an issue on GitHub
|
||||
|
||||
# Pitfalls
|
||||
|
||||
|
||||
BIN
bin/7za.dll
BIN
bin/7za.dll
Binary file not shown.
BIN
bin/7za.exe
BIN
bin/7za.exe
Binary file not shown.
BIN
bin/7zxa.dll
BIN
bin/7zxa.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/php/php.exe
BIN
bin/php/php.exe
Binary file not shown.
BIN
bin/php/php7.dll
BIN
bin/php/php7.dll
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
include __DIR__ . "/../lib/php/autoload.php";
|
||||
include dirname(__FILE__) . "/../lib/php/autoload.php";
|
||||
|
||||
use SDK\{Config, Exception};
|
||||
|
||||
@@ -36,7 +36,7 @@ try {
|
||||
switch ($name) {
|
||||
default:
|
||||
throw new Exception("Unknown switch '$name'");
|
||||
break;
|
||||
break;
|
||||
|
||||
case "h":
|
||||
case "help":
|
||||
|
||||
@@ -29,10 +29,10 @@ $flags = 0;
|
||||
$opt = getopt($sopt, $lopt);
|
||||
foreach ($opt as $name => $val) {
|
||||
switch ($name) {
|
||||
case "p":
|
||||
case "pretty":
|
||||
$flags = JSON_PRETTY_PRINT;
|
||||
break;
|
||||
case "p":
|
||||
case "pretty":
|
||||
$flags = JSON_PRETTY_PRINT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,16 +85,16 @@ foreach ($dirs as $path) {
|
||||
|
||||
$dlls = array();
|
||||
|
||||
for ($i = 0; $i < $zip->numFiles; $i++) {
|
||||
$stat = $zip->statIndex($i);
|
||||
|
||||
for( $i = 0; $i < $zip->numFiles; $i++ ){
|
||||
$stat = $zip->statIndex( $i );
|
||||
|
||||
if (substr($stat['name'], -3) != "dll") {
|
||||
continue;
|
||||
}
|
||||
|
||||
$dlls[] = basename($stat['name']);
|
||||
}
|
||||
|
||||
|
||||
$zip->close();
|
||||
unset($zip);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
include __DIR__ . "/../lib/php/autoload.php";
|
||||
include dirname(__FILE__) . "/../lib/php/autoload.php";
|
||||
|
||||
use SDK\Config;
|
||||
use SDK\Exception;
|
||||
@@ -21,42 +21,43 @@ try {
|
||||
$opt = getopt($sopt, $lopt);
|
||||
foreach ($opt as $name => $val) {
|
||||
switch ($name) {
|
||||
case "i":
|
||||
case "init":
|
||||
$cmd = "init";
|
||||
break;
|
||||
case "ready":
|
||||
$cmd = "check_init";
|
||||
break;
|
||||
case "t":
|
||||
case "train":
|
||||
$cmd = "train";
|
||||
break;
|
||||
case "u":
|
||||
case "up":
|
||||
$cmd = "up";
|
||||
break;
|
||||
case "d":
|
||||
case "down":
|
||||
$cmd = "down";
|
||||
break;
|
||||
case "s":
|
||||
case "scenario":
|
||||
$scenario = $val;
|
||||
break;
|
||||
case "f":
|
||||
case "force":
|
||||
$force = true;
|
||||
break;
|
||||
/* XXX This option is for now only integrated for training. It
|
||||
would make sense to integrate it also with init. */
|
||||
case "c":
|
||||
case "cases":
|
||||
$cases = explode(",", $val);
|
||||
break;
|
||||
case "h": case "help":
|
||||
usage(0);
|
||||
break;
|
||||
case "i":
|
||||
case "init":
|
||||
$cmd = "init";
|
||||
break;
|
||||
case "ready":
|
||||
$cmd = "check_init";
|
||||
break;
|
||||
case "t":
|
||||
case "train":
|
||||
$cmd = "train";
|
||||
break;
|
||||
case "u":
|
||||
case "up":
|
||||
$cmd = "up";
|
||||
break;
|
||||
case "d":
|
||||
case "down":
|
||||
$cmd = "down";
|
||||
break;
|
||||
case "s":
|
||||
case "scenario":
|
||||
$scenario = $val;
|
||||
break;
|
||||
case "f":
|
||||
case "force":
|
||||
$force = true;
|
||||
break;
|
||||
/* XXX This option is for now only integrated for training. It
|
||||
would make sense to integrate it also with init. */
|
||||
case "c":
|
||||
case "cases":
|
||||
$cases = explode(",", $val);
|
||||
break;
|
||||
case "h": case "help":
|
||||
usage(0);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BIN
bin/sqlite3.exe
BIN
bin/sqlite3.exe
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
spl_autoload_register(function($name) {
|
||||
$fl = __DIR__ . DIRECTORY_SEPARATOR . "libsdk" . DIRECTORY_SEPARATOR . $name . ".php";
|
||||
$fl = dirname(__FILE__) . DIRECTORY_SEPARATOR . "libsdk" . DIRECTORY_SEPARATOR . $name . ".php";
|
||||
|
||||
if (file_exists($fl)) {
|
||||
require_once $fl;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace SDK\Build\Dependency;
|
||||
|
||||
use SDK\{Exception, FileOps};
|
||||
use SDK\{Config, Exception, FileOps};
|
||||
|
||||
class Fetcher
|
||||
{
|
||||
@@ -13,7 +13,6 @@ class Fetcher
|
||||
protected $stability;
|
||||
protected $arch;
|
||||
protected $series;
|
||||
protected $scheme;
|
||||
|
||||
|
||||
public function __construct(string $host, int $port, string $scheme = "https", string $arch = NULL, string $stability = NULL, Series $series = NULL)
|
||||
@@ -23,7 +22,6 @@ class Fetcher
|
||||
$this->host = $host;
|
||||
$this->port = $port;
|
||||
$this->scheme = $scheme;
|
||||
$this->series = $series;
|
||||
}/*}}}*/
|
||||
|
||||
public function getSeries() : Series
|
||||
|
||||
@@ -11,7 +11,6 @@ class Manager
|
||||
protected $stability;
|
||||
protected $arch;
|
||||
protected $path;
|
||||
protected $cache;
|
||||
protected $series;
|
||||
protected $fetcher;
|
||||
protected $updatesFlag = NULL;
|
||||
@@ -42,7 +41,7 @@ class Manager
|
||||
|
||||
public function updatesAvailable() : bool
|
||||
{/*{{{*/
|
||||
if (NULL !== $this->updatesFlag) {
|
||||
if (!is_null($this->updatesFlag)) {
|
||||
return $this->updatesFlag;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ class Series
|
||||
|
||||
public function getName() : string
|
||||
{/*{{{*/
|
||||
$base = Config::getDepsBaseUri();
|
||||
$branch_data = Config::getCurrentBranchData();
|
||||
|
||||
$file = "packages-" . Config::getCurrentBranchName() . "-{$branch_data['crt']}-{$this->arch}-{$this->stability}.txt";
|
||||
|
||||
@@ -2,17 +2,15 @@
|
||||
|
||||
namespace SDK\Build\PGO\Abstracts;
|
||||
|
||||
use SDK\Build\PGO\Interfaces\Server;
|
||||
use SDK\Build\PGO\PHP\CLI;
|
||||
use SDK\{Config as SDKConfig, Exception};
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
|
||||
abstract class PHP
|
||||
{
|
||||
protected $php_root;
|
||||
protected $php_ext_root;
|
||||
protected $opcache_file_cache;
|
||||
protected $id;
|
||||
protected $scenario;
|
||||
protected $conf;
|
||||
|
||||
protected function setupPaths()
|
||||
{
|
||||
@@ -25,9 +23,6 @@ abstract class PHP
|
||||
} else {
|
||||
$this->php_ext_root = $this->php_root;
|
||||
}
|
||||
if ("cache" == $this->scenario) {
|
||||
$this->opcache_file_cache = SDKConfig::getTmpDir() . DIRECTORY_SEPARATOR . $this->id;
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO Might be improved. */
|
||||
@@ -44,22 +39,12 @@ abstract class PHP
|
||||
$deps_root = SDKConfig::getDepsLocalPath();
|
||||
foreach ($env as $k => $v) {
|
||||
if (strtoupper($k) == "PATH") {
|
||||
$env[$k] = $deps_root . DIRECTORY_SEPARATOR . "bin;" . $env[$k];
|
||||
$env[$k] = "$deps_root" . DIRECTORY_SEPARATOR . "bin;" . $env[$k];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$drive = getenv("HOMEDRIVE");
|
||||
$path = getenv("HOMEPATH");
|
||||
if (!$drive || !$path) {
|
||||
$p = SDKConfig::getTmpDir();
|
||||
$drive = substr($p, 0, 2);
|
||||
$path = substr($p, 2);
|
||||
putenv("HOMEDRIVE=$drive");
|
||||
putenv("HOMEPATH=$path");
|
||||
}
|
||||
|
||||
return $env;
|
||||
}
|
||||
|
||||
@@ -110,7 +95,7 @@ abstract class PHP
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL === $ret) {
|
||||
if (is_null($ret)) {
|
||||
throw new Exception("Failed to determine the test PHP version.");
|
||||
}
|
||||
|
||||
@@ -162,11 +147,6 @@ abstract class PHP
|
||||
}
|
||||
}
|
||||
|
||||
/* Special handling, otherwise it'll need functionality to extrapolate ini values. */
|
||||
if ("cache" == $this->scenario) {
|
||||
$tpl_vars[$this->conf->buildTplVarName("php", "opcache", "file_cache")] = $this->opcache_file_cache;
|
||||
}
|
||||
|
||||
$this->conf->processTplFile(
|
||||
$this->getIniTplFilename(),
|
||||
$ret,
|
||||
@@ -194,8 +174,8 @@ abstract class PHP
|
||||
public function exec(string $php_cmd, string $args = NULL, array $extra_env = array()) : int
|
||||
{
|
||||
$env = $this->createEnv();
|
||||
$exe = $this->getExeFilename();
|
||||
$ini = $this->getIniFilename();
|
||||
$exe = $this->getExeFilename();
|
||||
$ini = $this->getIniFilename();
|
||||
|
||||
$cert_path = getenv("PHP_SDK_ROOT_PATH") . "\\msys2\\usr\\ssl\\cert.pem";
|
||||
$ini .= " -d curl.cainfo=$cert_path";
|
||||
@@ -223,7 +203,7 @@ abstract class PHP
|
||||
$env[$k] = $v;
|
||||
}
|
||||
|
||||
$cmd = "$exe -n -c $ini " . ($args ? "$args " : "") . $php_cmd;
|
||||
$cmd = "$exe -n -c $ini " . ($args ? "$args " : "") . "$php_cmd";
|
||||
|
||||
$desc = array(
|
||||
0 => array("file", "php://stdin", "r"),
|
||||
@@ -234,13 +214,5 @@ abstract class PHP
|
||||
|
||||
return proc_close($p);
|
||||
}
|
||||
|
||||
public function getIdString(): string
|
||||
{
|
||||
return $this->getVersion() . "-"
|
||||
. SDKConfig::getCurrentCrtName() . "-"
|
||||
. ($this->isThreadSafe() ? "ts" : "nts") . "-"
|
||||
. ($this->is64bit() ? "x64" : "x86")
|
||||
. "-" . substr(md5(uniqid()), 0, 8);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace SDK\Build\PGO\Abstracts;
|
||||
|
||||
use SDK\Build\PGO\Interfaces;
|
||||
|
||||
abstract class Server
|
||||
class Server
|
||||
{
|
||||
public function getName() : string
|
||||
{
|
||||
@@ -17,3 +17,6 @@ abstract class Server
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
namespace SDK\Build\PGO\Abstracts;
|
||||
|
||||
use SDK\FileOps;
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\Build\PGO\Tool;
|
||||
|
||||
abstract class TrainingCase
|
||||
class TrainingCase
|
||||
{
|
||||
use FileOps;
|
||||
|
||||
@@ -13,8 +14,6 @@ abstract class TrainingCase
|
||||
const TYPE_CLI = "cli";
|
||||
|
||||
protected $stat = array();
|
||||
/** @var \SDK\Build\PGO\Config */
|
||||
protected $conf;
|
||||
|
||||
public function getType() : string
|
||||
{
|
||||
@@ -149,3 +148,4 @@ abstract class TrainingCase
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace SDK\Build\PGO;
|
||||
|
||||
use SDK\Exception;
|
||||
use SDK\{Config as SDKConfig, Exception};
|
||||
|
||||
class Config
|
||||
{
|
||||
@@ -18,7 +18,7 @@ class Config
|
||||
protected $tpl_vars = array();
|
||||
protected $srv = array();
|
||||
|
||||
public function __construct(int $mode = self::MODE_RUN)
|
||||
public function __construct(int $mode = MODE_RUN)
|
||||
{
|
||||
if (self::MODE_CHECK_INIT == $mode) {
|
||||
// XXX The check is simple right now, so this is sufficient.
|
||||
@@ -40,6 +40,7 @@ class Config
|
||||
$this->mode = $mode;
|
||||
|
||||
|
||||
$base = getenv("PHP_SDK_ROOT_PATH");
|
||||
if (self::MODE_INIT == $mode) {
|
||||
foreach (array("nginx", "mariadb", "postgresql", "php") as $i) {
|
||||
$this->importSectionFromDir($i, $this->getTplDir() . DIRECTORY_SEPARATOR . $i);
|
||||
@@ -278,7 +279,7 @@ class Config
|
||||
public function processTplFile(string $tpl_fn, string $dst_fn, array $additional_vars = array()) : void
|
||||
{
|
||||
if (!file_exists($tpl_fn)) {
|
||||
throw new Exception("Template file '$tpl_fn' doesn't exist.");
|
||||
throw new Exception("Template file '$fn' doesn't exist.");
|
||||
}
|
||||
|
||||
$s = file_get_contents($tpl_fn);
|
||||
@@ -367,3 +368,4 @@ class Config
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
|
||||
namespace SDK\Build\PGO;
|
||||
|
||||
use SDK\{Exception, Lock};
|
||||
use SDK\{Config as SDKConfig, Exception, Lock};
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
use SDK\Build\PGO\Server\{MariaDB, NGINX, PostgreSQL};
|
||||
use SDK\Build\PGO\PHP;
|
||||
use SDK\Build\PGO\Tool\{PGO, PackageWorkman};
|
||||
|
||||
use SDK\Build\PGO\Interfaces\TrainingCase;
|
||||
use SDK\Build\PGO\TrainingCaseIterator;
|
||||
|
||||
/* TODO add bench action */
|
||||
|
||||
@@ -78,38 +79,38 @@ class Controller
|
||||
$this->conf = $this->setupConfig($this->cmd);
|
||||
|
||||
switch ($this->cmd) {
|
||||
default:
|
||||
throw new Exception("Unknown action '{$this->cmd}'.");
|
||||
break;
|
||||
case "init":
|
||||
$lk = new Lock("pgo_init");
|
||||
if (!$lk->locked()) {
|
||||
echo "Another process runs initialization right now, waiting.", PHP_EOL;
|
||||
$lk->exclusive(true);
|
||||
echo "Another process finished running initialization, I quit as well.", PHP_EOL;
|
||||
return;
|
||||
}
|
||||
$this->init($force);
|
||||
break;
|
||||
case "train":
|
||||
$lk = new Lock("pgo_train");
|
||||
if (!$lk->locked()) {
|
||||
echo "Another process runs training right now, I have to wait.", PHP_EOL;
|
||||
$lk->exclusive(true);
|
||||
echo "Another process finished training, I may continue.", PHP_EOL;
|
||||
}
|
||||
$this->train();
|
||||
break;
|
||||
case "up":
|
||||
$this->up();
|
||||
break;
|
||||
default:
|
||||
throw new Exception("Unknown action '{$this->cmd}'.");
|
||||
break;
|
||||
case "init":
|
||||
$lk = new Lock("pgo_init");
|
||||
if (!$lk->locked()) {
|
||||
echo "Another process runs initialization right now, waiting.", PHP_EOL;
|
||||
$lk->exclusive(true);
|
||||
echo "Another process finished running initialization, I quit as well.", PHP_EOL;
|
||||
return;
|
||||
}
|
||||
$this->init($force);
|
||||
break;
|
||||
case "train":
|
||||
$lk = new Lock("pgo_train");
|
||||
if (!$lk->locked()) {
|
||||
echo "Another process runs training right now, I have to wait.", PHP_EOL;
|
||||
$lk->exclusive(true);
|
||||
echo "Another process finished training, I may continue.", PHP_EOL;
|
||||
}
|
||||
$this->train();
|
||||
break;
|
||||
case "up":
|
||||
$this->up();
|
||||
break;
|
||||
|
||||
case "down":
|
||||
$this->down($force);
|
||||
break;
|
||||
case "check_init":
|
||||
// pass
|
||||
break;
|
||||
case "down":
|
||||
$this->down($force);
|
||||
break;
|
||||
case "check_init":
|
||||
// pass
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +141,6 @@ class Controller
|
||||
if (!file_exists($composer) || $force) {
|
||||
/* XXX this needs to go into the config, specifically for composer maybe even separate class. */
|
||||
$url = "https://getcomposer.org/installer";
|
||||
/* XXX remove the explicit version option when symfony demo is fixed. */
|
||||
$tool = $this->conf->getToolsDir() . DIRECTORY_SEPARATOR . "composer-setup.php";
|
||||
$pw->fetch($url, $tool, $force);
|
||||
$php->exec("$tool --install-dir=" . $this->conf->getToolsDir());
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace SDK\Build\PGO\Interfaces;
|
||||
|
||||
use SDK\Build\PGO\Config;
|
||||
use SDK\Build\PGO\Tool\PackageWorkman;
|
||||
|
||||
interface PHP
|
||||
@@ -14,3 +15,4 @@ interface PHP
|
||||
public function getVersion(bool $short = false) : string;
|
||||
public function getExeFilename() : string;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace SDK\Build\PGO\Interfaces;
|
||||
|
||||
use SDK\Build\PGO\Config;
|
||||
use SDK\Build\PGO\Tool\PackageWorkman;
|
||||
|
||||
interface Server
|
||||
@@ -13,3 +14,4 @@ interface Server
|
||||
public function down(bool $force = false) : void;
|
||||
public function getName() : string;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,3 +10,4 @@ interface DB extends Interfaces\Server
|
||||
public function __construct(Config $conf);
|
||||
public function query(string $s, string $db = NULL) : void;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,3 +11,4 @@ interface HTTP extends Interfaces\Server
|
||||
public function getPhp() : Interfaces\PHP;
|
||||
public function addServer(string $part_tpl_fn, array $tpl_vars = array());
|
||||
}
|
||||
|
||||
|
||||
@@ -25,3 +25,4 @@ interface TrainingCase
|
||||
/* Get training type, it's like "web", "cli", etc.*/
|
||||
public function getType() : string;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,19 +5,17 @@ namespace SDK\Build\PGO\PHP;
|
||||
use SDK\Build\PGO\Interfaces;
|
||||
use SDK\Build\PGO\Abstracts;
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
use SDK\{Exception};
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\Build\PGO\Tool\PackageWorkman;
|
||||
|
||||
class CLI extends Abstracts\PHP implements Interfaces\PHP
|
||||
{
|
||||
protected $conf;
|
||||
|
||||
public function __construct(PGOConfig $conf)
|
||||
{
|
||||
$this->conf = $conf;
|
||||
$this->scenario = $conf->getScenario();
|
||||
// Don't do that, it'll be a recursive dependency.
|
||||
// Once we need to train CLI, we'll need to split
|
||||
// a new class, this one is a utility class.
|
||||
//$this->id = $this->getIdString();
|
||||
|
||||
$this->setupPaths();
|
||||
}
|
||||
@@ -52,4 +50,7 @@ class CLI extends Abstracts\PHP implements Interfaces\PHP
|
||||
|
||||
return $exe;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -5,13 +5,12 @@ namespace SDK\Build\PGO\PHP;
|
||||
use SDK\Build\PGO\Interfaces;
|
||||
use SDK\Build\PGO\Abstracts;
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
use SDK\{Exception, FileOps};
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\Build\PGO\Tool\PackageWorkman;
|
||||
|
||||
class FCGI extends Abstracts\PHP implements Interfaces\PHP
|
||||
{
|
||||
use FileOps;
|
||||
|
||||
protected $conf;
|
||||
protected $is_tcp;
|
||||
|
||||
public function __construct(PGOConfig $conf, bool $is_tcp)
|
||||
@@ -23,7 +22,6 @@ class FCGI extends Abstracts\PHP implements Interfaces\PHP
|
||||
$this->conf = $conf;
|
||||
$this->is_tcp = $is_tcp;
|
||||
$this->scenario = $conf->getScenario();
|
||||
$this->id = $this->getIdString();
|
||||
|
||||
$this->setupPaths();
|
||||
}
|
||||
@@ -66,15 +64,6 @@ echo "PHP FCGI initialization done.\n";*/
|
||||
{
|
||||
echo "Starting PHP FCGI.\n";
|
||||
|
||||
if ("cache" == $this->scenario) {
|
||||
if (file_exists($this->opcache_file_cache)) {
|
||||
$this->rm($this->opcache_file_cache);
|
||||
}
|
||||
if (!mkdir($this->opcache_file_cache)) {
|
||||
throw new Exception("Failed to create '{$this->opcache_file_cache}'");
|
||||
}
|
||||
}
|
||||
|
||||
$exe = $this->getExeFilename();
|
||||
$ini = $this->getIniFilename();
|
||||
$host = $this->conf->getSectionItem("php", "fcgi", "host");
|
||||
@@ -93,10 +82,6 @@ echo "PHP FCGI initialization done.\n";*/
|
||||
/* Give some time, it might be slow on PGI enabled proc. */
|
||||
sleep(3);
|
||||
|
||||
/*while(false !== ($s = fread($pipes[2], 1024))) {
|
||||
echo "$s";
|
||||
}*/
|
||||
|
||||
$c = proc_close($p);
|
||||
|
||||
if ($c) {
|
||||
@@ -114,15 +99,7 @@ echo "PHP FCGI initialization done.\n";*/
|
||||
|
||||
exec("taskkill /f /im php-cgi.exe >nul 2>&1");
|
||||
|
||||
/* XXX Add cleanup interface. */
|
||||
if ("cache" == $this->scenario) {
|
||||
try {
|
||||
$this->rm($this->opcache_file_cache);
|
||||
} catch (\UnexpectedValueException $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "PHP FCGI stopped.\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace SDK\Build\PGO\Server;
|
||||
use SDK\Build\PGO\Interfaces\Server\DB;
|
||||
use SDK\Build\PGO\Abstracts\Server;
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
use SDK\{Exception, FileOps};
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\Build\PGO\Tool\PackageWorkman;
|
||||
|
||||
class MariaDB extends Server implements DB
|
||||
@@ -115,7 +115,7 @@ class MariaDB extends Server implements DB
|
||||
|
||||
$pass_arg = $pass ? "-p$pass " : "";
|
||||
$db_arg = $db ? "-D $db" : "";
|
||||
shell_exec(".\\bin\\mysql.exe -u $user $pass_arg -h $host -P $port $db_arg -e \"$s\"");
|
||||
$ret = shell_exec(".\\bin\\mysql.exe -u $user $pass_arg -h $host -P $port $db_arg -e \"$s\"");
|
||||
//var_dump($this->base, getcwd(), ".\\bin\\mysql.exe -u $user $pass_arg -h $host -P $port -e \"$s\"");
|
||||
|
||||
chdir($cwd);
|
||||
@@ -136,8 +136,9 @@ class MariaDB extends Server implements DB
|
||||
|
||||
$pass_arg = $pass ? "-p$pass " : "";
|
||||
$db_arg = $db ? "-D $db" : "";
|
||||
shell_exec(".\\bin\\mysql.exe -u $user $pass_arg -h $host -P $port $db_arg < \"$path\"");
|
||||
$ret = shell_exec(".\\bin\\mysql.exe -u $user $pass_arg -h $host -P $port $db_arg < \"$path\"");
|
||||
|
||||
chdir($cwd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace SDK\Build\PGO\Server;
|
||||
use SDK\Build\PGO\Interfaces;
|
||||
use SDK\Build\PGO\Abstracts;
|
||||
use SDK\Build\PGO\{Config as PGOConfig};
|
||||
use SDK\{Exception, FileOps};
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\Build\PGO\Tool\PackageWorkman;
|
||||
|
||||
class NGINX extends Abstracts\Server implements Interfaces\Server\HTTP
|
||||
@@ -29,6 +29,7 @@ class NGINX extends Abstracts\Server implements Interfaces\Server\HTTP
|
||||
$nginx_conf_in = $this->conf->getTplDir($this->name) . DIRECTORY_SEPARATOR . "nginx.conf";
|
||||
$conf_fn = $this->base . DIRECTORY_SEPARATOR . "conf" . DIRECTORY_SEPARATOR . "nginx.conf";
|
||||
|
||||
$vars = array();
|
||||
$port = $this->conf->getSectionItem($this->name, "port");
|
||||
if (!$port) {
|
||||
$port = $this->conf->getNextPort();
|
||||
@@ -147,3 +148,4 @@ class NGINX extends Abstracts\Server implements Interfaces\Server\HTTP
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace SDK\Build\PGO\Server;
|
||||
use SDK\Build\PGO\Interfaces\Server\DB;
|
||||
use SDK\Build\PGO\Abstracts\Server;
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
use SDK\{Exception, FileOps};
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\Build\PGO\Tool\PackageWorkman;
|
||||
|
||||
class PostgreSQL extends Server implements DB
|
||||
@@ -90,6 +90,10 @@ class PostgreSQL extends Server implements DB
|
||||
echo "Stopping " . $this->name . ".\n";
|
||||
|
||||
|
||||
$user = $this->conf->getSectionItem($this->name, "user");
|
||||
$pass = $this->conf->getSectionItem($this->name, "pass");
|
||||
|
||||
|
||||
$cmd = $this->base . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "pg_ctl.exe stop -D " . $this->data_dir . " -m fast";
|
||||
exec($cmd);
|
||||
|
||||
@@ -104,6 +108,7 @@ class PostgreSQL extends Server implements DB
|
||||
public function createDb(string $db_name) : void
|
||||
{
|
||||
$user = $this->conf->getSectionItem($this->name, "user");
|
||||
$pass = $this->conf->getSectionItem($this->name, "pass");
|
||||
$host = $this->conf->getSectionItem($this->name, "host");
|
||||
$port = $this->conf->getSectionItem($this->name, "port");
|
||||
|
||||
@@ -114,6 +119,7 @@ class PostgreSQL extends Server implements DB
|
||||
public function dropDb(string $db_name) : void
|
||||
{
|
||||
$user = $this->conf->getSectionItem($this->name, "user");
|
||||
//$pass = $this->conf->getSectionItem($this->name, "pass");
|
||||
$host = $this->conf->getSectionItem($this->name, "host");
|
||||
$port = $this->conf->getSectionItem($this->name, "port");
|
||||
|
||||
@@ -126,11 +132,13 @@ class PostgreSQL extends Server implements DB
|
||||
$ret = NULL;
|
||||
|
||||
$user = $this->conf->getSectionItem($this->name, "user");
|
||||
//$pass = $this->conf->getSectionItem($this->name, "pass");
|
||||
$host = $this->conf->getSectionItem($this->name, "host");
|
||||
$port = $this->conf->getSectionItem($this->name, "port");
|
||||
|
||||
$db_arg = $db ? "-d $db" : "";
|
||||
$cmd = $this->base . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "psql.exe -h $host -p $port -U $user $db_arg -c \"$s\"";
|
||||
shell_exec($cmd);
|
||||
$ret = shell_exec($cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace SDK\Build\PGO\Tool;
|
||||
|
||||
use SDK\Exception;
|
||||
use SDK\{Config as SDKConfig, Exception};
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
use SDK\Build\PGO\Interfaces;
|
||||
|
||||
@@ -63,11 +63,11 @@ class PGO
|
||||
$pgc = $this->getPgcName($base);
|
||||
$pgd = $this->getPgdName($base);
|
||||
|
||||
shell_exec("pgosweep $base $pgc");
|
||||
`pgosweep $base $pgc`;
|
||||
//passthru("pgosweep $base $pgc");
|
||||
|
||||
if ($merge) {
|
||||
shell_exec("pgomgr /merge:1000 $pgc $pgd");
|
||||
`pgomgr /merge:1000 $pgc $pgd`;
|
||||
//passthru("pgomgr /merge:1000 $pgc $pgd");
|
||||
/* File is already spent, no need to keep it.
|
||||
If seeing linker warnings about no pgc
|
||||
@@ -98,9 +98,10 @@ class PGO
|
||||
$its = glob($this->php->getRootDir() . DIRECTORY_SEPARATOR . "*.pgd");
|
||||
$its = array_merge($its, glob($this->php->getExtRootDir() . DIRECTORY_SEPARATOR . "*" . DIRECTORY_SEPARATOR . "*.pgd"));
|
||||
foreach (array_unique($its) as $pgd) {
|
||||
shell_exec("pgomgr /clear $pgd");
|
||||
`pgomgr /clear $pgd`;
|
||||
//passthru("pgomgr /clear $pgd");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace SDK\Build\PGO\Tool;
|
||||
|
||||
use SDK\{Exception, FileOps};
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
|
||||
|
||||
@@ -47,10 +47,11 @@ class PackageWorkman
|
||||
echo "Unpacking '$cache_fn' to '$tgt_name'\n";
|
||||
try {
|
||||
$this->unzip($cache_fn, $zip_tgt_dn, $tgt_bn);
|
||||
} catch (\Throwable $e) {
|
||||
} catch (Throwable $e) {
|
||||
$this->rm($cache_fn);
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace SDK\Build\PGO\Tool;
|
||||
|
||||
use SDK\{Config as SDKConfig, Exception};
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
use SDK\Build\PGO\Interfaces\TrainingCase;
|
||||
use SDK\Build\PGO\Interfaces\{TrainingCase, Server, Server\DB, PHP};
|
||||
|
||||
class Training
|
||||
{
|
||||
@@ -15,9 +15,8 @@ class Training
|
||||
{
|
||||
$this->conf = $conf;
|
||||
$this->t_case = $t_case;
|
||||
|
||||
$type = $this->t_case->getType();
|
||||
if (!in_array($type, array("web", "cli"))) {
|
||||
|
||||
if (!in_array($this->t_case->getType(), array("web", "cli"))) {
|
||||
throw new Exception("Unknown training type '$type'.");
|
||||
}
|
||||
}
|
||||
@@ -108,7 +107,8 @@ class Training
|
||||
public function run(int $max_runs = 1, ?array &$stat = array()) : void
|
||||
{
|
||||
$type = $this->t_case->getType();
|
||||
switch ($type) {
|
||||
switch ($type)
|
||||
{
|
||||
case "web":
|
||||
$this->runWeb($max_runs, $stat);
|
||||
break;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace SDK\Build\PGO;
|
||||
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\Build\PGO\Config as PGOConfig;
|
||||
|
||||
|
||||
@@ -20,7 +21,7 @@ class TrainingCaseIterator implements \Iterator
|
||||
|
||||
$items = glob($this->conf->getCasesTplDir() . DIRECTORY_SEPARATOR . "*");
|
||||
foreach ($items as $it) {
|
||||
if (!is_dir($it)) {
|
||||
if(!is_dir($it)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -52,7 +53,7 @@ class TrainingCaseIterator implements \Iterator
|
||||
|
||||
public function current()
|
||||
{
|
||||
$base = $this->items[$this->idx];
|
||||
$base = $this->items[$this->idx];
|
||||
$ns = basename($base);
|
||||
|
||||
/* Don't overwrite generated config. */
|
||||
@@ -96,4 +97,6 @@ class TrainingCaseIterator implements \Iterator
|
||||
|
||||
return $this->el->getName();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
namespace SDK;
|
||||
|
||||
use SDK\Config;
|
||||
use SDK\Cache;
|
||||
use SDK\Exception;
|
||||
|
||||
class Cache
|
||||
{
|
||||
protected $id;
|
||||
@@ -44,7 +48,7 @@ class Cache
|
||||
$old_sum = md5_file($p);
|
||||
$new_sum = md5($content);
|
||||
|
||||
return $old_sum !== $new_sum;
|
||||
return $old_sum != $new_sum;
|
||||
}/*}}}*/
|
||||
|
||||
public function cacheContent(string $path, string $content, bool $relative = false) : void
|
||||
@@ -60,7 +64,7 @@ class Cache
|
||||
|
||||
do {
|
||||
$got = fwrite($fd, substr($content, $wrote));
|
||||
if (false === $got) {
|
||||
if (false == $got) {
|
||||
break;
|
||||
}
|
||||
$wrote += $got;
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
namespace SDK;
|
||||
|
||||
use SDK\Build\Dependency\Fetcher;
|
||||
use SDK\Cache;
|
||||
use SDK\Exception;
|
||||
|
||||
class Config
|
||||
{
|
||||
@@ -181,11 +183,6 @@ class Config
|
||||
$branch = NULL;
|
||||
$found = false;
|
||||
|
||||
$rmtools_branch = getenv("PHP_RMTOOLS_PHP_BUILD_BRANCH");
|
||||
if ("master" == $rmtools_branch) {
|
||||
return "master";
|
||||
}
|
||||
|
||||
/* Try to figure out the branch. The worky scenarios are
|
||||
- CWD is in php-src
|
||||
- phpize is on the path
|
||||
@@ -216,19 +213,6 @@ class Config
|
||||
if (is_numeric($major) && is_numeric($minor)) {
|
||||
$branch = "$major.$minor";
|
||||
}
|
||||
|
||||
/* Verify that we use an available branch name. Master has some
|
||||
version, but no dedicated series. For master, it rather
|
||||
makes sense to use master as branch name. */
|
||||
$git = trim(shell_exec("where git.exe"));
|
||||
if ($git && is_dir(".git")) {
|
||||
$cmd = "\"$git\" branch";
|
||||
|
||||
$ret = trim(shell_exec($cmd));
|
||||
if (preg_match_all(",\*\s+master,", $ret) > 0) {
|
||||
$branch = "master";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $branch;
|
||||
@@ -293,10 +277,10 @@ class Config
|
||||
}
|
||||
}
|
||||
|
||||
if (!@$ret["stability"]) {
|
||||
if (!$ret["stability"]) {
|
||||
throw new Exception("Failed to find config with stability '" . self::getCurrentStabilityName() . "'");
|
||||
}
|
||||
if (!@$ret["crt"]) {
|
||||
if (!$ret["crt"]) {
|
||||
throw new Exception("Failed to find config with arch '" . self::getCurrentArchName() . "'");
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace SDK;
|
||||
|
||||
use SDK\Config;
|
||||
use SDK\Exception;
|
||||
|
||||
trait FileOps
|
||||
{
|
||||
protected function md(string $name = "", bool $tmp = false) : string
|
||||
@@ -116,9 +119,6 @@ trait FileOps
|
||||
protected function download(string $url, string $dest_fn = NULL) : ?string
|
||||
{/*{{{*/
|
||||
$fd = NULL;
|
||||
$retry = 0;
|
||||
|
||||
retry:
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
@@ -146,9 +146,6 @@ retry:
|
||||
if ($dest_fn) {
|
||||
fclose($fd);
|
||||
}
|
||||
if ($retry++ < 3) {
|
||||
goto retry;
|
||||
}
|
||||
throw new Exception($err);
|
||||
}
|
||||
|
||||
@@ -196,7 +193,7 @@ retry:
|
||||
$name = substr($name, 0, -1);*/
|
||||
|
||||
$name = rtrim($stat["name"], "/");
|
||||
while (strstr($name, '/') !== false) {
|
||||
while (strchr($name, '/') !== false) {
|
||||
$name = dirname($name);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace SDK;
|
||||
|
||||
use SDK\{Config, Exception};
|
||||
|
||||
class Lock
|
||||
{
|
||||
protected $fd;
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace drupal;
|
||||
|
||||
use SDK\Build\PGO\Abstracts;
|
||||
use SDK\Build\PGO\Interfaces;
|
||||
use SDK\Build\PGO\Config;
|
||||
use SDK\Build\PGO\PHP;
|
||||
use SDK\Exception;
|
||||
use SDK\Build\PGO\Tool;
|
||||
|
||||
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
|
||||
{
|
||||
protected $base;
|
||||
protected $nginx;
|
||||
protected $php;
|
||||
protected $max_runs = 8;
|
||||
|
||||
public function __construct(Config $conf, ?Interfaces\Server $nginx, ?Interfaces\Server\DB $maria)
|
||||
{
|
||||
if (!$nginx) {
|
||||
throw new Exception("Invalid NGINX object");
|
||||
}
|
||||
|
||||
$this->conf = $conf;
|
||||
$this->base = $this->conf->getCaseWorkDir($this->getName());
|
||||
$this->nginx = $nginx;
|
||||
$this->php = $nginx->getPhp();
|
||||
}
|
||||
|
||||
public function getName() : string
|
||||
{
|
||||
return __NAMESPACE__;
|
||||
}
|
||||
|
||||
public function getJobFilename() : string
|
||||
{
|
||||
return $this->conf->getJobDir() . DIRECTORY_SEPARATOR . $this->getName() . ".txt";
|
||||
}
|
||||
|
||||
protected function getToolFn() : string
|
||||
{
|
||||
return $this->base . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, array("vendor", "drush", "drush", "drush"));
|
||||
}
|
||||
|
||||
protected function setupDist() : void
|
||||
{
|
||||
$db_path = str_replace("\\", "/", $this->base) . "/drupal.sqlite3";
|
||||
if (!file_exists($db_path)) {
|
||||
echo "Setting up in '{$this->base}'\n";
|
||||
|
||||
$php = new PHP\CLI($this->conf);
|
||||
$cmd = $this->getToolFn() . " site-install demo_umami --db-url=sqlite://$db_path --account-name=admin --account-pass=adminpass --yes";
|
||||
|
||||
$php->exec($cmd);
|
||||
}
|
||||
|
||||
$port = $this->getHttpPort();
|
||||
$host = $this->getHttpHost();
|
||||
|
||||
$vars = array(
|
||||
$this->conf->buildTplVarName($this->getName(), "docroot") => str_replace("\\", "/", $this->base . DIRECTORY_SEPARATOR . "web"),
|
||||
);
|
||||
$tpl_fn = $this->conf->getCasesTplDir($this->getName()) . DIRECTORY_SEPARATOR . "nginx.partial.conf";
|
||||
$this->nginx->addServer($tpl_fn, $vars);
|
||||
}
|
||||
|
||||
public function setupUrls()
|
||||
{
|
||||
$this->nginx->up();
|
||||
|
||||
$url = "http://" . $this->getHttpHost() . ":" . $this->getHttpPort();
|
||||
$s = file_get_contents($url);
|
||||
|
||||
$this->nginx->down(true);
|
||||
|
||||
echo "Generating training urls.\n";
|
||||
|
||||
$lst = array();
|
||||
if (preg_match_all(", href=\"([^\"]+)\",", $s, $m)) {
|
||||
foreach ($m[1] as $u) {
|
||||
$p = parse_url($u, PHP_URL_PATH);
|
||||
if (strlen($p) >= 2 && "/" == $p[0] && "/" != $p[1] && !in_array(substr($p, -3), array("css", "xml", "ico"))) {
|
||||
$ur = "http://" . $this->getHttpHost() . ":" . $this->getHttpPort() . $u;
|
||||
if (!in_array($ur, $lst)) {
|
||||
$lst[] = $ur;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($lst)) {
|
||||
printf("\033[31m WARNING: Training URL list is empty, check the regex and the possible previous error messages!\033[0m\n");
|
||||
}
|
||||
|
||||
$fn = $this->getJobFilename();
|
||||
$s = implode("\n", $lst);
|
||||
if (strlen($s) !== file_put_contents($fn, $s)) {
|
||||
throw new Exception("Couldn't write '$fn'.");
|
||||
}
|
||||
}
|
||||
|
||||
public function prepareInit(Tool\PackageWorkman $pw, bool $force = false) : void
|
||||
{
|
||||
$php = new PHP\CLI($this->conf);
|
||||
|
||||
$composer = $this->conf->getToolsDir() . DIRECTORY_SEPARATOR . "composer.phar";
|
||||
|
||||
$cmd = $composer . " create-project drupal-composer/drupal-project:8.x-dev {$this->base} --stability dev --no-interaction";
|
||||
$php->exec($cmd);
|
||||
}
|
||||
|
||||
public function init() : void
|
||||
{
|
||||
echo "Initializing " . $this->getName() . ".\n";
|
||||
|
||||
$this->setupDist();
|
||||
$this->setupUrls();
|
||||
|
||||
echo $this->getName() . " initialization done.\n";
|
||||
echo $this->getName() . " site configured to run under " . $this->getHttpHost() . ":" . $this->getHttpPort() . "\n";
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
server {
|
||||
listen PHP_SDK_PGO_DRUPAL_HTTP_PORT;
|
||||
server_name PHP_SDK_PGO_DRUPAL_HTTP_HOST;
|
||||
|
||||
root PHP_SDK_PGO_DRUPAL_DOCROOT;
|
||||
index index.html index.htm index.php;
|
||||
|
||||
location / {
|
||||
try_files $uri /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass PHP_SDK_PGO_PHP_FCGI_HOST:PHP_SDK_PGO_PHP_FCGI_PORT;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"type": "web",
|
||||
"srv_http": "nginx",
|
||||
"srv_db": null
|
||||
}
|
||||
@@ -6,11 +6,12 @@ use SDK\Build\PGO\Abstracts;
|
||||
use SDK\Build\PGO\Interfaces;
|
||||
use SDK\Build\PGO\Config;
|
||||
use SDK\Build\PGO\PHP;
|
||||
use SDK\Exception;
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\Build\PGO\Tool;
|
||||
|
||||
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
|
||||
{
|
||||
protected $conf;
|
||||
protected $base;
|
||||
protected $nginx;
|
||||
protected $php;
|
||||
@@ -115,20 +116,7 @@ class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\T
|
||||
$lst = array();
|
||||
if (preg_match_all(", href=\"([^\"]+)\",", $s, $m)) {
|
||||
foreach ($m[1] as $u) {
|
||||
$h = parse_url($u, PHP_URL_HOST);
|
||||
$s = parse_url($u, PHP_URL_SCHEME);
|
||||
if ($h && $s) {
|
||||
if ($this->getHttpHost() != $h) {
|
||||
continue;
|
||||
}
|
||||
if (!in_array($u, $lst)) {
|
||||
$lst[] = $u;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$p = parse_url($u, PHP_URL_PATH);
|
||||
if (strlen($p) >= 2 && "/" == $p[0] && "/" != $p[1] && !in_array(substr($p, -3), array("css", "xml", "ico")) &&
|
||||
"/using-joomla/extensions/components/news-feeds-component/single-news-feed" != $p) {
|
||||
if ("/" == $u[0] && "/" != $u[1] && !in_array(substr($u, -3), array("css", "xml", "ico"))) {
|
||||
$ur = "http://" . $this->getHttpHost() . ":" . $this->getHttpPort() . $u;
|
||||
if (!in_array($ur, $lst)) {
|
||||
$lst[] = $ur;
|
||||
@@ -175,6 +163,8 @@ class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\T
|
||||
$this->setupUrls();
|
||||
|
||||
echo $this->getName() . " initialization done.\n";
|
||||
echo $this->getName() . " site configured to run under " . $this->getHttpHost() . ":" . $this->getHttpPort() . "\n";
|
||||
echo $this->getName() . " site configured to run under " . $this->getHttpHost() . ":" .$this->getHttpPort() . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
0
pgo/cases/joomla/inactive
Normal file
0
pgo/cases/joomla/inactive
Normal file
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"joomla_zip_url": "https://github.com/joomla/joomla-cms/releases/download/3.8.11/Joomla_3.8.11-Stable-Full_Package.zip",
|
||||
"joomla_zip_url": "https://github.com/joomla/joomla-cms/releases/download/3.7.2/Joomla_3.7.2-Stable-Full_Package.zip",
|
||||
"type": "web",
|
||||
"srv_http": "nginx",
|
||||
"srv_db": "mariadb"
|
||||
|
||||
@@ -6,11 +6,12 @@ use SDK\Build\PGO\Abstracts;
|
||||
use SDK\Build\PGO\Interfaces;
|
||||
use SDK\Build\PGO\Config;
|
||||
use SDK\Build\PGO\PHP;
|
||||
use SDK\Exception;
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\Build\PGO\Tool;
|
||||
|
||||
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
|
||||
{
|
||||
protected $conf;
|
||||
protected $base;
|
||||
protected $nginx;
|
||||
protected $php;
|
||||
@@ -132,7 +133,7 @@ class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\T
|
||||
if (!file_exists($lock) || $force) {
|
||||
$composer = $this->conf->getToolsDir() . DIRECTORY_SEPARATOR . "composer.phar";
|
||||
$composer_cmd = file_exists($lock) ? "update" : "install";
|
||||
$cmd = $composer . " $composer_cmd --no-dev --working-dir=" . $this->conf->getCaseWorkDir($this->getName());
|
||||
$cmd = $this->conf->getToolsDir() . DIRECTORY_SEPARATOR . "composer.phar $composer_cmd --no-dev --working-dir=" . $this->conf->getCaseWorkDir($this->getName());
|
||||
$php->exec($cmd);
|
||||
}
|
||||
|
||||
@@ -154,6 +155,8 @@ class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\T
|
||||
$this->setupUrls();
|
||||
|
||||
echo $this->getName() . " initialization done.\n";
|
||||
echo $this->getName() . " site configured to run under " . $this->getHttpHost() . ":" . $this->getHttpPort() . "\n";
|
||||
echo $this->getName() . " site configured to run under " . $this->getHttpHost() . ":" .$this->getHttpPort() . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,11 +6,12 @@ use SDK\Build\PGO\Abstracts;
|
||||
use SDK\Build\PGO\Interfaces;
|
||||
use SDK\Build\PGO\Config;
|
||||
use SDK\Build\PGO\PHP;
|
||||
use SDK\Exception;
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\Build\PGO\Tool;
|
||||
|
||||
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
|
||||
{
|
||||
protected $conf;
|
||||
protected $base;
|
||||
protected $nginx;
|
||||
protected $maria;
|
||||
@@ -126,6 +127,8 @@ class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\T
|
||||
$this->setupUrls();
|
||||
|
||||
echo $this->getName() . " initialization done.\n";
|
||||
echo $this->getName() . " site configured to run under " . $this->getHttpHost() . ":" . $this->getHttpPort() . "\n";
|
||||
echo $this->getName() . " site configured to run under " . $this->getHttpHost() . ":" .$this->getHttpPort() . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,11 +6,12 @@ use SDK\Build\PGO\Abstracts;
|
||||
use SDK\Build\PGO\Interfaces;
|
||||
use SDK\Build\PGO\Config;
|
||||
use SDK\Build\PGO\PHP;
|
||||
use SDK\Exception;
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\Build\PGO\Tool;
|
||||
|
||||
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
|
||||
{
|
||||
protected $conf;
|
||||
protected $base;
|
||||
protected $nginx;
|
||||
protected $php;
|
||||
@@ -109,6 +110,8 @@ class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\T
|
||||
$this->setupUrls();
|
||||
|
||||
echo $this->getName() . " initialization done.\n";
|
||||
echo $this->getName() . " site configured to run under " . $this->getHttpHost() . ":" . $this->getHttpPort() . "\n";
|
||||
echo $this->getName() . " site configured to run under " . $this->getHttpHost() . ":" .$this->getHttpPort() . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
server {
|
||||
listen PHP_SDK_PGO_SYMFONY_DEMO_HTTP_PORT;
|
||||
server_name PHP_SDK_PGO_SYMFONY_DEMO_HTTP_HOST;
|
||||
|
||||
root PHP_SDK_PGO_SYMFONY_DEMO_DOCROOT;
|
||||
index index.html index.htm index.php;
|
||||
|
||||
# symfony
|
||||
location / {
|
||||
try_files $uri /app.php$is_args$args;
|
||||
}
|
||||
|
||||
location ~ ^/app\.php(/|$) {
|
||||
fastcgi_pass PHP_SDK_PGO_PHP_FCGI_HOST:PHP_SDK_PGO_PHP_FCGI_PORT;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
||||
#internal;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen PHP_SDK_PGO_SYMFONY_DEMO_HTTP_PORT;
|
||||
server_name PHP_SDK_PGO_SYMFONY_DEMO_HTTP_HOST;
|
||||
|
||||
root PHP_SDK_PGO_SYMFONY_DEMO_DOCROOT;
|
||||
index index.html index.htm index.php;
|
||||
|
||||
# symfony
|
||||
location / {
|
||||
try_files $uri /app.php$is_args$args;
|
||||
}
|
||||
|
||||
location ~ ^/app\.php(/|$) {
|
||||
fastcgi_pass PHP_SDK_PGO_PHP_FCGI_HOST:PHP_SDK_PGO_PHP_FCGI_PORT;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
||||
#internal;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,11 +6,12 @@ use SDK\Build\PGO\Abstracts;
|
||||
use SDK\Build\PGO\Interfaces;
|
||||
use SDK\Build\PGO\Config;
|
||||
use SDK\Build\PGO\PHP;
|
||||
use SDK\Exception;
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\Build\PGO\Tool;
|
||||
|
||||
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
|
||||
{
|
||||
protected $conf;
|
||||
protected $base;
|
||||
protected $nginx;
|
||||
protected $maria;
|
||||
@@ -130,6 +131,8 @@ class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\T
|
||||
$this->setupUrls();
|
||||
|
||||
echo $this->getName() . " initialization done.\n";
|
||||
echo $this->getName() . " site configured to run under " . $this->getHttpHost() . ":" . $this->getHttpPort() . "\n";
|
||||
echo $this->getName() . " site configured to run under " . $this->getHttpHost() . ":" .$this->getHttpPort() . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
###> symfony/framework-bundle ###
|
||||
APP_ENV=prod
|
||||
APP_DEBUG=0
|
||||
APP_DEBUG=1
|
||||
APP_SECRET=67d829bf61dc5f87a73fd814e2c9f629
|
||||
###< symfony/framework-bundle ###
|
||||
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
server {
|
||||
listen PHP_SDK_PGO_SYMFONY_DEMO_PDO_MYSQL_HTTP_PORT;
|
||||
server_name PHP_SDK_PGO_SYMFONY_DEMO_PDO_MYSQL_HTTP_HOST;
|
||||
|
||||
root PHP_SDK_PGO_SYMFONY_DEMO_PDO_MYSQL_DOCROOT;
|
||||
index index.html index.htm index.php;
|
||||
|
||||
# symfony
|
||||
location / {
|
||||
try_files $uri /index.php$is_args$args;
|
||||
}
|
||||
|
||||
location ~ ^/index\.php(/|$) {
|
||||
fastcgi_pass PHP_SDK_PGO_PHP_FCGI_HOST:PHP_SDK_PGO_PHP_FCGI_PORT;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
||||
#internal;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen PHP_SDK_PGO_SYMFONY_DEMO_PDO_MYSQL_HTTP_PORT;
|
||||
server_name PHP_SDK_PGO_SYMFONY_DEMO_PDO_MYSQL_HTTP_HOST;
|
||||
|
||||
root PHP_SDK_PGO_SYMFONY_DEMO_PDO_MYSQL_DOCROOT;
|
||||
index index.html index.htm index.php;
|
||||
|
||||
# symfony
|
||||
location / {
|
||||
try_files $uri /index.php$is_args$args;
|
||||
}
|
||||
|
||||
location ~ ^/index\.php(/|$) {
|
||||
fastcgi_pass PHP_SDK_PGO_PHP_FCGI_HOST:PHP_SDK_PGO_PHP_FCGI_PORT;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.*)$;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||||
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
||||
#internal;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"symfony_demo_version": "v1.2.5",
|
||||
"symfony_demo_version": "v1.2.2",
|
||||
"type": "web",
|
||||
"srv_http": "nginx",
|
||||
"srv_db": "mariadb"
|
||||
|
||||
@@ -6,11 +6,12 @@ use SDK\Build\PGO\Abstracts;
|
||||
use SDK\Build\PGO\Interfaces;
|
||||
use SDK\Build\PGO\Config;
|
||||
use SDK\Build\PGO\PHP;
|
||||
use SDK\Exception;
|
||||
use SDK\{Config as SDKConfig, Exception, FileOps};
|
||||
use SDK\Build\PGO\Tool;
|
||||
|
||||
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
|
||||
{
|
||||
protected $conf;
|
||||
protected $base;
|
||||
protected $nginx;
|
||||
protected $maria;
|
||||
@@ -151,6 +152,8 @@ class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\T
|
||||
$this->setupUrls();
|
||||
|
||||
echo $this->getName() . " initialization done.\n";
|
||||
echo $this->getName() . " site configured to run under " . $this->getHttpHost() . ":" . $this->getHttpPort() . "\n";
|
||||
echo $this->getName() . " site configured to run under " . $this->getHttpHost() . ":" .$this->getHttpPort() . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"wp_cli_phar_url": "https://github.com/wp-cli/wp-cli/releases/download/v2.0.0/wp-cli-2.0.0.phar",
|
||||
"wp_cli_phar_url": "https://github.com/wp-cli/wp-cli/releases/download/v1.1.0/wp-cli-1.1.0.phar",
|
||||
"wptest_zip_url": "https://github.com/manovotny/wptest/archive/master.zip",
|
||||
"type": "web",
|
||||
"srv_http": "nginx",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"pkg_url": "https://downloads.mariadb.com/MariaDB/mariadb-5.5.61/win32-packages/mariadb-5.5.61-win32.zip",
|
||||
"pkg_url": "https://downloads.mariadb.com/MariaDB/mariadb-5.5.59/win32-packages/mariadb-5.5.59-win32.zip",
|
||||
"host": "localhost",
|
||||
"port": 3307,
|
||||
"user": "root",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"pkg_url": "http://nginx.org/download/nginx-1.15.2.zip",
|
||||
"pkg_url": "http://nginx.org/download/nginx-1.13.11.zip",
|
||||
"host": "127.0.0.1",
|
||||
"port": 8081
|
||||
}
|
||||
|
||||
@@ -993,8 +993,6 @@ opcache.enable=1
|
||||
;opcache.enable_cli=1
|
||||
opcache.error_log = PHP_SDK_PGO_PHP_ERROR_LOG
|
||||
opcache.log_verbosity_level = 2
|
||||
opcache.file_cache=PHP_SDK_PGO_PHP_OPCACHE_FILE_CACHE
|
||||
opcache.file_cache_fallback=1
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;
|
||||
; Module Settings ;
|
||||
|
||||
@@ -993,8 +993,6 @@ opcache.enable=1
|
||||
;opcache.enable_cli=1
|
||||
opcache.error_log = PHP_SDK_PGO_PHP_ERROR_LOG
|
||||
opcache.log_verbosity_level = 2
|
||||
opcache.file_cache=PHP_SDK_PGO_PHP_OPCACHE_FILE_CACHE
|
||||
opcache.file_cache_fallback=1
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;
|
||||
; Module Settings ;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@
|
||||
|
||||
"fcgi:env": {
|
||||
"PHP_FCGI_CHILDREN": 8,
|
||||
"PHP_FCGI_MAX_REQUESTS": 0
|
||||
"PHP_FCGI_MAX_REQUESTS": 128
|
||||
},
|
||||
|
||||
"scenario":
|
||||
|
||||
Reference in New Issue
Block a user