1 | <?php |
||
2 | |||
3 | namespace SilverStripe\FullTextSearch\Solr\Reindex\Jobs; |
||
4 | |||
5 | use Symbiote\QueuedJobs\Services\QueuedJob; |
||
0 ignored issues
–
show
|
|||
6 | |||
7 | if (!interface_exists(QueuedJob::class)) { |
||
8 | return; |
||
9 | } |
||
10 | |||
11 | /** |
||
12 | * Represents a queuedjob which invokes a reindex |
||
13 | */ |
||
14 | class SolrReindexQueuedJob extends SolrReindexQueuedJobBase |
||
15 | { |
||
16 | /** |
||
17 | * Size of each batch to run |
||
18 | * |
||
19 | * @var int |
||
20 | */ |
||
21 | protected $batchSize; |
||
22 | |||
23 | /** |
||
24 | * Name of devtask Which invoked this |
||
25 | * Not necessary for re-index processing performed entirely by queuedjobs |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $taskName; |
||
30 | |||
31 | /** |
||
32 | * List of classes to filter |
||
33 | * |
||
34 | * @var array|string |
||
35 | */ |
||
36 | protected $classes; |
||
37 | |||
38 | public function __construct($batchSize = null, $taskName = null, $classes = null) |
||
39 | { |
||
40 | $this->batchSize = $batchSize; |
||
41 | $this->taskName = $taskName; |
||
42 | $this->classes = $classes; |
||
43 | parent::__construct(); |
||
44 | } |
||
45 | |||
46 | public function getJobData() |
||
47 | { |
||
48 | $data = parent::getJobData(); |
||
49 | |||
50 | // Custom data |
||
51 | $data->jobData->batchSize = $this->batchSize; |
||
52 | $data->jobData->taskName = $this->taskName; |
||
53 | $data->jobData->classes = $this->classes; |
||
54 | |||
55 | return $data; |
||
56 | } |
||
57 | |||
58 | public function setJobData($totalSteps, $currentStep, $isComplete, $jobData, $messages) |
||
59 | { |
||
60 | parent::setJobData($totalSteps, $currentStep, $isComplete, $jobData, $messages); |
||
61 | |||
62 | // Custom data |
||
63 | $this->batchSize = $jobData->batchSize; |
||
64 | $this->taskName = $jobData->taskName; |
||
65 | $this->classes = $jobData->classes; |
||
66 | } |
||
67 | |||
68 | public function getTitle() |
||
69 | { |
||
70 | return 'Solr Reindex Job'; |
||
71 | } |
||
72 | |||
73 | public function process() |
||
74 | { |
||
75 | $logger = $this->getLogger(); |
||
76 | if ($this->jobFinished()) { |
||
77 | $logger->notice("reindex already complete"); |
||
78 | return; |
||
79 | } |
||
80 | |||
81 | // Send back to processor |
||
82 | $logger->info("Beginning init of reindex"); |
||
83 | $this |
||
84 | ->getHandler() |
||
85 | ->runReindex($logger, $this->batchSize, $this->taskName, $this->classes); |
||
86 | $logger->info("Completed init of reindex"); |
||
87 | $this->isComplete = true; |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * Get size of batch |
||
92 | * |
||
93 | * @return int |
||
94 | */ |
||
95 | public function getBatchSize() |
||
96 | { |
||
97 | return $this->batchSize; |
||
98 | } |
||
99 | } |
||
100 |
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