Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 16 |
|
0.00% |
0 / 5 |
CRAP | |
0.00% |
0 / 1 |
RevDelArchivedFileList | |
0.00% |
0 / 16 |
|
0.00% |
0 / 5 |
30 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 8 |
|
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 / 5 |
|
0.00% |
0 / 1 |
2 | |||
newItem | |
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\FileRepo\File\FileSelectQueryBuilder; |
25 | use MediaWiki\Page\PageIdentity; |
26 | use Wikimedia\Rdbms\IReadableDatabase; |
27 | use Wikimedia\Rdbms\IResultWrapper; |
28 | use Wikimedia\Rdbms\LBFactory; |
29 | use Wikimedia\Rdbms\SelectQueryBuilder; |
30 | |
31 | /** |
32 | * List for filearchive table items |
33 | */ |
34 | class RevDelArchivedFileList extends RevDelFileList { |
35 | |
36 | /** |
37 | * @param IContextSource $context |
38 | * @param PageIdentity $page |
39 | * @param array $ids |
40 | * @param LBFactory $lbFactory |
41 | * @param HTMLCacheUpdater $htmlCacheUpdater |
42 | * @param RepoGroup $repoGroup |
43 | */ |
44 | public function __construct( |
45 | IContextSource $context, |
46 | PageIdentity $page, |
47 | array $ids, |
48 | LBFactory $lbFactory, |
49 | HTMLCacheUpdater $htmlCacheUpdater, |
50 | RepoGroup $repoGroup |
51 | ) { |
52 | parent::__construct( |
53 | $context, |
54 | $page, |
55 | $ids, |
56 | $lbFactory, |
57 | $htmlCacheUpdater, |
58 | $repoGroup |
59 | ); |
60 | // Technically, we could just inherit the constructor from RevDelFileList, |
61 | // but since ArchivedFile::getQueryInfo() uses MediaWikiServices it might |
62 | // be useful to replace at some point with either a callback or a separate |
63 | // service to allow for unit testing |
64 | } |
65 | |
66 | public function getType() { |
67 | return 'filearchive'; |
68 | } |
69 | |
70 | public static function getRelationType() { |
71 | return 'fa_id'; |
72 | } |
73 | |
74 | /** |
75 | * @param IReadableDatabase $db |
76 | * @return IResultWrapper |
77 | */ |
78 | public function doQuery( $db ) { |
79 | $ids = array_map( 'intval', $this->ids ); |
80 | |
81 | $queryBuilder = FileSelectQueryBuilder::newForArchivedFile( $db ); |
82 | $queryBuilder->where( [ 'fa_name' => $this->page->getDBkey(), 'fa_id' => $ids ] ) |
83 | ->orderBy( 'fa_id', SelectQueryBuilder::SORT_DESC ); |
84 | |
85 | return $queryBuilder->caller( __METHOD__ )->fetchResultSet(); |
86 | } |
87 | |
88 | public function newItem( $row ) { |
89 | return new RevDelArchivedFileItem( $this, $row ); |
90 | } |
91 | } |