You are here

public function Info::execute in DRD Agent 8.3

Same name and namespace in other branches
  1. 4.0.x src/Agent/Action/Info.php \Drupal\drd_agent\Agent\Action\Info::execute()

Execute an action.

Return value

mixed The response of the action as an array which will be encrypted before returned to DRD.

Overrides Base::execute

File

src/Agent/Action/Info.php, line 18

Class

Info
Provides a 'Info' code.

Namespace

Drupal\drd_agent\Agent\Action

Code

public function execute() {
  $config = $this->configFactory
    ->get('system.site');

  // Initial set of information.
  $result = [
    'root' => DRUPAL_ROOT,
    'version' => Drupal::VERSION,
    'name' => $config
      ->get('name'),
    'globals' => [],
    'settings' => Settings::getAll(),
    'review' => SecurityReview::create($this->container)
      ->collect(),
    'monitoring' => Monitoring::create($this->container)
      ->collect(),
  ];

  // Check run-time requirements and status information.
  if ($systemManager = $this->container
    ->get('system.manager')) {
    $result['requirements'] = $systemManager
      ->listRequirements();
  }
  $result['variables'] = $GLOBALS['config'];
  foreach ($GLOBALS as $key => $value) {
    if (!in_array($key, [
      'config',
      'GLOBALS',
      'autoloader',
      'kernel',
      'request',
    ])) {
      $result['globals'][$key] = $value;
    }
  }
  return $result;
}