Skip to content
Snippets Groups Projects
Commit 9ce9b7bf authored by Ted Bowman's avatar Ted Bowman
Browse files

Issue #3273006 by tedbow: Uninstalling package_manager with drush gives a...

Issue #3273006 by tedbow: Uninstalling package_manager with drush gives a warning if no staging directory exists
parent dde51df8
No related branches found
No related tags found
No related merge requests found
...@@ -364,18 +364,22 @@ class Stage { ...@@ -364,18 +364,22 @@ class Stage {
} }
$this->dispatch(new PreDestroyEvent($this)); $this->dispatch(new PreDestroyEvent($this));
// Delete the staging root and everything in it. $staging_root = $this->getStagingRoot();
try { // If the staging root exists, delete it and everything in it.
$this->fileSystem->deleteRecursive($this->getStagingRoot(), function (string $path): void { if (file_exists($staging_root)) {
$this->fileSystem->chmod($path, 0777); try {
}); $this->fileSystem->deleteRecursive($staging_root, function (string $path): void {
} $this->fileSystem->chmod($path, 0777);
catch (FileException $e) { });
// Deliberately swallow the exception so that the stage will be marked }
// as available and the post-destroy event will be fired, even if the catch (FileException $e) {
// staging area can't actually be deleted. The file system service logs // Deliberately swallow the exception so that the stage will be marked
// the exception, so we don't need to do anything else here. // as available and the post-destroy event will be fired, even if the
// staging area can't actually be deleted. The file system service logs
// the exception, so we don't need to do anything else here.
}
} }
$this->markAsAvailable(); $this->markAsAvailable();
$this->dispatch(new PostDestroyEvent($this)); $this->dispatch(new PostDestroyEvent($this));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment