|
|
@@ -104,10 +104,17 @@ class FilesGarbageCollector extends BaseCronJob
|
|
|
|
|
|
try {
|
|
|
// Delete from disk
|
|
|
- $this->storage->hardDelete($file);
|
|
|
+ if ($this->storage->exists($file)) {
|
|
|
+ $this->storage->hardDelete($file);
|
|
|
+ }
|
|
|
|
|
|
// Remove from DB
|
|
|
- $queryBuilder->delete()->where('f.id = :id')->setParameter('id', $file->getId());
|
|
|
+ $queryBuilder
|
|
|
+ ->delete()
|
|
|
+ ->where('f.id = :id')
|
|
|
+ ->setParameter('id', $file->getId())
|
|
|
+ ->getQuery()
|
|
|
+ ->execute();
|
|
|
|
|
|
++$deleted;
|
|
|
} catch (\RuntimeException|\InvalidArgumentException $e) {
|