some minor improvements drop unused imports, unused variables, dirname(__FILE__) -> __DIR__, cs fixes, ...

revert some non-obvious getters, explicit specification of abstract classes

null -> NULL

4 space -> tab
This commit is contained in:
Gemorroj 2018-08-06 00:45:55 +03:00 коммит произвёл Anatol Belski
Родитель e494a28d4c
Коммит 1b8473489f
37 изменённых файлов: 142 добавлений и 210 удалений

Просмотреть файл

@ -1,6 +1,6 @@
<?php
include dirname(__FILE__) . "/../lib/php/autoload.php";
include __DIR__ . "/../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 dirname(__FILE__) . "/../lib/php/autoload.php";
include __DIR__ . "/../lib/php/autoload.php";
use SDK\Config;
use SDK\Exception;
@ -21,43 +21,42 @@ 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;
}
}

Просмотреть файл

@ -1,7 +1,7 @@
<?php
spl_autoload_register(function($name) {
$fl = dirname(__FILE__) . DIRECTORY_SEPARATOR . "libsdk" . DIRECTORY_SEPARATOR . $name . ".php";
$fl = __DIR__ . DIRECTORY_SEPARATOR . "libsdk" . DIRECTORY_SEPARATOR . $name . ".php";
if (file_exists($fl)) {
require_once $fl;

Просмотреть файл

@ -2,7 +2,7 @@
namespace SDK\Build\Dependency;
use SDK\{Config, Exception, FileOps};
use SDK\{Exception, FileOps};
class Fetcher
{
@ -13,6 +13,7 @@ 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)
@ -22,6 +23,7 @@ class Fetcher
$this->host = $host;
$this->port = $port;
$this->scheme = $scheme;
$this->series = $series;
}/*}}}*/
public function getSeries() : Series

Просмотреть файл

@ -11,6 +11,7 @@ class Manager
protected $stability;
protected $arch;
protected $path;
protected $cache;
protected $series;
protected $fetcher;
protected $updatesFlag = NULL;
@ -41,7 +42,7 @@ class Manager
public function updatesAvailable() : bool
{/*{{{*/
if (!is_null($this->updatesFlag)) {
if (NULL !== $this->updatesFlag) {
return $this->updatesFlag;
}

Просмотреть файл

@ -44,7 +44,6 @@ 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,10 +2,8 @@
namespace SDK\Build\PGO\Abstracts;
use SDK\Build\PGO\Interfaces\Server;
use SDK\Build\PGO\PHP\CLI;
use SDK\Build\PGO\Config as PGOConfig;
use SDK\{Config as SDKConfig, Exception, FileOps};
use SDK\{Config as SDKConfig, Exception};
abstract class PHP
{
@ -13,6 +11,8 @@ abstract class PHP
protected $php_ext_root;
protected $opcache_file_cache;
protected $id;
protected $scenario;
protected $conf;
protected function setupPaths()
{
@ -44,7 +44,7 @@ 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;
}
}
@ -110,7 +110,7 @@ abstract class PHP
}
}
if (is_null($ret)) {
if (NULL === $ret) {
throw new Exception("Failed to determine the test PHP version.");
}
@ -194,8 +194,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 +223,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"),
@ -244,4 +244,3 @@ abstract class PHP
. "-" . substr(md5(uniqid()), 0, 8);
}
}

Просмотреть файл

@ -4,7 +4,7 @@ namespace SDK\Build\PGO\Abstracts;
use SDK\Build\PGO\Interfaces;
class Server
abstract class Server
{
public function getName() : string
{
@ -17,6 +17,3 @@ class Server
}
}

Просмотреть файл

@ -2,11 +2,10 @@
namespace SDK\Build\PGO\Abstracts;
use SDK\Build\PGO\Config as PGOConfig;
use SDK\{Config as SDKConfig, Exception, FileOps};
use SDK\FileOps;
use SDK\Build\PGO\Tool;
class TrainingCase
abstract class TrainingCase
{
use FileOps;
@ -14,6 +13,8 @@ class TrainingCase
const TYPE_CLI = "cli";
protected $stat = array();
/** @var \SDK\Build\PGO\Config */
protected $conf;
public function getType() : string
{
@ -148,4 +149,3 @@ class TrainingCase
return $ret;
}
}

Просмотреть файл

@ -2,7 +2,7 @@
namespace SDK\Build\PGO;
use SDK\{Config as SDKConfig, Exception};
use SDK\Exception;
class Config
{
@ -18,7 +18,7 @@ class Config
protected $tpl_vars = array();
protected $srv = array();
public function __construct(int $mode = MODE_RUN)
public function __construct(int $mode = self::MODE_RUN)
{
if (self::MODE_CHECK_INIT == $mode) {
// XXX The check is simple right now, so this is sufficient.
@ -40,7 +40,6 @@ 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);
@ -279,7 +278,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 '$fn' doesn't exist.");
throw new Exception("Template file '$tpl_fn' doesn't exist.");
}
$s = file_get_contents($tpl_fn);
@ -368,4 +367,3 @@ class Config
return $ret;
}
}

