1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace App\Console\Commands\Scheduling; |
4
|
|
|
|
5
|
|
|
use Illuminate\Console\Command; |
6
|
|
|
use App\Models\ContestModel; |
7
|
|
|
use Carbon; |
8
|
|
|
|
9
|
|
|
class SyncRankClarification extends Command |
10
|
|
|
{ |
11
|
|
|
/** |
12
|
|
|
* The name and signature of the console command. |
13
|
|
|
* |
14
|
|
|
* @var string |
15
|
|
|
*/ |
16
|
|
|
protected $signature='scheduling:syncRankClarification'; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* The console command description. |
20
|
|
|
* |
21
|
|
|
* @var string |
22
|
|
|
*/ |
23
|
|
|
protected $description='Scheduling for remote rank and clarification sync'; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Create a new command instance. |
27
|
|
|
* |
28
|
|
|
* @return void |
29
|
|
|
*/ |
30
|
|
|
public function __construct() |
31
|
|
|
{ |
32
|
|
|
parent::__construct(); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Execute the console command. |
37
|
|
|
* |
38
|
|
|
* @return mixed |
39
|
|
|
*/ |
40
|
|
|
public function handle() |
41
|
|
|
{ |
42
|
|
|
$time=Carbon::now(); |
43
|
|
|
$this->line("<fg=yellow>[$time] Processing: </>Sync Remote Contest Rank and Clarification"); |
44
|
|
|
|
45
|
|
|
$contestModel=new ContestModel(); |
46
|
|
|
$syncList=$contestModel->runningContest(); |
47
|
|
|
foreach ($syncList as $syncContest) { |
48
|
|
|
if (!isset($syncContest['vcid'])) { |
49
|
|
|
$contest=Contest::find($syncContest['cid']); |
|
|
|
|
50
|
|
|
$contestRankRaw=$contest->rankRefresh(); |
51
|
|
|
$cid=$syncContest['cid']; |
52
|
|
|
Cache::tags(['contest', 'rank'])->put($cid, $contestRankRaw); |
|
|
|
|
53
|
|
|
Cache::tags(['contest', 'rank'])->put("contestAdmin$cid", $contestRankRaw); |
54
|
|
|
continue; |
55
|
|
|
} |
56
|
|
|
$className="App\\Babel\\Extension\\hdu\\Synchronizer"; // TODO Add OJ judgement. |
57
|
|
|
$all_data=[ |
58
|
|
|
'oj'=>"hdu", |
59
|
|
|
'vcid'=>$syncContest['vcid'], |
60
|
|
|
'gid'=>$syncContest['gid'], |
61
|
|
|
'cid'=>$syncContest['cid'], |
62
|
|
|
]; |
63
|
|
|
$hduSync=new $className($all_data); |
64
|
|
|
$hduSync->crawlRank(); |
65
|
|
|
$hduSync->crawlClarification(); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
$time=Carbon::now(); |
69
|
|
|
$this->line("<fg=green>[$time] Processed: </>Successfully Synced Remote Contest Rank and Clarification"); |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths