MediaWiki
REL1_24
|
00001 <?php 00025 class RevDelArchiveItem extends RevDelRevisionItem { 00026 public function __construct( $list, $row ) { 00027 RevDelItem::__construct( $list, $row ); 00028 $this->revision = Revision::newFromArchiveRow( $row, 00029 array( 'page' => $this->list->title->getArticleID() ) ); 00030 } 00031 00032 public function getIdField() { 00033 return 'ar_timestamp'; 00034 } 00035 00036 public function getTimestampField() { 00037 return 'ar_timestamp'; 00038 } 00039 00040 public function getAuthorIdField() { 00041 return 'ar_user'; 00042 } 00043 00044 public function getAuthorNameField() { 00045 return 'ar_user_text'; 00046 } 00047 00048 public function getId() { 00049 # Convert DB timestamp to MW timestamp 00050 return $this->revision->getTimestamp(); 00051 } 00052 00053 public function setBits( $bits ) { 00054 $dbw = wfGetDB( DB_MASTER ); 00055 $dbw->update( 'archive', 00056 array( 'ar_deleted' => $bits ), 00057 array( 00058 'ar_namespace' => $this->list->title->getNamespace(), 00059 'ar_title' => $this->list->title->getDBkey(), 00060 // use timestamp for index 00061 'ar_timestamp' => $this->row->ar_timestamp, 00062 'ar_rev_id' => $this->row->ar_rev_id, 00063 'ar_deleted' => $this->getBits() 00064 ), 00065 __METHOD__ ); 00066 00067 return (bool)$dbw->affectedRows(); 00068 } 00069 00070 protected function getRevisionLink() { 00071 $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate( 00072 $this->revision->getTimestamp(), $this->list->getUser() ) ); 00073 00074 if ( $this->isDeleted() && !$this->canViewContent() ) { 00075 return $date; 00076 } 00077 00078 return Linker::link( 00079 SpecialPage::getTitleFor( 'Undelete' ), 00080 $date, 00081 array(), 00082 array( 00083 'target' => $this->list->title->getPrefixedText(), 00084 'timestamp' => $this->revision->getTimestamp() 00085 ) 00086 ); 00087 } 00088 00089 protected function getDiffLink() { 00090 if ( $this->isDeleted() && !$this->canViewContent() ) { 00091 return $this->list->msg( 'diff' )->escaped(); 00092 } 00093 00094 return Linker::link( 00095 SpecialPage::getTitleFor( 'Undelete' ), 00096 $this->list->msg( 'diff' )->escaped(), 00097 array(), 00098 array( 00099 'target' => $this->list->title->getPrefixedText(), 00100 'diff' => 'prev', 00101 'timestamp' => $this->revision->getTimestamp() 00102 ) 00103 ); 00104 } 00105 }