1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-23 00:05:29 +00:00

Fix thumbnail regression

This commit is contained in:
Daniel Supernault 2018-11-24 14:03:15 -07:00
parent 943ae02f0e
commit bfde0fdea6
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -33,6 +33,7 @@ class UpdateCommand extends Command
'0.1.7',
'0.1.8',
'0.1.9',
'0.2.1',
];
protected $version;
@ -76,10 +77,15 @@ class UpdateCommand extends Command
case '0.1.8':
$this->info('You are running an older version that doesn\'t require any updates!');
break;
case '0.1.9':
$this->update019();
break;
case '0.2.1':
$this->update021();
break;
default:
# code...
break;
@ -127,6 +133,34 @@ class UpdateCommand extends Command
$bar->finish();
}
public function update021()
{
$this->buildVersionFile();
$v = $this->getVersionFile();
if($v['updated'] == true) {
$this->info('Already up to date!');
exit;
}
$statusCount = Status::count();
$this->info('Running updates ...');
$bar = $this->output->createProgressBar($statusCount);
Status::has('media')->chunk(200, function($statuses) use ($bar) {
foreach($statuses as $status) {
if($status->firstMedia()) {
$media = $status->firstMedia();
if(in_array($media->mime, ['image/jpeg', 'image/png'])) {
ImageThumbnail::dispatch($media);
}
}
$bar->advance();
}
});
$this->updateVersionFile('0.2.1', true);
$bar->finish();
}
protected function buildVersionFile()
{
$path = storage_path('app/version.json');