Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
12.50% |
1 / 8 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
ZObjectSecondaryDataRemoval | |
12.50% |
1 / 8 |
|
50.00% |
1 / 2 |
4.68 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
doUpdate | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | /** |
3 | * WikiLambda ZObject secondary data remover for when ZObjects are deleted |
4 | * |
5 | * @file |
6 | * @ingroup Extensions |
7 | * @copyright 2020– Abstract Wikipedia team; see AUTHORS.txt |
8 | * @license MIT |
9 | */ |
10 | |
11 | namespace MediaWiki\Extension\WikiLambda; |
12 | |
13 | use MediaWiki\Deferred\DataUpdate; |
14 | use MediaWiki\Extension\WikiLambda\Registry\ZObjectRegistry; |
15 | use MediaWiki\Title\Title; |
16 | |
17 | class ZObjectSecondaryDataRemoval extends DataUpdate { |
18 | |
19 | private Title $title; |
20 | |
21 | /** |
22 | * @inheritDoc |
23 | */ |
24 | public function __construct( Title $title ) { |
25 | $this->title = $title; |
26 | } |
27 | |
28 | public function doUpdate() { |
29 | $zid = $this->title->getDBkey(); |
30 | |
31 | $zObjectStore = WikiLambdaServices::getZObjectStore(); |
32 | |
33 | $zObjectStore->deleteZObjectLabelsByZid( $zid ); |
34 | $zObjectStore->deleteZObjectLabelConflictsByZid( $zid ); |
35 | $zObjectStore->deleteZFunctionReference( $zid ); |
36 | $zObjectStore->deleteZLanguageFromLanguagesCache( $zid ); |
37 | |
38 | // Unregister the zid from any of the type-specific caches |
39 | ZObjectRegistry::unregisterZid( $zid ); |
40 | } |
41 | } |