BookStack\Services\AttachmentService::deleteFileInStorage PHP Method

deleteFileInStorage() protected method

Cleans any empty leftover folders.
protected deleteFileInStorage ( Attachment $attachment )
$attachment BookStack\Attachment
    protected function deleteFileInStorage(Attachment $attachment)
    {
        $storedFilePath = $this->getStorageBasePath() . $attachment->path;
        $storage = $this->getStorage();
        $dirPath = dirname($storedFilePath);
        $storage->delete($storedFilePath);
        if (count($storage->allFiles($dirPath)) === 0) {
            $storage->deleteDirectory($dirPath);
        }
    }