Skip to content
Snippets Groups Projects

Issue #3258048: Ensure the stage is marked as available even all stage directories can't be deleted

Merged Issue #3258048: Ensure the stage is marked as available even all stage directories can't be deleted
All threads resolved!
All threads resolved!
Files
4
@@ -292,9 +292,8 @@ class Stage {
$parent_stage_dir = static::getStagingRoot();
if (is_dir($parent_stage_dir)) {
try {
$this->fileSystem->deleteRecursive($parent_stage_dir, function (string $path): void {
$this->fileSystem->chmod($path, 0777);
});
$callback = \Closure::fromCallable([$this, 'preFileDelete']);
$this->fileSystem->deleteRecursive($parent_stage_dir, $callback);
}
catch (FileException $e) {
// Deliberately swallow the exception so that the stage will be marked
@@ -307,6 +306,16 @@ class Stage {
$this->dispatch(new PostDestroyEvent($this));
}
/**
* Callback for \Drupal\Core\File\FileSystemInterface::deleteRecursive().
*
* @param string $path
* The path of the file or directory that is about to be deleted.
*/
protected function preFileDelete(string $path): void {
$this->fileSystem->chmod($path, 0777);
}
/**
* Marks the stage as available.
*/
Loading