Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 15 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
ArticleCompileRecreated | |
0.00% |
0 / 15 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
compile | |
0.00% |
0 / 15 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\PageTriage\ArticleCompile; |
4 | |
5 | /** |
6 | * Whether or not the page was previously deleted. |
7 | * FIXME: Ideally we wouldn't redundantly re-query the deletion log on every edit, |
8 | * but it's a lot of work to get around this, and we're querying the replica in |
9 | * a deferred update anyway. |
10 | */ |
11 | class ArticleCompileRecreated extends ArticleCompile { |
12 | |
13 | /** |
14 | * Implements ArticleCompileInterface::compile(), called when generating tags. |
15 | * @return bool |
16 | */ |
17 | public function compile() { |
18 | $conds = [ |
19 | 'page_id' => $this->mPageId, |
20 | 'log_type' => 'delete', |
21 | |
22 | // We only care about full-page deletions, not revision deletions. |
23 | // 'delete_redir' is the same as 'delete' except for redirects, which we do want. |
24 | 'log_action' => [ 'delete', 'delete_redir' ], |
25 | ]; |
26 | |
27 | $res = $this->db->newSelectQueryBuilder() |
28 | ->select( [ 'DISTINCT page_id' ] ) |
29 | ->from( 'logging' ) |
30 | ->join( 'page', 'page', [ 'page_title = log_title', 'page_namespace = log_namespace' ] ) |
31 | ->where( $conds ) |
32 | ->caller( __METHOD__ ) |
33 | ->fetchResultSet(); |
34 | |
35 | // The recreated tag will never change, so we don't need to set false |
36 | // for the pages that aren't recreations. |
37 | foreach ( $res as $row ) { |
38 | $this->metadata[$row->page_id]['recreated'] = true; |
39 | } |
40 | |
41 | return true; |
42 | } |
43 | |
44 | } |