Просмотреть файл

@ -2,13 +2,12 @@
namespace SDK\Build\PGO;
use SDK\{Config as SDKConfig, Exception, Lock};
use SDK\{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 */
@ -79,38 +78,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;
}
}

Просмотреть файл

@ -2,7 +2,6 @@
namespace SDK\Build\PGO\Interfaces;
use SDK\Build\PGO\Config;
use SDK\Build\PGO\Tool\PackageWorkman;
interface PHP
@ -15,4 +14,3 @@ interface PHP
public function getVersion(bool $short = false) : string;
public function getExeFilename() : string;
}

Просмотреть файл

@ -2,7 +2,6 @@
namespace SDK\Build\PGO\Interfaces;
use SDK\Build\PGO\Config;
use SDK\Build\PGO\Tool\PackageWorkman;
interface Server
@ -14,4 +13,3 @@ interface Server
public function down(bool $force = false) : void;
public function getName() : string;
}

Просмотреть файл

@ -10,4 +10,3 @@ interface DB extends Interfaces\Server
public function __construct(Config $conf);
public function query(string $s, string $db = NULL) : void;
}

Просмотреть файл

@ -11,4 +11,3 @@ interface HTTP extends Interfaces\Server
public function getPhp() : Interfaces\PHP;
public function addServer(string $part_tpl_fn, array $tpl_vars = array());
}

Просмотреть файл

@ -25,4 +25,3 @@ interface TrainingCase
/* Get training type, it's like "web", "cli", etc.*/
public function getType() : string;
}

Просмотреть файл

@ -5,13 +5,11 @@ namespace SDK\Build\PGO\PHP;
use SDK\Build\PGO\Interfaces;
use SDK\Build\PGO\Abstracts;
use SDK\Build\PGO\Config as PGOConfig;
use SDK\{Config as SDKConfig, Exception, FileOps};
use SDK\{Exception};
use SDK\Build\PGO\Tool\PackageWorkman;
class CLI extends Abstracts\PHP implements Interfaces\PHP
{
protected $conf;
public function __construct(PGOConfig $conf)
{
$this->conf = $conf;
@ -54,7 +52,4 @@ class CLI extends Abstracts\PHP implements Interfaces\PHP
return $exe;
}
}

Просмотреть файл

