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