Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 15 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| RevDelArchivedRevisionItem | |
0.00% |
0 / 14 |
|
0.00% |
0 / 4 |
20 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| getIdField | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| setBits | |
0.00% |
0 / 10 |
|
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\ChangeTags\ChangeTagsFormatter; |
| 11 | use MediaWiki\RevisionList\RevisionListBase; |
| 12 | use stdClass; |
| 13 | use Wikimedia\Rdbms\IConnectionProvider; |
| 14 | |
| 15 | /** |
| 16 | * Item class for a archive table row by ar_rev_id -- actually |
| 17 | * used via RevDelRevisionList. |
| 18 | */ |
| 19 | class RevDelArchivedRevisionItem extends RevDelArchiveItem { |
| 20 | |
| 21 | protected IConnectionProvider $dbProvider; |
| 22 | |
| 23 | /** @inheritDoc */ |
| 24 | public function __construct( |
| 25 | RevisionListBase $list, |
| 26 | stdClass $row, |
| 27 | IConnectionProvider $dbProvider, |
| 28 | ChangeTagsFormatter $changeTagsFormatter, |
| 29 | ) { |
| 30 | $this->dbProvider = $dbProvider; |
| 31 | parent::__construct( $list, $row, $changeTagsFormatter ); |
| 32 | } |
| 33 | |
| 34 | /** @inheritDoc */ |
| 35 | public function getIdField(): string { |
| 36 | return 'ar_rev_id'; |
| 37 | } |
| 38 | |
| 39 | /** @inheritDoc */ |
| 40 | public function getId(): int { |
| 41 | return $this->getRevisionRecord()->getId(); |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * @param int $bits |
| 46 | * @return bool |
| 47 | */ |
| 48 | public function setBits( $bits ): bool { |
| 49 | $dbw = $this->dbProvider->getPrimaryDatabase(); |
| 50 | $dbw->newUpdateQueryBuilder() |
| 51 | ->update( 'archive' ) |
| 52 | ->set( [ 'ar_deleted' => $bits ] ) |
| 53 | ->where( [ |
| 54 | 'ar_rev_id' => $this->row->ar_rev_id, |
| 55 | 'ar_deleted' => $this->getBits(), |
| 56 | ] ) |
| 57 | ->caller( __METHOD__ )->execute(); |
| 58 | |
| 59 | return (bool)$dbw->affectedRows(); |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | /** @deprecated class alias since 1.46 */ |
| 64 | class_alias( RevDelArchivedRevisionItem::class, 'RevDelArchivedRevisionItem' ); |