Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 20 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| ArticleCompileDeletionTag | |
0.00% |
0 / 20 |
|
0.00% |
0 / 2 |
90 | |
0.00% |
0 / 1 |
| getDeletionTags | |
0.00% |
0 / 7 |
|
0.00% |
0 / 1 |
2 | |||
| compile | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
72 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Extension\PageTriage\ArticleCompile; |
| 4 | |
| 5 | /** |
| 6 | * Article Deletion Tag |
| 7 | */ |
| 8 | class ArticleCompileDeletionTag extends ArticleCompile { |
| 9 | |
| 10 | /** |
| 11 | * Returns the category to deletion tag map |
| 12 | * |
| 13 | * @return array |
| 14 | */ |
| 15 | public static function getDeletionTags() { |
| 16 | return [ |
| 17 | 'All_articles_proposed_for_deletion' => 'prod_status', |
| 18 | 'BLP_articles_proposed_for_deletion' => 'blp_prod_status', |
| 19 | 'Candidates_for_speedy_deletion' => 'csd_status', |
| 20 | // The next two are both treated as deletion nominations, |
| 21 | // because RfD pages are not actual redirects. See T157046. |
| 22 | 'Articles_for_deletion' => 'afd_status', |
| 23 | 'All_redirects_for_discussion' => 'afd_status', |
| 24 | ]; |
| 25 | } |
| 26 | |
| 27 | /** @inheritDoc */ |
| 28 | public function compile() { |
| 29 | $deletionTags = self::getDeletionTags(); |
| 30 | foreach ( $this->mPageId as $pageId ) { |
| 31 | $parserOutput = $this->getParserOutputByPageId( $pageId ); |
| 32 | if ( $parserOutput ) { |
| 33 | $deleted = false; |
| 34 | foreach ( $deletionTags as $category => $tag ) { |
| 35 | if ( !isset( $this->metadata[$pageId][$tag] ) |
| 36 | || $this->metadata[$pageId][$tag] === "0" |
| 37 | ) { |
| 38 | $hasCategory = $parserOutput->getCategorySortKey( $category ) !== null; |
| 39 | $this->metadata[$pageId][$tag] = $hasCategory ? '1' : '0'; |
| 40 | $deleted = $hasCategory || $deleted; |
| 41 | } |
| 42 | } |
| 43 | $this->metadata[$pageId]['deleted'] = $deleted; |
| 44 | } |
| 45 | } |
| 46 | return true; |
| 47 | } |
| 48 | |
| 49 | } |