1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-27 10:16:47 +00:00
pixelfed/app/Console/Commands/CatchUnoptimizedMedia.php

48 lines
982 B
PHP
Raw Normal View History

<?php
namespace App\Console\Commands;
use App\Jobs\ImageOptimizePipeline\ImageOptimize;
2018-08-28 03:07:36 +00:00
use App\Media;
use Illuminate\Console\Command;
class CatchUnoptimizedMedia extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'media:optimize';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Find and optimize media that has not yet been optimized.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct(Media $media)
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
2018-10-21 03:49:46 +00:00
$medias = Media::whereNotNull('status_id')->whereNull('processed_at')->take(250)->get();
2018-08-28 03:07:36 +00:00
foreach ($medias as $media) {
ImageOptimize::dispatch($media);
}
}
}