Skip to content
GitLab
Explore
Sign in
project
provision
Compare revisions
ba547cdf3d4e8f8ce2887cfbe12a7fdced9f534c to php-server
Hide whitespace changes
Inline
Side-by-side
src/Service/HttpService.php
View file @
7918e2fb
...
...
@@ -11,6 +11,7 @@ namespace Aegir\Provision\Service;
//require_once DRUSH_BASE_PATH . '/commands/core/rsync.core.inc';
use
Aegir\Provision\Service
;
use
Aegir\Provision\ServiceInterface
;
use
Aegir\Provision\ServiceSubscription
;
use
Consolidation\AnnotatedCommand\CommandFileDiscovery
;
...
...
@@ -19,7 +20,7 @@ use Consolidation\AnnotatedCommand\CommandFileDiscovery;
*
* @package Aegir\Provision\Service
*/
class
HttpService
extends
Service
{
class
HttpService
extends
Service
implements
ServiceInterface
{
const
SERVICE
=
'http'
;
const
SERVICE_NAME
=
'Web Server'
;
...
...
@@ -57,7 +58,7 @@ class HttpService extends Service {
*
* This is used to allow skipping of the service restart.
*/
function
verify
Provid
er
()
function
verify
Serv
er
()
{
return
[
'configuration'
=>
$this
->
writeConfigurations
(),
...
...
@@ -67,14 +68,18 @@ class HttpService extends Service {
/**
* React to the `provision verify` command on Server contexts
*/
function
verifyS
ubscription
(
ServiceSubscription
$serviceSubscription
)
{
$this
->
subscription
=
$
service
Subscription
;
function
verifyS
ite
(
)
{
$this
->
subscription
=
$
this
->
getContext
()
->
get
Subscription
()
;
return
[
'configuration'
=>
$this
->
writeConfigurations
(
$
serviceS
ubscription
),
'configuration'
=>
$this
->
writeConfigurations
(
$
this
->
s
ubscription
),
'service'
=>
$this
->
restartService
(),
];
}
//
function
verifyPlatform
()
{
}
//
// /**
// * Support the ability to cloak the database credentials using environment variables.
// */
...
...
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
src/ServiceSubscription.php
View file @
7918e2fb
...
...
@@ -9,6 +9,9 @@
namespace
Aegir\Provision
;
use
Aegir\Provision\Common\ContextAwareTrait
;
use
Aegir\Provision\Common\ProvisionAwareTrait
;
class
ServiceSubscription
{
public
$context
;
...
...
@@ -16,10 +19,19 @@ class ServiceSubscription {
public
$server
;
public
$type
;
public
$properties
=
[];
use
ProvisionAwareTrait
;
use
ContextAwareTrait
;
function
__construct
(
$context
,
$server
,
$service_name
)
{
$this
->
context
=
$context
;
$this
->
server
=
Application
::
getContext
(
$server
,
$context
->
application
);
function
__construct
(
Context
$context
,
$server
,
$service_name
)
{
$this
->
setContext
(
$context
);
$this
->
setProvision
(
$context
->
getProvision
());
$this
->
server
=
$this
->
getProvision
()
->
getContext
(
$server
);
$this
->
service
=
$this
->
server
->
getService
(
$service_name
);
$this
->
type
=
$this
->
server
->
getService
(
$service_name
)
->
type
;
...
...
@@ -35,4 +47,21 @@ class ServiceSubscription {
public
function
getFriendlyName
()
{
return
$this
->
service
->
getFriendlyName
();
}
/**
* Get a specific property.
*
* @param $name
* @return mixed
* @throws \Exception
*/
public
function
getProperty
(
$name
)
{
if
(
isset
(
$this
->
properties
[
$name
]))
{
return
$this
->
properties
[
$name
];
}
else
{
throw
new
\Exception
(
"Property '
$name
' on Service Subscription does not exist."
);
}
}
}
Prev
1
2
3
Next