Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
CacheInvalidator | |
100.00% |
4 / 4 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
invalidate | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace Cognate; |
4 | |
5 | use JobQueueGroup; |
6 | use MediaWiki\Linker\LinkTarget; |
7 | use MediaWiki\Title\Title; |
8 | |
9 | /** |
10 | * @license GPL-2.0-or-later |
11 | * @author Addshore |
12 | */ |
13 | class CacheInvalidator { |
14 | |
15 | /** |
16 | * @var JobQueueGroup |
17 | */ |
18 | private $jobQueueGroup; |
19 | |
20 | /** |
21 | * @param JobQueueGroup $jobQueueGroup |
22 | */ |
23 | public function __construct( JobQueueGroup $jobQueueGroup ) { |
24 | $this->jobQueueGroup = $jobQueueGroup; |
25 | } |
26 | |
27 | /** |
28 | * @param string[] $dbNames |
29 | * @param LinkTarget $linkTarget |
30 | */ |
31 | public function invalidate( array $dbNames, LinkTarget $linkTarget ) { |
32 | $this->jobQueueGroup->lazyPush( |
33 | new LocalJobSubmitJob( Title::newFromLinkTarget( $linkTarget ), [ 'dbNames' => $dbNames ] ) |
34 | ); |
35 | } |
36 | |
37 | } |