mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
fix: CatchUnoptimizedMedia, prevent skipping of imported posts
This commit is contained in:
parent
da510089e2
commit
67a87ccb1e
2 changed files with 7 additions and 5 deletions
|
@ -41,8 +41,8 @@ class CatchUnoptimizedMedia extends Command
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
Media::whereNull('processed_at')
|
Media::whereNull('processed_at')
|
||||||
->where('created_at', '>', now()->subHours(1))
|
// This is commented out because Instagram imported posts would not get uploaded to remote storage
|
||||||
->where('skip_optimize', '!=', true)
|
// ->where('created_at', '>', now()->subHours(1))
|
||||||
->whereNull('remote_url')
|
->whereNull('remote_url')
|
||||||
->whereNotNull('status_id')
|
->whereNotNull('status_id')
|
||||||
->whereNotNull('media_path')
|
->whereNotNull('media_path')
|
||||||
|
@ -52,6 +52,7 @@ class CatchUnoptimizedMedia extends Command
|
||||||
])
|
])
|
||||||
->chunk(50, function($medias) {
|
->chunk(50, function($medias) {
|
||||||
foreach ($medias as $media) {
|
foreach ($medias as $media) {
|
||||||
|
if ($media->skip_optimize) continue;
|
||||||
ImageOptimize::dispatch($media);
|
ImageOptimize::dispatch($media);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,7 +21,8 @@ class Media extends Model
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'srcset' => 'array',
|
'srcset' => 'array',
|
||||||
'deleted_at' => 'datetime'
|
'deleted_at' => 'datetime',
|
||||||
|
'skip_optimize' => 'boolean'
|
||||||
];
|
];
|
||||||
|
|
||||||
public function status()
|
public function status()
|
||||||
|
@ -91,7 +92,7 @@ class Media extends Model
|
||||||
case 'audio':
|
case 'audio':
|
||||||
$verb = 'Audio';
|
$verb = 'Audio';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'image':
|
case 'image':
|
||||||
$verb = 'Image';
|
$verb = 'Image';
|
||||||
break;
|
break;
|
||||||
|
@ -99,7 +100,7 @@ class Media extends Model
|
||||||
case 'video':
|
case 'video':
|
||||||
$verb = 'Video';
|
$verb = 'Video';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$verb = 'Document';
|
$verb = 'Document';
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue