Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 4 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
| RevDelItem | |
0.00% |
0 / 3 |
|
0.00% |
0 / 3 |
12 | |
0.00% |
0 / 1 |
| isHideCurrentOp | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| getBits | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
| setBits | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
| getApiData | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
| lock | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| unlock | |
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\Api\ApiResult; |
| 11 | use MediaWiki\RevisionList\RevisionItemBase; |
| 12 | use MediaWiki\Status\Status; |
| 13 | |
| 14 | /** |
| 15 | * Abstract base class for deletable items |
| 16 | */ |
| 17 | abstract class RevDelItem extends RevisionItemBase { |
| 18 | /** |
| 19 | * Returns true if the item is "current", and the operation to set the given |
| 20 | * bits can't be executed for that reason |
| 21 | * STUB |
| 22 | * @param int $newBits |
| 23 | * @return bool |
| 24 | */ |
| 25 | public function isHideCurrentOp( $newBits ) { |
| 26 | return false; |
| 27 | } |
| 28 | |
| 29 | /** |
| 30 | * Get the current deletion bitfield value |
| 31 | * |
| 32 | * @return int |
| 33 | */ |
| 34 | abstract public function getBits(); |
| 35 | |
| 36 | /** |
| 37 | * Set the visibility of the item. This should do any necessary DB queries. |
| 38 | * |
| 39 | * The DB update query should have a condition which forces it to only update |
| 40 | * if the value in the DB matches the value fetched earlier with the SELECT. |
| 41 | * If the update fails because it did not match, the function should return |
| 42 | * false. This prevents concurrency problems. |
| 43 | * |
| 44 | * @param int $newBits |
| 45 | * @return bool Success |
| 46 | */ |
| 47 | abstract public function setBits( $newBits ); |
| 48 | |
| 49 | /** |
| 50 | * Get the return information about the revision for the API |
| 51 | * @since 1.23 |
| 52 | * @param ApiResult $result |
| 53 | * @return array Data for the API result |
| 54 | */ |
| 55 | abstract public function getApiData( ApiResult $result ); |
| 56 | |
| 57 | /** |
| 58 | * Lock the item against changes outside of the DB |
| 59 | * @return Status |
| 60 | * @since 1.28 |
| 61 | */ |
| 62 | public function lock() { |
| 63 | return Status::newGood(); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Unlock the item against changes outside of the DB |
| 68 | * @return Status |
| 69 | * @since 1.28 |
| 70 | */ |
| 71 | public function unlock() { |
| 72 | return Status::newGood(); |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | /** @deprecated class alias since 1.46 */ |
| 77 | class_alias( RevDelItem::class, 'RevDelItem' ); |