class Projects in DRD Agent 8.3
Same name and namespace in other branches
- 4.0.x src/Agent/Action/Projects.php \Drupal\drd_agent\Agent\Action\Projects
Provides a 'Projects' code.
Hierarchy
- class \Drupal\drd_agent\Agent\Action\Base implements ContainerInjectionInterface, BaseInterface
- class \Drupal\drd_agent\Agent\Action\Projects
Expanded class hierarchy of Projects
File
- src/
Agent/ Action/ Projects.php, line 11
Namespace
Drupal\drd_agent\Agent\ActionView source
class Projects extends Base {
/**
* {@inheritdoc}
*/
public function execute() {
$projects = [];
// Core.
$projects[] = [
'name' => 'drupal',
'type' => 'core',
'status' => 1,
'info' => [
'core' => '8.x',
'version' => Drupal::VERSION,
'project' => 'drupal',
'hidden' => FALSE,
],
];
// Modules.
/** @noinspection NullPointerExceptionInspection */
foreach ($this->container
->get('extension.list.module')
->reset()
->getList() as $name => $extension) {
$this
->buildProjectInfo($projects, 'module', $name, $extension);
}
// Themes.
/** @noinspection NullPointerExceptionInspection */
foreach ($this->container
->get('theme_handler')
->rebuildThemeData() as $name => $extension) {
$this
->buildProjectInfo($projects, 'theme', $name, $extension);
}
// Integration with the Hacked module.
if ($this->moduleHandler
->moduleExists('hacked')) {
$this
->checkHacked($projects);
}
return $projects;
}
/**
* Build project info array which is common across Drupal core versions.
*
* @param array $projects
* List of projects to which a new project get appended.
* @param string $type
* Type of the project (core, module, theme, etc.).
* @param string $name
* Name of the project.
* @param \Drupal\Core\Extension\Extension $extension
* Object with further details about the project.
*/
private function buildProjectInfo(array &$projects, $type, $name, $extension) {
/** @noinspection PhpUndefinedFieldInspection */
$projects[] = [
'name' => $name,
'type' => $type,
'status' => $extension->status,
'info' => $extension->info,
];
}
/**
* Verify each project if it got hacked.
*
* @param array $projects
* The list of projects.
*/
private function checkHacked(array &$projects) {
foreach ($projects as &$project) {
$hacked = new hackedProject($project['name']);
$project['hacked'] = [
'report' => $hacked
->compute_report(),
];
$project['hacked']['status'] = $project['hacked']['report']['status'] === HACKED_STATUS_HACKED;
}
}
}
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. | |
Projects:: |
private | function | Build project info array which is common across Drupal core versions. | |
Projects:: |
private | function | Verify each project if it got hacked. | |
Projects:: |
public | function |
Execute an action. Overrides Base:: |