function FailureMarker::write
Same name and namespace in other branches
- 11.x core/modules/package_manager/src/FailureMarker.php \Drupal\package_manager\FailureMarker::write()
Writes data to marker file.
Parameters
\Drupal\package_manager\SandboxManagerBase $sandbox_manager: The stage.
\Drupal\Core\StringTranslation\TranslatableMarkup $message: Failure message to be added.
\Throwable|null $throwable: (optional) The throwable that caused the failure.
File
-
core/
modules/ package_manager/ src/ FailureMarker.php, line 60
Class
- FailureMarker
- Handles failure marker file operation.
Namespace
Drupal\package_managerCode
public function write(SandboxManagerBase $sandbox_manager, TranslatableMarkup $message, ?\Throwable $throwable = NULL) : void {
$data = [
'stage_class' => get_class($sandbox_manager),
'stage_type' => $sandbox_manager->getType(),
'stage_file' => (new \ReflectionObject($sandbox_manager))->getFileName(),
'message' => (string) $message,
'throwable_class' => $throwable ? get_class($throwable) : FALSE,
'throwable_message' => $throwable?->getMessage() ?? 'Not available',
'throwable_backtrace' => $throwable?->getTraceAsString() ?? 'Not available.',
];
file_put_contents($this->getPath(), Yaml::dump($data));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.