1 | <?php |
||
2 | |||
3 | namespace App\Jobs; |
||
4 | |||
5 | use App\Events\GedComProgressSent; |
||
0 ignored issues
–
show
|
|||
6 | use App\ImportJob; |
||
7 | use GenealogiaWebsite\LaravelGedcom\Utils\GedcomParser; |
||
8 | use Illuminate\Bus\Queueable; |
||
9 | use Illuminate\Contracts\Queue\ShouldQueue; |
||
10 | use Illuminate\Foundation\Bus\Dispatchable; |
||
11 | use Illuminate\Http\Request; |
||
12 | use Illuminate\Queue\InteractsWithQueue; |
||
13 | use Illuminate\Queue\SerializesModels; |
||
14 | use Illuminate\Support\Facades\Artisan; |
||
15 | use Illuminate\Support\Facades\File; |
||
16 | use Spatie\Multitenancy\Jobs\TenantAware; |
||
17 | |||
18 | class ImportGedcom implements ShouldQueue, TenantAware |
||
19 | { |
||
20 | use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; |
||
0 ignored issues
–
show
|
|||
21 | protected $filename; |
||
22 | protected $slug; |
||
23 | protected $user_id; |
||
24 | protected $conn; |
||
25 | protected $db; |
||
26 | public $tries = 1; |
||
27 | public $timeout = 0; |
||
28 | |||
29 | /** |
||
30 | * Create a new job instance. |
||
31 | * |
||
32 | * @return void |
||
33 | */ |
||
34 | public function __construct($filename, $slug, $user_id, $conn, $db) |
||
35 | { |
||
36 | // |
||
37 | $this->filename = $filename; |
||
38 | $this->slug = $slug; |
||
39 | $this->user_id = $user_id; |
||
40 | $this->conn = $conn; |
||
41 | $this->db = $db; |
||
42 | // $this->queue = 'high'; |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * Execute the job. |
||
47 | * |
||
48 | * @return void |
||
49 | */ |
||
50 | public function handle() |
||
51 | { |
||
52 | // add import job |
||
53 | $slug = $this->slug; |
||
54 | $user_id = $this->user_id; |
||
55 | $status = 'queue'; |
||
56 | |||
57 | if ($this->conn === 'tenant') { |
||
58 | $key = 'database.connections.tenant.database'; |
||
59 | $value = $this->db; |
||
60 | config([$key => $value]); |
||
61 | } |
||
62 | |||
63 | ImportJob::on($this->conn)->create(compact('user_id', 'slug', 'status')); |
||
64 | |||
65 | $parser = new \GenealogiaWebsite\LaravelGedcom\Utils\GedcomParser(); |
||
66 | $parser->parse($this->conn, storage_path($this->filename), $slug, true); |
||
67 | File::delete(storage_path($this->filename)); |
||
68 | |||
69 | // update import job |
||
70 | $status = 'complete'; |
||
71 | ImportJob::on($this->conn)->where('slug', $slug)->where('user_id', $user_id)->update(compact('status')); |
||
72 | |||
73 | return 0; |
||
0 ignored issues
–
show
|
|||
74 | } |
||
75 | } |
||
76 |
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