1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-23 16:24:29 +00:00
pixelfed/app/Console/Commands/CatchUnoptimizedMedia.php
2018-05-26 16:44:44 -06:00

47 lines
953 B
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Media;
use App\Jobs\ImageOptimizePipeline\ImageOptimize;
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()
{
$medias = Media::whereNull('processed_at')->take(50)->get();
foreach($medias as $media) {
ImageOptimize::dispatch($media);
}
}
}