Localisation updates from https://translatewiki.net.
[mediawiki.git] / includes / revisiondelete / RevDelArchivedRevisionItem.php
blob4845c60b1ca78b940328942183ec889561b5efd5
1 <?php
2 /**
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
18 * @file
19 * @ingroup RevisionDelete
22 use MediaWiki\RevisionList\RevisionListBase;
23 use Wikimedia\Rdbms\IConnectionProvider;
25 /**
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;
34 /**
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 );
44 /**
45 * @return string
47 public function getIdField(): string {
48 return 'ar_rev_id';
51 /**
52 * @return int
54 public function getId(): int {
55 return $this->getRevisionRecord()->getId();
58 /**
59 * @param int $bits
60 * @return bool
62 public function setBits( $bits ): bool {
63 $dbw = $this->dbProvider->getPrimaryDatabase();
64 $dbw->newUpdateQueryBuilder()
65 ->update( 'archive' )
66 ->set( [ 'ar_deleted' => $bits ] )
67 ->where( [
68 'ar_rev_id' => $this->row->ar_rev_id,
69 'ar_deleted' => $this->getBits(),
70 ] )
71 ->caller( __METHOD__ )->execute();
73 return (bool)$dbw->affectedRows();