Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 28 |
|
0.00% |
0 / 7 |
CRAP | |
0.00% |
0 / 1 |
RevDelArchiveList | |
0.00% |
0 / 28 |
|
0.00% |
0 / 7 |
72 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
2 | |||
getType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getRelationType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
doQuery | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
6 | |||
newItem | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
doPreCommitUpdates | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
doPostCommitUpdates | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | /** |
3 | * This program is free software; you can redistribute it and/or modify |
4 | * it under the terms of the GNU General Public License as published by |
5 | * the Free Software Foundation; either version 2 of the License, or |
6 | * (at your option) any later version. |
7 | * |
8 | * This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU General Public License along |
14 | * with this program; if not, write to the Free Software Foundation, Inc., |
15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
16 | * http://www.gnu.org/copyleft/gpl.html |
17 | * |
18 | * @file |
19 | * @ingroup RevisionDelete |
20 | */ |
21 | |
22 | use MediaWiki\Cache\HTMLCacheUpdater; |
23 | use MediaWiki\Context\IContextSource; |
24 | use MediaWiki\HookContainer\HookContainer; |
25 | use MediaWiki\MediaWikiServices; |
26 | use MediaWiki\Page\PageIdentity; |
27 | use MediaWiki\Revision\RevisionStore; |
28 | use MediaWiki\Status\Status; |
29 | use Wikimedia\Rdbms\IResultWrapper; |
30 | use Wikimedia\Rdbms\LBFactory; |
31 | use Wikimedia\Rdbms\SelectQueryBuilder; |
32 | |
33 | /** |
34 | * List for archive table items, i.e. revisions deleted via action=delete |
35 | */ |
36 | class RevDelArchiveList extends RevDelRevisionList { |
37 | |
38 | /** @var RevisionStore */ |
39 | private $revisionStore; |
40 | |
41 | /** |
42 | * @param IContextSource $context |
43 | * @param PageIdentity $page |
44 | * @param array $ids |
45 | * @param LBFactory $lbFactory |
46 | * @param HookContainer $hookContainer |
47 | * @param HTMLCacheUpdater $htmlCacheUpdater |
48 | * @param RevisionStore $revisionStore |
49 | */ |
50 | public function __construct( |
51 | IContextSource $context, |
52 | PageIdentity $page, |
53 | array $ids, |
54 | LBFactory $lbFactory, |
55 | HookContainer $hookContainer, |
56 | HTMLCacheUpdater $htmlCacheUpdater, |
57 | RevisionStore $revisionStore |
58 | ) { |
59 | parent::__construct( |
60 | $context, |
61 | $page, |
62 | $ids, |
63 | $lbFactory, |
64 | $hookContainer, |
65 | $htmlCacheUpdater, |
66 | $revisionStore |
67 | ); |
68 | $this->revisionStore = $revisionStore; |
69 | } |
70 | |
71 | public function getType() { |
72 | return 'archive'; |
73 | } |
74 | |
75 | public static function getRelationType() { |
76 | return 'ar_timestamp'; |
77 | } |
78 | |
79 | /** |
80 | * @param \Wikimedia\Rdbms\IReadableDatabase $db |
81 | * @return IResultWrapper |
82 | */ |
83 | public function doQuery( $db ) { |
84 | $timestamps = []; |
85 | foreach ( $this->ids as $id ) { |
86 | $timestamps[] = $db->timestamp( $id ); |
87 | } |
88 | |
89 | $queryBuilder = $this->revisionStore->newArchiveSelectQueryBuilder( $db ) |
90 | ->joinComment() |
91 | ->where( [ |
92 | 'ar_namespace' => $this->getPage()->getNamespace(), |
93 | 'ar_title' => $this->getPage()->getDBkey(), |
94 | 'ar_timestamp' => $timestamps, |
95 | ] ) |
96 | ->orderBy( 'ar_timestamp', SelectQueryBuilder::SORT_DESC ); |
97 | |
98 | MediaWikiServices::getInstance()->getChangeTagsStore()->modifyDisplayQueryBuilder( $queryBuilder, 'archive' ); |
99 | |
100 | return $queryBuilder->caller( __METHOD__ )->fetchResultSet(); |
101 | } |
102 | |
103 | public function newItem( $row ) { |
104 | return new RevDelArchiveItem( $this, $row ); |
105 | } |
106 | |
107 | public function doPreCommitUpdates() { |
108 | return Status::newGood(); |
109 | } |
110 | |
111 | public function doPostCommitUpdates( array $visibilityChangeMap ) { |
112 | return Status::newGood(); |
113 | } |
114 | } |