@ -5,14 +5,13 @@ namespace SDK\Build\PGO\PHP;
use SDK\Build\PGO\Interfaces;
use SDK\Build\PGO\Abstracts;
use SDK\Build\PGO\Config as PGOConfig;
use SDK\{Config as SDKConfig, Exception, FileOps};
use SDK\{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)
@ -127,4 +126,3 @@ echo "PHP FCGI initialization done.\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\{Config as SDKConfig, Exception, FileOps};
use SDK\{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" : "";
$ret = shell_exec(".\\bin\\mysql.exe -u $user $pass_arg -h $host -P $port $db_arg -e \"$s\"");
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,9 +136,8 @@ class MariaDB extends Server implements DB
$pass_arg = $pass ? "-p$pass " : "";
$db_arg = $db ? "-D $db" : "";
$ret = shell_exec(".\\bin\\mysql.exe -u $user $pass_arg -h $host -P $port $db_arg < \"$path\"");
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\{Config as SDKConfig, Exception, FileOps};
use SDK\{Exception, FileOps};
use SDK\Build\PGO\Tool\PackageWorkman;
class NGINX extends Abstracts\Server implements Interfaces\Server\HTTP
@ -29,7 +29,6 @@ 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();
@ -148,4 +147,3 @@ 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\{Config as SDKConfig, Exception, FileOps};
use SDK\{Exception, FileOps};
use SDK\Build\PGO\Tool\PackageWorkman;
class PostgreSQL extends Server implements DB
@ -90,10 +90,6 @@ 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);
@ -108,7 +104,6 @@ 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");
@ -119,7 +114,6 @@ 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");
@ -132,13 +126,11 @@ 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\"";
$ret = shell_exec($cmd);
shell_exec($cmd);
}
}

Просмотреть файл

@ -2,7 +2,7 @@
namespace SDK\Build\PGO\Tool;
use SDK\{Config as SDKConfig, Exception};
use SDK\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);
`pgosweep $base $pgc`;
shell_exec("pgosweep $base $pgc");
//passthru("pgosweep $base $pgc");
if ($merge) {
`pgomgr /merge:1000 $pgc $pgd`;
shell_exec("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,10 +98,9 @@ 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) {
`pgomgr /clear $pgd`;
shell_exec("pgomgr /clear $pgd");
//passthru("pgomgr /clear $pgd");
}
}
}
}

Просмотреть файл

@ -2,7 +2,7 @@
namespace SDK\Build\PGO\Tool;
use SDK\{Config as SDKConfig, Exception, FileOps};
use SDK\{Exception, FileOps};
use SDK\Build\PGO\Config as PGOConfig;
@ -47,11 +47,10 @@ 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, Server, Server\DB, PHP};
use SDK\Build\PGO\Interfaces\TrainingCase;
class Training
{
@ -15,8 +15,9 @@ class Training
{
$this->conf = $conf;
$this->t_case = $t_case;
if (!in_array($this->t_case->getType(), array("web", "cli"))) {
$type = $this->t_case->getType();
if (!in_array($type, array("web", "cli"))) {
throw new Exception("Unknown training type '$type'.");
}
}
@ -107,8 +108,7 @@ 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,7 +2,6 @@
namespace SDK\Build\PGO;
use SDK\{Config as SDKConfig, Exception, FileOps};
use SDK\Build\PGO\Config as PGOConfig;
@ -21,7 +20,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;
}
@ -53,7 +52,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. */
@ -97,6 +96,4 @@ class TrainingCaseIterator implements \Iterator
return $this->el->getName();
}
}

Просмотреть файл

