class SecurityUpdateCommands extends DrushCommands (View source)

Check Drupal Composer packages for security updates.

Traits

ProcessManagerAwareTrait
LoggerAwareTrait
IO
ConfigAwareTrait

Constants

REQ

OPT

EXIT_SUCCESS

EXIT_FAILURE

EXIT_FAILURE_WITH_CLARITY

Properties

protected CommandData $commandData from  DrushCommands

Methods

getConfig()

Replaces same method in ConfigAwareTrait in order to provide a DrushConfig as return type. Helps with IDE completion.

__construct()

No description

io()

Override Robo's IO function with our custom style.

LoggerInterface
logger()

Returns a logger object.

printFile(string $file)

Print the contents of a file.

preHook(CommandData $commandData)

Persist commandData for use in primary command callback. Used by 'topic' commands.

printFileTopic(CommandData $commandData)

Print the contents of a file. The path comes from the @topic annotation.

HandlerStack
getStack()

Get a Guzzle handler stack that uses the Drush logger.

static string
composerLockPath()

Return path to composer.lock

RowsOfFields
security()

Check Drupal Composer packages for pending security updates.

suggestComposerCommand($updates)

Emit suggested Composer command for security updates.

mixed
fetchAdvisoryComposerJson()

Fetches the generated composer.json from drupal-security-advisories.

array
loadSiteComposerLock()

Loads the contents of the local Drupal application's composer.lock file.

array
calculateSecurityUpdates(array $composer_lock_data, array $security_advisories_composer_json)

Return available security updates.

UnstructuredData
securityPhp(array $options = ['format' => 'yaml'])

Check non-Drupal PHP packages for pending security updates.

Details

DrushConfig getConfig()

Replaces same method in ConfigAwareTrait in order to provide a DrushConfig as return type. Helps with IDE completion.

__construct()

protected io()

Override Robo's IO function with our custom style.

protected LoggerInterface logger()

Returns a logger object.

Return Value

LoggerInterface

protected printFile(string $file)

Print the contents of a file.

Parameters

string $file Full path to a file.

preHook(CommandData $commandData)

Persist commandData for use in primary command callback. Used by 'topic' commands.

Parameters

CommandData $commandData

protected printFileTopic(CommandData $commandData)

Print the contents of a file. The path comes from the @topic annotation.

Parameters

CommandData $commandData Full path to a file.

protected HandlerStack getStack()

Get a Guzzle handler stack that uses the Drush logger.

static string composerLockPath()

Return path to composer.lock

Return Value

string

Exceptions

Exception

RowsOfFields security()

Check Drupal Composer packages for pending security updates.

This uses the Drupal security advisories package to determine if updates are available. An exit code of 3 indicates that the check completed, and insecure packages were found.

Return Value

RowsOfFields

Exceptions

Exception

suggestComposerCommand($updates)

Emit suggested Composer command for security updates.

Parameters

$updates

protected mixed fetchAdvisoryComposerJson()

Fetches the generated composer.json from drupal-security-advisories.

Return Value

mixed

Exceptions

Exception

protected array loadSiteComposerLock()

Loads the contents of the local Drupal application's composer.lock file.

Return Value

array

Exceptions

Exception

protected array calculateSecurityUpdates(array $composer_lock_data, array $security_advisories_composer_json)

Return available security updates.

Parameters

array $composer_lock_data The contents of the local Drupal application's composer.lock file.
array $security_advisories_composer_json The composer.json array from drupal-security-advisories.

Return Value

array

UnstructuredData securityPhp(array $options = ['format' => 'yaml'])

Check non-Drupal PHP packages for pending security updates.

Packages are discovered via composer.lock file. An exit code of 3 indicates that the check completed, and insecure packages were found.

Thanks to https://github.com/FriendsOfPHP/security-advisories and Symfony for providing this service.

Parameters

array $options

Return Value

UnstructuredData

Exceptions

Exception