Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 13 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| DumpLatestFilter | |
0.00% |
0 / 13 |
|
0.00% |
0 / 3 |
30 | |
0.00% |
0 / 1 |
| writeOpenPage | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| writeClosePage | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
6 | |||
| writeRevision | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Dump output filter to include only the last revision in each page sequence. |
| 4 | * |
| 5 | * Copyright © 2003, 2005, 2006 Brooke Vibber <bvibber@wikimedia.org> |
| 6 | * https://www.mediawiki.org/ |
| 7 | * |
| 8 | * @license GPL-2.0-or-later |
| 9 | * @file |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * @ingroup Dump |
| 14 | */ |
| 15 | class DumpLatestFilter extends DumpFilter { |
| 16 | /** @var stdClass|null */ |
| 17 | public $page; |
| 18 | |
| 19 | /** @var string|null */ |
| 20 | public $pageString; |
| 21 | |
| 22 | /** @var stdClass|null */ |
| 23 | public $rev; |
| 24 | |
| 25 | /** @var string|null */ |
| 26 | public $revString; |
| 27 | |
| 28 | /** |
| 29 | * @param stdClass $page |
| 30 | * @param string $string |
| 31 | */ |
| 32 | public function writeOpenPage( $page, $string ) { |
| 33 | $this->page = $page; |
| 34 | $this->pageString = $string; |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * @param string $string |
| 39 | */ |
| 40 | public function writeClosePage( $string ) { |
| 41 | if ( $this->rev ) { |
| 42 | $this->sink->writeOpenPage( $this->page, $this->pageString ); |
| 43 | $this->sink->writeRevision( $this->rev, $this->revString ); |
| 44 | $this->sink->writeClosePage( $string ); |
| 45 | } |
| 46 | $this->rev = null; |
| 47 | $this->revString = null; |
| 48 | $this->page = null; |
| 49 | $this->pageString = null; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * @param stdClass $rev |
| 54 | * @param string $string |
| 55 | */ |
| 56 | public function writeRevision( $rev, $string ) { |
| 57 | if ( $rev->rev_id == $this->page->page_latest ) { |
| 58 | $this->rev = $rev; |
| 59 | $this->revString = $string; |
| 60 | } |
| 61 | } |
| 62 | } |