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
23 * Item class for a archive table row
25 class RevDelArchiveItem
extends RevDelRevisionItem
{
26 public function __construct( $list, $row ) {
27 RevDelItem
::__construct( $list, $row );
28 $this->revision
= Revision
::newFromArchiveRow( $row, array( 'page' => $this->list->title
->getArticleID() ) );
31 public function getIdField() {
32 return 'ar_timestamp';
35 public function getTimestampField() {
36 return 'ar_timestamp';
39 public function getAuthorIdField() {
43 public function getAuthorNameField() {
44 return 'ar_user_text';
47 public function getId() {
48 # Convert DB timestamp to MW timestamp
49 return $this->revision
->getTimestamp();
52 public function setBits( $bits ) {
53 $dbw = wfGetDB( DB_MASTER
);
54 $dbw->update( 'archive', array( 'ar_deleted' => $bits ), array( 'ar_namespace' => $this->list->title
->getNamespace(), 'ar_title' => $this->list->title
->getDBkey(), // use timestamp for index
55 'ar_timestamp' => $this->row
->ar_timestamp
, 'ar_rev_id' => $this->row
->ar_rev_id
, 'ar_deleted' => $this->getBits() ), __METHOD__
);
57 return (bool) $dbw->affectedRows();
60 protected function getRevisionLink() {
61 $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate( $this->revision
->getTimestamp(), $this->list->getUser() ) );
63 if ( $this->isDeleted() && !$this->canViewContent() ) {
67 return Linker
::link( SpecialPage
::getTitleFor( 'Undelete' ), $date, array(), array( 'target' => $this->list->title
->getPrefixedText(), 'timestamp' => $this->revision
->getTimestamp() ) );
70 protected function getDiffLink() {
71 if ( $this->isDeleted() && !$this->canViewContent() ) {
72 return $this->list->msg( 'diff' )->escaped();
75 return Linker
::link( SpecialPage
::getTitleFor( 'Undelete' ), $this->list->msg( 'diff' )->escaped(), array(), array( 'target' => $this->list->title
->getPrefixedText(), 'diff' => 'prev', 'timestamp' => $this->revision
->getTimestamp() ) );