summaryrefslogtreecommitdiff
path: root/includes/revisiondelete/RevDelItem.php
blob: dba368d8490013f1510aaf4404ee97b5c7fef881 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 * http://www.gnu.org/copyleft/gpl.html
 *
 * @file
 * @ingroup RevisionDelete
 */

/**
 * Abstract base class for deletable items
 */
abstract class RevDelItem extends RevisionItemBase {
	/**
	 * Returns true if the item is "current", and the operation to set the given
	 * bits can't be executed for that reason
	 * STUB
	 * @param int $newBits
	 * @return bool
	 */
	public function isHideCurrentOp( $newBits ) {
		return false;
	}

	/**
	 * Get the current deletion bitfield value
	 *
	 * @return integer
	 */
	abstract public function getBits();

	/**
	 * Set the visibility of the item. This should do any necessary DB queries.
	 *
	 * The DB update query should have a condition which forces it to only update
	 * if the value in the DB matches the value fetched earlier with the SELECT.
	 * If the update fails because it did not match, the function should return
	 * false. This prevents concurrency problems.
	 *
	 * @param int $newBits
	 * @return bool Success
	 */
	abstract public function setBits( $newBits );

	/**
	 * Get the return information about the revision for the API
	 * @since 1.23
	 * @param ApiResult $result API result object
	 * @return array Data for the API result
	 */
	abstract public function getApiData( ApiResult $result );
}