ClearDirtyClassesJob   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
dl 0
loc 27
ccs 7
cts 7
cp 1
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getTitle() 0 3 1
A process() 0 7 1
1
<?php
2
/**
3
 * class ClearDirtyClassesJob|Firesphere\SolrSearch\Jobs\ClearDirtyClassesJob Clear out the dirty classes by pushing
4
 * them again to solr
5
 *
6
 * @package Firesphere\Solr\Search
7
 * @author Simon `Firesphere` Erkelens; Marco `Sheepy` Hermo
8
 * @copyright Copyright (c) 2018 - now() Firesphere & Sheepy
9
 */
10
11
namespace Firesphere\SolrSearch\Jobs;
12
13
use Firesphere\SolrSearch\Tasks\ClearDirtyClassesTask;
14
use ReflectionException;
15
use SilverStripe\Control\NullHTTPRequest;
16
use SilverStripe\ORM\ValidationException;
17
use Solarium\Exception\HttpException;
18
use Symbiote\QueuedJobs\Services\AbstractQueuedJob;
19
20
/**
21
 * Class ClearDirtyClassesJob is the queued job version of the ClearDirtyClassesTask
22
 *
23
 * Clean up any dirty classes in Solr due to objects not being updated properly
24
 *
25
 * @package Firesphere\Solr\Search
26
 */
27
class ClearDirtyClassesJob extends AbstractQueuedJob
28
{
29
30
    /**
31
     * Give this puppy a name
32
     *
33
     * @return string Title of this job
34
     */
35 1
    public function getTitle()
36
    {
37 1
        return _t(self::class . '.CLEARSOLRDIRTY', 'Clear out dirty objects in Solr');
38
    }
39
40
    /**
41
     * Run the dirty class cleanup task from Queued Jobs
42
     *
43
     * @throws HTTPException
44
     * @throws ValidationException
45
     * @throws ReflectionException
46
     */
47 1
    public function process()
48
    {
49 1
        $request = new NullHTTPRequest();
50 1
        $task = new ClearDirtyClassesTask();
51 1
        $task->run($request);
52
53 1
        $this->isComplete = true;
54 1
    }
55
}
56