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