Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 31 |
|
0.00% |
0 / 8 |
CRAP | |
0.00% |
0 / 1 |
| RevDelArchiveList | |
0.00% |
0 / 30 |
|
0.00% |
0 / 8 |
90 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 11 |
|
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 | |||
| emitEvents | |
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 LogEntry; |
| 11 | use MediaWiki\Cache\HTMLCacheUpdater; |
| 12 | use MediaWiki\Context\IContextSource; |
| 13 | use MediaWiki\DomainEvent\DomainEventDispatcher; |
| 14 | use MediaWiki\HookContainer\HookContainer; |
| 15 | use MediaWiki\MediaWikiServices; |
| 16 | use MediaWiki\Page\PageIdentity; |
| 17 | use MediaWiki\Revision\RevisionStore; |
| 18 | use MediaWiki\Status\Status; |
| 19 | use Wikimedia\Rdbms\IResultWrapper; |
| 20 | use Wikimedia\Rdbms\LBFactory; |
| 21 | use Wikimedia\Rdbms\SelectQueryBuilder; |
| 22 | |
| 23 | /** |
| 24 | * List for archive table items, i.e. revisions deleted via action=delete |
| 25 | */ |
| 26 | class RevDelArchiveList extends RevDelRevisionList { |
| 27 | |
| 28 | /** @var RevisionStore */ |
| 29 | private $revisionStore; |
| 30 | |
| 31 | public function __construct( |
| 32 | IContextSource $context, |
| 33 | PageIdentity $page, |
| 34 | array $ids, |
| 35 | LBFactory $lbFactory, |
| 36 | HookContainer $hookContainer, |
| 37 | HTMLCacheUpdater $htmlCacheUpdater, |
| 38 | RevisionStore $revisionStore, |
| 39 | DomainEventDispatcher $eventDispatcher |
| 40 | ) { |
| 41 | parent::__construct( |
| 42 | $context, |
| 43 | $page, |
| 44 | $ids, |
| 45 | $lbFactory, |
| 46 | $hookContainer, |
| 47 | $htmlCacheUpdater, |
| 48 | $revisionStore, |
| 49 | $eventDispatcher |
| 50 | ); |
| 51 | $this->revisionStore = $revisionStore; |
| 52 | } |
| 53 | |
| 54 | /** @inheritDoc */ |
| 55 | public function getType() { |
| 56 | return 'archive'; |
| 57 | } |
| 58 | |
| 59 | /** @inheritDoc */ |
| 60 | public static function getRelationType() { |
| 61 | return 'ar_timestamp'; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * @param \Wikimedia\Rdbms\IReadableDatabase $db |
| 66 | * @return IResultWrapper |
| 67 | */ |
| 68 | public function doQuery( $db ) { |
| 69 | $timestamps = []; |
| 70 | foreach ( $this->ids as $id ) { |
| 71 | $timestamps[] = $db->timestamp( $id ); |
| 72 | } |
| 73 | |
| 74 | $queryBuilder = $this->revisionStore->newArchiveSelectQueryBuilder( $db ) |
| 75 | ->joinComment() |
| 76 | ->where( [ |
| 77 | 'ar_namespace' => $this->getPage()->getNamespace(), |
| 78 | 'ar_title' => $this->getPage()->getDBkey(), |
| 79 | 'ar_timestamp' => $timestamps, |
| 80 | ] ) |
| 81 | ->orderBy( 'ar_timestamp', SelectQueryBuilder::SORT_DESC ); |
| 82 | |
| 83 | MediaWikiServices::getInstance()->getChangeTagsStore()->modifyDisplayQueryBuilder( $queryBuilder, 'archive' ); |
| 84 | |
| 85 | return $queryBuilder->caller( __METHOD__ )->fetchResultSet(); |
| 86 | } |
| 87 | |
| 88 | /** @inheritDoc */ |
| 89 | public function newItem( $row ) { |
| 90 | return new RevDelArchiveItem( $this, $row ); |
| 91 | } |
| 92 | |
| 93 | /** @inheritDoc */ |
| 94 | public function doPreCommitUpdates() { |
| 95 | return Status::newGood(); |
| 96 | } |
| 97 | |
| 98 | /** @inheritDoc */ |
| 99 | public function doPostCommitUpdates( array $visibilityChangeMap ) { |
| 100 | return Status::newGood(); |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * @param array $bitPars See RevisionDeleter::extractBitfield |
| 105 | * @param array $visibilityChangeMap [id => ['oldBits' => $oldBits, 'newBits' => $newBits], ... ] |
| 106 | * @param array $tags |
| 107 | * @param LogEntry $logEntry |
| 108 | * @param bool $suppressed |
| 109 | */ |
| 110 | protected function emitEvents( |
| 111 | array $bitPars, |
| 112 | array $visibilityChangeMap, |
| 113 | array $tags, |
| 114 | LogEntry $logEntry, |
| 115 | bool $suppressed |
| 116 | ) { |
| 117 | // Do not emit PageHistoryVisibilityChangedEvent for archived revisions. |
| 118 | // We could emit a ArchiveVisibilityChangedEvent in the future. |
| 119 | // PageHistoryVisibilityChangedEvent and ArchiveVisibilityChangedEvent |
| 120 | // should then share a base class, RevisionVisibilityChangedEvent. |
| 121 | } |
| 122 | |
| 123 | } |
| 124 | |
| 125 | /** @deprecated class alias since 1.46 */ |
| 126 | class_alias( RevDelArchiveList::class, 'RevDelArchiveList' ); |