Skip to content
GitLab
Explore
Sign in
project
provision
Compare revisions
2caff8686973f1ee3264b8eef6243ebae85964bf to php-server
Commits on Source (4)
Adding ServiceInterface.
· 6a18d444
Jon Pugh
authored
Nov 28, 2017
6a18d444
Adding ProcessAwareTrait.
· 8c6a3715
Jon Pugh
authored
Nov 28, 2017
8c6a3715
Adding PhpServer
· 33cbdea7
Jon Pugh
authored
Nov 28, 2017
33cbdea7
Merge branch 'php-server' of github.com:aegir-project/provision into php-server
· 7918e2fb
Jon Pugh
authored
Dec 01, 2017
7918e2fb
Hide whitespace changes
Inline
Side-by-side
src/Common/ProcessAwareTrait.php
0 → 100644
View file @
7918e2fb
<?php
namespace
Aegir\Provision\Common
;
use
Aegir\Provision\Context
;
use
Symfony\Component\Process\Process
;
use
Twig\Node\Expression\Unary\NegUnary
;
trait
ProcessAwareTrait
{
/**
* @var Process
*/
protected
$process
=
NULL
;
// /**
// * @var string
// */
// protected $command;
/**
* @param Process $process
*
* @return $this
*/
protected
function
setProcess
(
Process
$process
=
NULL
)
{
$this
->
process
=
$process
;
return
$this
;
}
/**
* @return Process
*/
public
function
getProcess
()
{
if
(
is_null
(
$this
->
process
))
{
$this
->
process
=
new
Process
(
$this
->
command
);
}
return
$this
->
process
;
}
/**
* @param $command
*
* @return $this
*/
public
function
setCommand
(
$command
)
{
$this
->
command
=
$command
;
return
$this
;
}
/**
* @return string
*/
public
function
getCommand
()
{
return
$this
->
command
;
}
public
function
execute
()
{
$this
->
process
->
run
();
}
}
src/Service/Http/Php/PhpServer.php
0 → 100644
View file @
7918e2fb
<?php
namespace
Aegir\Provision\Service\Http\Php
;
use
Robo\Common\ExecCommand
;
use
Robo\Common\ExecTrait
;
class
PhpServer
extends
\Robo\Task\Development\PhpServer
{
/**
* @var int
*/
protected
$port
;
/**
* @var string
*/
protected
$host
=
'127.0.0.1'
;
/**
* @var string
*/
protected
$command
=
'php -S %s:%d '
;
/**
* @param int $port
*/
public
function
__construct
(
$port
)
{
$this
->
port
=
$port
;
if
(
strtolower
(
PHP_OS
)
===
'linux'
)
{
$this
->
command
=
'exec php -S %s:%d '
;
}
}
/**
* @param string $host
*
* @return $this
*/
public
function
host
(
$host
)
{
$this
->
host
=
$host
;
return
$this
;
}
/**
* @param string $path
*
* @return $this
*/
public
function
dir
(
$path
)
{
$this
->
command
.
=
"-t
$path
"
;
return
$this
;
}
/**
* {@inheritdoc}
*/
public
function
getCommand
()
{
return
sprintf
(
$this
->
command
,
$this
->
host
,
$this
->
port
);
}
public
function
run
()
{
$this
->
executeCommand
(
$this
->
getCommand
());
}
public
function
getProcess
()
{
return
$this
->
process
;
}
public
function
task
()
{
}
}
\ No newline at end of file
src/ServiceInterface.php
0 → 100644
View file @
7918e2fb
<?php
namespace
Aegir\Provision
;
interface
ServiceInterface
{
/**
* Triggered on `provision verify` command on Site contexts.
*/
public
function
verifySite
();
/**
* Triggered on `provision verify` command on Platform contexts.
*/
public
function
verifyPlatform
();
/**
* Triggered on `provision verify` command on Site contexts.
*/
public
function
verifyServer
();
}
\ No newline at end of file