class DomainsEnableAll in DRD Agent 4.0.x
Same name and namespace in other branches
- 8.3 src/Agent/Action/DomainsEnableAll.php \Drupal\drd_agent\Agent\Action\DomainsEnableAll
Provides a 'DomainsEnableAll' code.
Hierarchy
- class \Drupal\drd_agent\Agent\Action\Base implements ContainerInjectionInterface, BaseInterface
- class \Drupal\drd_agent\Agent\Action\DomainsEnableAll
Expanded class hierarchy of DomainsEnableAll
File
- src/
Agent/ Action/ DomainsEnableAll.php, line 8
Namespace
Drupal\drd_agent\Agent\ActionView source
class DomainsEnableAll extends Base {
/**
* {@inheritdoc}
*/
public function execute() {
$args = $this
->getArguments();
$result = [];
$drush = $drupalconsole = FALSE;
if (!empty($args['drush'])) {
exec($args['drush'] . ' --version', $output, $ret);
$drush = $ret === 0;
}
if (!empty($args['drupalconsole'])) {
exec($args['drupalconsole'] . ' --version', $output, $ret);
$drupalconsole = $ret === 0;
}
if ($drush || $drupalconsole) {
foreach ($args['urls'] as $url => $token) {
$success = FALSE;
if ($drush) {
exec($args['drush'] . ' -y --uri=' . $url . ' --root=' . DRUPAL_ROOT . ' pm-enable drd_agent', $output, $ret);
if ($ret === 0) {
exec($args['drush'] . ' -y --uri=' . $url . ' --root=' . DRUPAL_ROOT . ' drd-agent-setup ' . $token, $output, $ret1);
if ($ret1 === 0) {
$success = TRUE;
}
}
}
if (!$success && $drupalconsole) {
exec($args['drupalconsole'] . ' module:install -y --uri=' . $url . ' --root=' . DRUPAL_ROOT . ' drd_agent', $output, $ret);
if ($ret === 0) {
exec($args['drupalconsole'] . ' -y --uri=' . $url . ' --root=' . DRUPAL_ROOT . ' drd:agent:setup ' . $token, $output, $ret1);
if ($ret1 === 0) {
$success = TRUE;
}
}
}
if ($success) {
$result[] = $url;
}
}
}
return $result;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Base:: |
protected | property | ||
Base:: |
private | property | ||
Base:: |
protected | property | ||
Base:: |
protected | property | ||
Base:: |
protected | property | Crypt object for this DRD request. | |
Base:: |
protected | property | ||
Base:: |
private | property | ||
Base:: |
protected | property | ||
Base:: |
protected | property | ||
Base:: |
protected | property | ||
Base:: |
protected | property | ||
Base:: |
protected | property | ||
Base:: |
protected | property | ||
Base:: |
protected | property | ||
Base:: |
private | function | Authenticate the request or throw an exception. | |
Base:: |
public | function |
Authorize the DRD instance, all validations have passed successfully. Overrides BaseInterface:: |
|
Base:: |
public | function | Callback to authorize a DRD instance with a given secret. | |
Base:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
Base:: |
public | function |
Get the arguments for this request. Overrides BaseInterface:: |
|
Base:: |
public | function |
Get authorised Crypt object or FALSE if none is available. Overrides BaseInterface:: |
|
Base:: |
public | function |
Get an array of database connection information. Overrides BaseInterface:: |
|
Base:: |
public | function |
Get the debug mode. Overrides BaseInterface:: |
|
Base:: |
public | function |
Overrides BaseInterface:: |
|
Base:: |
public | function |
Overrides BaseInterface:: |
|
Base:: |
public | function |
Validate a one-time-token. Overrides BaseInterface:: |
|
Base:: |
public | function |
Change current session to user 1. Overrides BaseInterface:: |
|
Base:: |
private | function | Read and decode the input from the POST request. | |
Base:: |
public | function |
Overrides BaseInterface:: |
|
Base:: |
public | function | Main callback to execute an action. | |
Base:: |
constant | |||
Base:: |
constant | |||
Base:: |
constant | |||
Base:: |
public | function |
Set the debug mode. Overrides BaseInterface:: |
|
Base:: |
private | function | Recursivly convert request arguments to an array. | |
Base:: |
public | function |
Logging if in debug mode. Overrides BaseInterface:: |
|
Base:: |
public | function | Base constructor. | |
DomainsEnableAll:: |
public | function |
Execute an action. Overrides Base:: |