function PackageManagerRequirementsHooks::checkFailure
Check for a failed update.
This is run during requirements to allow restoring from backup.
Parameters
array $requirements: The requirements array that has been processed so far.
Return value
array Requirements array.
See also
hook_runtime_requirements
hook_update_requirements
2 calls to PackageManagerRequirementsHooks::checkFailure()
- PackageManagerRequirementsHooks::runtime in core/
modules/ package_manager/ src/ Hook/ PackageManagerRequirementsHooks.php - Implements hook_runtime_requirements().
- PackageManagerRequirementsHooks::update in core/
modules/ package_manager/ src/ Hook/ PackageManagerRequirementsHooks.php - Implements hook_update_requirements().
File
-
core/
modules/ package_manager/ src/ Hook/ PackageManagerRequirementsHooks.php, line 114
Class
- PackageManagerRequirementsHooks
- Requirements checks for Package Manager.
Namespace
Drupal\package_manager\HookCode
public function checkFailure(array $requirements) : array {
// If we're able to check for the presence of the failure marker at all, do
// it irrespective of the current run phase. If the failure marker is there,
// the site is in an indeterminate state and should be restored from backup
// ASAP.
$service_id = FailureMarker::class;
if (\Drupal::hasService($service_id)) {
try {
\Drupal::service($service_id)->assertNotExists(NULL);
} catch (FailureMarkerExistsException $exception) {
$requirements['package_manager_failure_marker'] = [
'title' => $this->t('Failed Package Manager update detected'),
'description' => $exception->getMessage(),
'severity' => REQUIREMENT_ERROR,
];
}
}
return $requirements;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.