@ -2,10 +2,6 @@
namespace SDK;
use SDK\Config;
use SDK\Cache;
use SDK\Exception;
class Cache
{
protected $id;
@ -48,7 +44,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
@ -64,7 +60,7 @@ class Cache
do {
$got = fwrite($fd, substr($content, $wrote));
if (false == $got) {
if (false === $got) {
break;
}
$wrote += $got;

Просмотреть файл

@ -3,8 +3,6 @@
namespace SDK;
use SDK\Build\Dependency\Fetcher;
use SDK\Cache;
use SDK\Exception;
class Config
{

Просмотреть файл

@ -2,9 +2,6 @@
namespace SDK;
use SDK\Config;
use SDK\Exception;
trait FileOps
{
protected function md(string $name = "", bool $tmp = false) : string
@ -193,7 +190,7 @@ trait FileOps
$name = substr($name, 0, -1);*/
$name = rtrim($stat["name"], "/");
while (strchr($name, '/') !== false) {
while (strstr($name, '/') !== false) {
$name = dirname($name);
}

Просмотреть файл

@ -2,8 +2,6 @@
namespace SDK;
use SDK\{Config, Exception};
class Lock
{
protected $fd;

Просмотреть файл

@ -6,12 +6,11 @@ use SDK\Build\PGO\Abstracts;
use SDK\Build\PGO\Interfaces;
use SDK\Build\PGO\Config;
use SDK\Build\PGO\PHP;
use SDK\{Config as SDKConfig, Exception, FileOps};
use SDK\Exception;
use SDK\Build\PGO\Tool;
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
{
protected $conf;
protected $base;
protected $nginx;
protected $php;
@ -107,7 +106,7 @@ class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\T
$composer = $this->conf->getToolsDir() . DIRECTORY_SEPARATOR . "composer.phar";
$cmd = $this->conf->getToolsDir() . DIRECTORY_SEPARATOR . "composer.phar create-project drupal-composer/drupal-project:8.x-dev {$this->base} --stability dev --no-interaction";
$cmd = $composer . " create-project drupal-composer/drupal-project:8.x-dev {$this->base} --stability dev --no-interaction";
$php->exec($cmd);
}
@ -119,8 +118,6 @@ 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,12 +6,11 @@ use SDK\Build\PGO\Abstracts;
use SDK\Build\PGO\Interfaces;
use SDK\Build\PGO\Config;
use SDK\Build\PGO\PHP;
use SDK\{Config as SDKConfig, Exception, FileOps};
use SDK\Exception;
use SDK\Build\PGO\Tool;
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
{
protected $conf;
protected $base;
protected $nginx;
protected $php;
@ -176,8 +175,6 @@ 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,12 +6,11 @@ use SDK\Build\PGO\Abstracts;
use SDK\Build\PGO\Interfaces;
use SDK\Build\PGO\Config;
use SDK\Build\PGO\PHP;
use SDK\{Config as SDKConfig, Exception, FileOps};
use SDK\Exception;
use SDK\Build\PGO\Tool;
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
{
protected $conf;
protected $base;
protected $nginx;
protected $php;
@ -133,7 +132,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 = $this->conf->getToolsDir() . DIRECTORY_SEPARATOR . "composer.phar $composer_cmd --no-dev --working-dir=" . $this->conf->getCaseWorkDir($this->getName());
$cmd = $composer . " $composer_cmd --no-dev --working-dir=" . $this->conf->getCaseWorkDir($this->getName());
$php->exec($cmd);
}
@ -155,8 +154,6 @@ 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,12 +6,11 @@ use SDK\Build\PGO\Abstracts;
use SDK\Build\PGO\Interfaces;
use SDK\Build\PGO\Config;
use SDK\Build\PGO\PHP;
use SDK\{Config as SDKConfig, Exception, FileOps};
use SDK\Exception;
use SDK\Build\PGO\Tool;
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
{
protected $conf;
protected $base;
protected $nginx;
protected $maria;
@ -127,8 +126,6 @@ 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,12 +6,11 @@ use SDK\Build\PGO\Abstracts;
use SDK\Build\PGO\Interfaces;
use SDK\Build\PGO\Config;
use SDK\Build\PGO\PHP;
use SDK\{Config as SDKConfig, Exception, FileOps};
use SDK\Exception;
use SDK\Build\PGO\Tool;
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
{
protected $conf;
protected $base;
protected $nginx;
protected $php;
@ -110,8 +109,6 @@ 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,12 +6,11 @@ use SDK\Build\PGO\Abstracts;
use SDK\Build\PGO\Interfaces;
use SDK\Build\PGO\Config;
use SDK\Build\PGO\PHP;
use SDK\{Config as SDKConfig, Exception, FileOps};
use SDK\Exception;
use SDK\Build\PGO\Tool;
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
{
protected $conf;
protected $base;
protected $nginx;
protected $maria;
@ -131,8 +130,6 @@ 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,12 +6,11 @@ use SDK\Build\PGO\Abstracts;
use SDK\Build\PGO\Interfaces;
use SDK\Build\PGO\Config;
use SDK\Build\PGO\PHP;
use SDK\{Config as SDKConfig, Exception, FileOps};
use SDK\Exception;
use SDK\Build\PGO\Tool;
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
{
protected $conf;
protected $base;
protected $nginx;
protected $maria;
@ -152,8 +151,6 @@ 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";
}
}