summaryrefslogtreecommitdiff
path: root/app/Core
diff options
context:
space:
mode:
Diffstat (limited to 'app/Core')
-rw-r--r--app/Core/ObjectStorage/FileStorage.php13
1 files changed, 11 insertions, 2 deletions
diff --git a/app/Core/ObjectStorage/FileStorage.php b/app/Core/ObjectStorage/FileStorage.php
index 18453890..410951fb 100644
--- a/app/Core/ObjectStorage/FileStorage.php
+++ b/app/Core/ObjectStorage/FileStorage.php
@@ -128,12 +128,21 @@ class FileStorage implements ObjectStorageInterface
public function remove($key)
{
$filename = $this->path.DIRECTORY_SEPARATOR.$key;
+ $result = false;
if (file_exists($filename)) {
- return unlink($filename);
+ $result = unlink($filename);
+
+ // Remove parent folder if empty
+ $parentFolder = dirname($filename);
+ $files = glob($parentFolder.DIRECTORY_SEPARATOR.'*');
+
+ if ($files !== false && is_dir($parentFolder) && count($files) === 0) {
+ rmdir($parentFolder);
+ }
}
- return false;
+ return $result;
}
/**