Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
SyncChannelPostsCommand
0.00% covered (danger)
0.00%
0 / 8
0.00% covered (danger)
0.00%
0 / 2
12
0.00% covered (danger)
0.00%
0 / 1
 handle
0.00% covered (danger)
0.00%
0 / 5
0.00% covered (danger)
0.00%
0 / 1
6
 syncLemmy
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Console\Commands;
4
5use App\Jobs\SyncChannelPostsJob;
6use Illuminate\Console\Command;
7
8class SyncChannelPostsCommand extends Command
9{
10    protected $signature = 'channel:sync {platform=lemmy}';
11
12    protected $description = 'Manually sync channel posts for a platform';
13
14    public function handle(): int
15    {
16        $platform = $this->argument('platform');
17
18        if ($platform === 'lemmy') {
19            return $this->syncLemmy();
20        }
21
22        $this->error("Unsupported platform: {$platform}");
23
24        return self::FAILURE;
25    }
26
27    private function syncLemmy(): int
28    {
29        SyncChannelPostsJob::dispatchForAllActiveChannels();
30        $this->info('Successfully dispatched sync jobs for all active Lemmy channels');
31
32        return self::SUCCESS;
33    }
34}