mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update media pipelines
This commit is contained in:
parent
1cdc0fe8ed
commit
04c2b041fc
2 changed files with 8 additions and 11 deletions
|
@ -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();
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ class MediaStoragePipeline implements ShouldQueue
|
|||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
protected $media;
|
||||
public $deleteWhenMissingModels = true;
|
||||
|
||||
public function __construct(Media $media)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue