1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-12-23 23:02:08 +03:00

ZIP Import: Finished base import process & error handling

Added file creation reverting and DB rollback on error.
Added error display on failed import.
Extracted likely shown import form/error text to translation files.
This commit is contained in:
Dan Brown
2024-11-14 15:59:15 +00:00
parent 48c101aa7a
commit b7476a9e7f
10 changed files with 146 additions and 69 deletions

View File

@@ -153,11 +153,19 @@ class ImageService
*/
public function destroy(Image $image): void
{
$disk = $this->storage->getDisk($image->type);
$disk->destroyAllMatchingNameFromPath($image->path);
$this->destroyFileAtPath($image->type, $image->path);
$image->delete();
}
/**
* Destroy the underlying image file at the given path.
*/
public function destroyFileAtPath(string $type, string $path): void
{
$disk = $this->storage->getDisk($type);
$disk->destroyAllMatchingNameFromPath($path);
}
/**
* Delete gallery and drawings that are not within HTML content of pages or page revisions.
* Checks based off of only the image name.