3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
19 * @ingroup RevisionDelete
22 use MediaWiki\RevisionList\RevisionListBase
;
23 use Wikimedia\Rdbms\IConnectionProvider
;
26 * Item class for a archive table row by ar_rev_id -- actually
27 * used via RevDelRevisionList.
29 class RevDelArchivedRevisionItem
extends RevDelArchiveItem
{
31 /** @var IConnectionProvider */
32 protected IConnectionProvider
$dbProvider;
35 * @param RevisionListBase $list
36 * @param stdClass $row
37 * @param IConnectionProvider $dbProvider
39 public function __construct( RevisionListBase
$list, stdClass
$row, IConnectionProvider
$dbProvider ) {
40 $this->dbProvider
= $dbProvider;
41 parent
::__construct( $list, $row );
47 public function getIdField(): string {
54 public function getId(): int {
55 return $this->getRevisionRecord()->getId();
62 public function setBits( $bits ): bool {
63 $dbw = $this->dbProvider
->getPrimaryDatabase();
64 $dbw->newUpdateQueryBuilder()
66 ->set( [ 'ar_deleted' => $bits ] )
68 'ar_rev_id' => $this->row
->ar_rev_id
,
69 'ar_deleted' => $this->getBits(),
71 ->caller( __METHOD__
)->execute();
73 return (bool)$dbw->affectedRows();