|
|
|
@ -20,6 +20,7 @@ class MediaDeletePipeline implements ShouldQueue
|
|
|
|
|
public $timeout = 300;
|
|
|
|
|
public $tries = 3;
|
|
|
|
|
public $maxExceptions = 1;
|
|
|
|
|
public $deleteWhenMissingModels = true;
|
|
|
|
|
|
|
|
|
|
public function __construct(Media $media)
|
|
|
|
|
{
|
|
|
|
@ -40,32 +41,27 @@ class MediaDeletePipeline implements ShouldQueue
|
|
|
|
|
array_pop($e);
|
|
|
|
|
$i = implode('/', $e);
|
|
|
|
|
|
|
|
|
|
if(config_cache('pixelfed.cloud_storage') == true) {
|
|
|
|
|
if(config('pixelfed.cloud_storage') == true) {
|
|
|
|
|
$disk = Storage::disk(config('filesystems.cloud'));
|
|
|
|
|
|
|
|
|
|
if($path) {
|
|
|
|
|
if($path && $disk->exists($path)) {
|
|
|
|
|
$disk->delete($path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($thumb) {
|
|
|
|
|
if($thumb && $disk->exists($thumb)) {
|
|
|
|
|
$disk->delete($thumb);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(count($e) > 4 && count($disk->files($i)) == 0) {
|
|
|
|
|
$disk->deleteDirectory($i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$disk = Storage::disk(config('filesystems.local'));
|
|
|
|
|
|
|
|
|
|
if($path && $disk->exists($path)) {
|
|
|
|
|
$disk->delete($path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($thumb && $disk->exists($thumb)) {
|
|
|
|
|
$disk->delete($thumb);
|
|
|
|
|
}
|
|
|
|
|
if(count($e) > 4 && count($disk->files($i)) == 0) {
|
|
|
|
|
$disk->deleteDirectory($i);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$media->forceDelete();
|
|
|
|
|
|
|
|
|
|