Refactor diffs
[mediawiki.git] / includes / revisiondelete / RevisionDelete.php
blob718508777ba2de77b18156ef485cc2b2d6625867
1 <?php
2 /**
3 * Base implementations for deletable items.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
20 * @file
21 * @ingroup RevisionDelete
24 /**
25 * List for revision table items
27 * This will check both the 'revision' table for live revisions and the
28 * 'archive' table for traditionally-deleted revisions that have an
29 * ar_rev_id saved.
31 * See RevDel_RevisionItem and RevDel_ArchivedRevisionItem for items.
33 class RevDel_RevisionList extends RevDel_List {
34 var $currentRevId;
36 public function getType() {
37 return 'revision';
40 public static function getRelationType() {
41 return 'rev_id';
44 public static function getRestriction() {
45 return 'deleterevision';
48 public static function getRevdelConstant() {
49 return Revision::DELETED_TEXT;
52 public static function suggestTarget( $target, array $ids ) {
53 $rev = Revision::newFromId( $ids[0] );
54 return $rev ? $rev->getTitle() : $target;
57 /**
58 * @param $db DatabaseBase
59 * @return mixed
61 public function doQuery( $db ) {
62 $ids = array_map( 'intval', $this->ids );
63 $live = $db->select(
64 array( 'revision', 'page', 'user' ),
65 array_merge( Revision::selectFields(), Revision::selectUserFields() ),
66 array(
67 'rev_page' => $this->title->getArticleID(),
68 'rev_id' => $ids,
70 __METHOD__,
71 array( 'ORDER BY' => 'rev_id DESC' ),
72 array(
73 'page' => Revision::pageJoinCond(),
74 'user' => Revision::userJoinCond() )
77 if ( $live->numRows() >= count( $ids ) ) {
78 // All requested revisions are live, keeps things simple!
79 return $live;
82 // Check if any requested revisions are available fully deleted.
83 $archived = $db->select( array( 'archive' ), '*',
84 array(
85 'ar_rev_id' => $ids
87 __METHOD__,
88 array( 'ORDER BY' => 'ar_rev_id DESC' )
91 if ( $archived->numRows() == 0 ) {
92 return $live;
93 } elseif ( $live->numRows() == 0 ) {
94 return $archived;
95 } else {
96 // Combine the two! Whee
97 $rows = array();
98 foreach ( $live as $row ) {
99 $rows[$row->rev_id] = $row;
101 foreach ( $archived as $row ) {
102 $rows[$row->ar_rev_id] = $row;
104 krsort( $rows );
105 return new FakeResultWrapper( array_values( $rows ) );
109 public function newItem( $row ) {
110 if ( isset( $row->rev_id ) ) {
111 return new RevDel_RevisionItem( $this, $row );
112 } elseif ( isset( $row->ar_rev_id ) ) {
113 return new RevDel_ArchivedRevisionItem( $this, $row );
114 } else {
115 // This shouldn't happen. :)
116 throw new MWException( 'Invalid row type in RevDel_RevisionList' );
120 public function getCurrent() {
121 if ( is_null( $this->currentRevId ) ) {
122 $dbw = wfGetDB( DB_MASTER );
123 $this->currentRevId = $dbw->selectField(
124 'page', 'page_latest', $this->title->pageCond(), __METHOD__ );
126 return $this->currentRevId;
129 public function getSuppressBit() {
130 return Revision::DELETED_RESTRICTED;
133 public function doPreCommitUpdates() {
134 $this->title->invalidateCache();
135 return Status::newGood();
138 public function doPostCommitUpdates() {
139 $this->title->purgeSquid();
140 // Extensions that require referencing previous revisions may need this
141 wfRunHooks( 'ArticleRevisionVisibilitySet', array( &$this->title ) );
142 return Status::newGood();
147 * Item class for a live revision table row
149 class RevDel_RevisionItem extends RevDel_Item {
150 var $revision;
152 public function __construct( $list, $row ) {
153 parent::__construct( $list, $row );
154 $this->revision = new Revision( $row );
157 public function getIdField() {
158 return 'rev_id';
161 public function getTimestampField() {
162 return 'rev_timestamp';
165 public function getAuthorIdField() {
166 return 'rev_user';
169 public function getAuthorNameField() {
170 return 'user_name'; // see Revision::selectUserFields()
173 public function canView() {
174 return $this->revision->userCan( Revision::DELETED_RESTRICTED, $this->list->getUser() );
177 public function canViewContent() {
178 return $this->revision->userCan( Revision::DELETED_TEXT, $this->list->getUser() );
181 public function getBits() {
182 return $this->revision->getVisibility();
185 public function setBits( $bits ) {
186 $dbw = wfGetDB( DB_MASTER );
187 // Update revision table
188 $dbw->update( 'revision',
189 array( 'rev_deleted' => $bits ),
190 array(
191 'rev_id' => $this->revision->getId(),
192 'rev_page' => $this->revision->getPage(),
193 'rev_deleted' => $this->getBits()
195 __METHOD__
197 if ( !$dbw->affectedRows() ) {
198 // Concurrent fail!
199 return false;
201 // Update recentchanges table
202 $dbw->update( 'recentchanges',
203 array(
204 'rc_deleted' => $bits,
205 'rc_patrolled' => 1
207 array(
208 'rc_this_oldid' => $this->revision->getId(), // condition
209 // non-unique timestamp index
210 'rc_timestamp' => $dbw->timestamp( $this->revision->getTimestamp() ),
212 __METHOD__
214 return true;
217 public function isDeleted() {
218 return $this->revision->isDeleted( Revision::DELETED_TEXT );
221 public function isHideCurrentOp( $newBits ) {
222 return ( $newBits & Revision::DELETED_TEXT )
223 && $this->list->getCurrent() == $this->getId();
227 * Get the HTML link to the revision text.
228 * Overridden by RevDel_ArchiveItem.
229 * @return string
231 protected function getRevisionLink() {
232 $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
233 $this->revision->getTimestamp(), $this->list->getUser() ) );
235 if ( $this->isDeleted() && !$this->canViewContent() ) {
236 return $date;
238 return Linker::linkKnown(
239 $this->list->title,
240 $date,
241 array(),
242 array(
243 'oldid' => $this->revision->getId(),
244 'unhide' => 1
250 * Get the HTML link to the diff.
251 * Overridden by RevDel_ArchiveItem
252 * @return string
254 protected function getDiffLink() {
255 if ( $this->isDeleted() && !$this->canViewContent() ) {
256 return $this->list->msg( 'diff' )->escaped();
257 } else {
258 return Linker::linkKnown(
259 $this->list->title,
260 $this->list->msg( 'diff' )->escaped(),
261 array(),
262 array(
263 'diff' => $this->revision->getId(),
264 'oldid' => 'prev',
265 'unhide' => 1
271 public function getHTML() {
272 $difflink = $this->list->msg( 'parentheses' )
273 ->rawParams( $this->getDiffLink() )->escaped();
274 $revlink = $this->getRevisionLink();
275 $userlink = Linker::revUserLink( $this->revision );
276 $comment = Linker::revComment( $this->revision );
277 if ( $this->isDeleted() ) {
278 $revlink = "<span class=\"history-deleted\">$revlink</span>";
280 return "<li>$difflink $revlink $userlink $comment</li>";
285 * List for archive table items, i.e. revisions deleted via action=delete
287 class RevDel_ArchiveList extends RevDel_RevisionList {
288 public function getType() {
289 return 'archive';
292 public static function getRelationType() {
293 return 'ar_timestamp';
297 * @param $db DatabaseBase
298 * @return mixed
300 public function doQuery( $db ) {
301 $timestamps = array();
302 foreach ( $this->ids as $id ) {
303 $timestamps[] = $db->timestamp( $id );
305 return $db->select( 'archive', '*',
306 array(
307 'ar_namespace' => $this->title->getNamespace(),
308 'ar_title' => $this->title->getDBkey(),
309 'ar_timestamp' => $timestamps
311 __METHOD__,
312 array( 'ORDER BY' => 'ar_timestamp DESC' )
316 public function newItem( $row ) {
317 return new RevDel_ArchiveItem( $this, $row );
320 public function doPreCommitUpdates() {
321 return Status::newGood();
324 public function doPostCommitUpdates() {
325 return Status::newGood();
330 * Item class for a archive table row
332 class RevDel_ArchiveItem extends RevDel_RevisionItem {
333 public function __construct( $list, $row ) {
334 RevDel_Item::__construct( $list, $row );
335 $this->revision = Revision::newFromArchiveRow( $row,
336 array( 'page' => $this->list->title->getArticleID() ) );
339 public function getIdField() {
340 return 'ar_timestamp';
343 public function getTimestampField() {
344 return 'ar_timestamp';
347 public function getAuthorIdField() {
348 return 'ar_user';
351 public function getAuthorNameField() {
352 return 'ar_user_text';
355 public function getId() {
356 # Convert DB timestamp to MW timestamp
357 return $this->revision->getTimestamp();
360 public function setBits( $bits ) {
361 $dbw = wfGetDB( DB_MASTER );
362 $dbw->update( 'archive',
363 array( 'ar_deleted' => $bits ),
364 array(
365 'ar_namespace' => $this->list->title->getNamespace(),
366 'ar_title' => $this->list->title->getDBkey(),
367 // use timestamp for index
368 'ar_timestamp' => $this->row->ar_timestamp,
369 'ar_rev_id' => $this->row->ar_rev_id,
370 'ar_deleted' => $this->getBits()
372 __METHOD__ );
373 return (bool)$dbw->affectedRows();
376 protected function getRevisionLink() {
377 $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
378 $this->revision->getTimestamp(), $this->list->getUser() ) );
380 if ( $this->isDeleted() && !$this->canViewContent() ) {
381 return $date;
384 return Linker::link(
385 SpecialPage::getTitleFor( 'Undelete' ),
386 $date,
387 array(),
388 array(
389 'target' => $this->list->title->getPrefixedText(),
390 'timestamp' => $this->revision->getTimestamp()
395 protected function getDiffLink() {
396 if ( $this->isDeleted() && !$this->canViewContent() ) {
397 return $this->list->msg( 'diff' )->escaped();
400 return Linker::link(
401 SpecialPage::getTitleFor( 'Undelete' ),
402 $this->list->msg( 'diff' )->escaped(),
403 array(),
404 array(
405 'target' => $this->list->title->getPrefixedText(),
406 'diff' => 'prev',
407 'timestamp' => $this->revision->getTimestamp()
414 * Item class for a archive table row by ar_rev_id -- actually
415 * used via RevDel_RevisionList.
417 class RevDel_ArchivedRevisionItem extends RevDel_ArchiveItem {
418 public function __construct( $list, $row ) {
419 RevDel_Item::__construct( $list, $row );
421 $this->revision = Revision::newFromArchiveRow( $row,
422 array( 'page' => $this->list->title->getArticleID() ) );
425 public function getIdField() {
426 return 'ar_rev_id';
429 public function getId() {
430 return $this->revision->getId();
433 public function setBits( $bits ) {
434 $dbw = wfGetDB( DB_MASTER );
435 $dbw->update( 'archive',
436 array( 'ar_deleted' => $bits ),
437 array( 'ar_rev_id' => $this->row->ar_rev_id,
438 'ar_deleted' => $this->getBits()
440 __METHOD__ );
441 return (bool)$dbw->affectedRows();
446 * List for oldimage table items
448 class RevDel_FileList extends RevDel_List {
449 public function getType() {
450 return 'oldimage';
453 public static function getRelationType() {
454 return 'oi_archive_name';
457 public static function getRestriction() {
458 return 'deleterevision';
461 public static function getRevdelConstant() {
462 return File::DELETED_FILE;
465 var $storeBatch, $deleteBatch, $cleanupBatch;
468 * @param $db DatabaseBase
469 * @return mixed
471 public function doQuery( $db ) {
472 $archiveNames = array();
473 foreach ( $this->ids as $timestamp ) {
474 $archiveNames[] = $timestamp . '!' . $this->title->getDBkey();
476 return $db->select(
477 'oldimage',
478 OldLocalFile::selectFields(),
479 array(
480 'oi_name' => $this->title->getDBkey(),
481 'oi_archive_name' => $archiveNames
483 __METHOD__,
484 array( 'ORDER BY' => 'oi_timestamp DESC' )
488 public function newItem( $row ) {
489 return new RevDel_FileItem( $this, $row );
492 public function clearFileOps() {
493 $this->deleteBatch = array();
494 $this->storeBatch = array();
495 $this->cleanupBatch = array();
498 public function doPreCommitUpdates() {
499 $status = Status::newGood();
500 $repo = RepoGroup::singleton()->getLocalRepo();
501 if ( $this->storeBatch ) {
502 $status->merge( $repo->storeBatch( $this->storeBatch, FileRepo::OVERWRITE_SAME ) );
504 if ( !$status->isOK() ) {
505 return $status;
507 if ( $this->deleteBatch ) {
508 $status->merge( $repo->deleteBatch( $this->deleteBatch ) );
510 if ( !$status->isOK() ) {
511 // Running cleanupDeletedBatch() after a failed storeBatch() with the DB already
512 // modified (but destined for rollback) causes data loss
513 return $status;
515 if ( $this->cleanupBatch ) {
516 $status->merge( $repo->cleanupDeletedBatch( $this->cleanupBatch ) );
518 return $status;
521 public function doPostCommitUpdates() {
522 global $wgUseSquid;
523 $file = wfLocalFile( $this->title );
524 $file->purgeCache();
525 $file->purgeDescription();
526 $purgeUrls = array();
527 foreach ( $this->ids as $timestamp ) {
528 $archiveName = $timestamp . '!' . $this->title->getDBkey();
529 $file->purgeOldThumbnails( $archiveName );
530 $purgeUrls[] = $file->getArchiveUrl( $archiveName );
532 if ( $wgUseSquid ) {
533 // purge full images from cache
534 SquidUpdate::purge( $purgeUrls );
536 return Status::newGood();
539 public function getSuppressBit() {
540 return File::DELETED_RESTRICTED;
545 * Item class for an oldimage table row
547 class RevDel_FileItem extends RevDel_Item {
550 * @var File
552 var $file;
554 public function __construct( $list, $row ) {
555 parent::__construct( $list, $row );
556 $this->file = RepoGroup::singleton()->getLocalRepo()->newFileFromRow( $row );
559 public function getIdField() {
560 return 'oi_archive_name';
563 public function getTimestampField() {
564 return 'oi_timestamp';
567 public function getAuthorIdField() {
568 return 'oi_user';
571 public function getAuthorNameField() {
572 return 'oi_user_text';
575 public function getId() {
576 $parts = explode( '!', $this->row->oi_archive_name );
577 return $parts[0];
580 public function canView() {
581 return $this->file->userCan( File::DELETED_RESTRICTED, $this->list->getUser() );
584 public function canViewContent() {
585 return $this->file->userCan( File::DELETED_FILE, $this->list->getUser() );
588 public function getBits() {
589 return $this->file->getVisibility();
592 public function setBits( $bits ) {
593 # Queue the file op
594 # @todo FIXME: Move to LocalFile.php
595 if ( $this->isDeleted() ) {
596 if ( $bits & File::DELETED_FILE ) {
597 # Still deleted
598 } else {
599 # Newly undeleted
600 $key = $this->file->getStorageKey();
601 $srcRel = $this->file->repo->getDeletedHashPath( $key ) . $key;
602 $this->list->storeBatch[] = array(
603 $this->file->repo->getVirtualUrl( 'deleted' ) . '/' . $srcRel,
604 'public',
605 $this->file->getRel()
607 $this->list->cleanupBatch[] = $key;
609 } elseif ( $bits & File::DELETED_FILE ) {
610 # Newly deleted
611 $key = $this->file->getStorageKey();
612 $dstRel = $this->file->repo->getDeletedHashPath( $key ) . $key;
613 $this->list->deleteBatch[] = array( $this->file->getRel(), $dstRel );
616 # Do the database operations
617 $dbw = wfGetDB( DB_MASTER );
618 $dbw->update( 'oldimage',
619 array( 'oi_deleted' => $bits ),
620 array(
621 'oi_name' => $this->row->oi_name,
622 'oi_timestamp' => $this->row->oi_timestamp,
623 'oi_deleted' => $this->getBits()
625 __METHOD__
627 return (bool)$dbw->affectedRows();
630 public function isDeleted() {
631 return $this->file->isDeleted( File::DELETED_FILE );
635 * Get the link to the file.
636 * Overridden by RevDel_ArchivedFileItem.
637 * @return string
639 protected function getLink() {
640 $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
641 $this->file->getTimestamp(), $this->list->getUser() ) );
643 if ( !$this->isDeleted() ) {
644 # Regular files...
645 return Html::rawElement( 'a', array( 'href' => $this->file->getUrl() ), $date );
648 # Hidden files...
649 if ( !$this->canViewContent() ) {
650 $link = $date;
651 } else {
652 $link = Linker::link(
653 SpecialPage::getTitleFor( 'Revisiondelete' ),
654 $date,
655 array(),
656 array(
657 'target' => $this->list->title->getPrefixedText(),
658 'file' => $this->file->getArchiveName(),
659 'token' => $this->list->getUser()->getEditToken(
660 $this->file->getArchiveName() )
664 return '<span class="history-deleted">' . $link . '</span>';
667 * Generate a user tool link cluster if the current user is allowed to view it
668 * @return string HTML
670 protected function getUserTools() {
671 if ( $this->file->userCan( Revision::DELETED_USER, $this->list->getUser() ) ) {
672 $link = Linker::userLink( $this->file->user, $this->file->user_text ) .
673 Linker::userToolLinks( $this->file->user, $this->file->user_text );
674 } else {
675 $link = $this->list->msg( 'rev-deleted-user' )->escaped();
677 if ( $this->file->isDeleted( Revision::DELETED_USER ) ) {
678 return '<span class="history-deleted">' . $link . '</span>';
680 return $link;
684 * Wrap and format the file's comment block, if the current
685 * user is allowed to view it.
687 * @return string HTML
689 protected function getComment() {
690 if ( $this->file->userCan( File::DELETED_COMMENT, $this->list->getUser() ) ) {
691 $block = Linker::commentBlock( $this->file->description );
692 } else {
693 $block = ' ' . $this->list->msg( 'rev-deleted-comment' )->escaped();
695 if ( $this->file->isDeleted( File::DELETED_COMMENT ) ) {
696 return "<span class=\"history-deleted\">$block</span>";
698 return $block;
701 public function getHTML() {
702 $data =
703 $this->list->msg( 'widthheight' )->numParams(
704 $this->file->getWidth(), $this->file->getHeight() )->text() .
705 ' (' . $this->list->msg( 'nbytes' )->numParams( $this->file->getSize() )->text() . ')';
707 return '<li>' . $this->getLink() . ' ' . $this->getUserTools() . ' ' .
708 $data . ' ' . $this->getComment() . '</li>';
713 * List for filearchive table items
715 class RevDel_ArchivedFileList extends RevDel_FileList {
716 public function getType() {
717 return 'filearchive';
720 public static function getRelationType() {
721 return 'fa_id';
725 * @param $db DatabaseBase
726 * @return mixed
728 public function doQuery( $db ) {
729 $ids = array_map( 'intval', $this->ids );
730 return $db->select(
731 'filearchive',
732 ArchivedFile::selectFields(),
733 array(
734 'fa_name' => $this->title->getDBkey(),
735 'fa_id' => $ids
737 __METHOD__,
738 array( 'ORDER BY' => 'fa_id DESC' )
742 public function newItem( $row ) {
743 return new RevDel_ArchivedFileItem( $this, $row );
748 * Item class for a filearchive table row
750 class RevDel_ArchivedFileItem extends RevDel_FileItem {
751 public function __construct( $list, $row ) {
752 RevDel_Item::__construct( $list, $row );
753 $this->file = ArchivedFile::newFromRow( $row );
756 public function getIdField() {
757 return 'fa_id';
760 public function getTimestampField() {
761 return 'fa_timestamp';
764 public function getAuthorIdField() {
765 return 'fa_user';
768 public function getAuthorNameField() {
769 return 'fa_user_text';
772 public function getId() {
773 return $this->row->fa_id;
776 public function setBits( $bits ) {
777 $dbw = wfGetDB( DB_MASTER );
778 $dbw->update( 'filearchive',
779 array( 'fa_deleted' => $bits ),
780 array(
781 'fa_id' => $this->row->fa_id,
782 'fa_deleted' => $this->getBits(),
784 __METHOD__
786 return (bool)$dbw->affectedRows();
789 protected function getLink() {
790 $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
791 $this->file->getTimestamp(), $this->list->getUser() ) );
793 # Hidden files...
794 if ( !$this->canViewContent() ) {
795 $link = $date;
796 } else {
797 $undelete = SpecialPage::getTitleFor( 'Undelete' );
798 $key = $this->file->getKey();
799 $link = Linker::link( $undelete, $date, array(),
800 array(
801 'target' => $this->list->title->getPrefixedText(),
802 'file' => $key,
803 'token' => $this->list->getUser()->getEditToken( $key )
807 if ( $this->isDeleted() ) {
808 $link = '<span class="history-deleted">' . $link . '</span>';
810 return $link;
815 * List for logging table items
817 class RevDel_LogList extends RevDel_List {
818 public function getType() {
819 return 'logging';
822 public static function getRelationType() {
823 return 'log_id';
826 public static function getRestriction() {
827 return 'deletelogentry';
830 public static function getRevdelConstant() {
831 return LogPage::DELETED_ACTION;
834 public static function suggestTarget( $target, array $ids ) {
835 $result = wfGetDB( DB_SLAVE )->select( 'logging',
836 'log_type',
837 array( 'log_id' => $ids ),
838 __METHOD__,
839 array( 'DISTINCT' )
841 if ( $result->numRows() == 1 ) {
842 // If there's only one type, the target can be set to include it.
843 return SpecialPage::getTitleFor( 'Log', $result->current()->log_type );
845 return SpecialPage::getTitleFor( 'Log' );
849 * @param $db DatabaseBase
850 * @return mixed
852 public function doQuery( $db ) {
853 $ids = array_map( 'intval', $this->ids );
854 return $db->select( 'logging', '*',
855 array( 'log_id' => $ids ),
856 __METHOD__,
857 array( 'ORDER BY' => 'log_id DESC' )
861 public function newItem( $row ) {
862 return new RevDel_LogItem( $this, $row );
865 public function getSuppressBit() {
866 return Revision::DELETED_RESTRICTED;
869 public function getLogAction() {
870 return 'event';
873 public function getLogParams( $params ) {
874 return array(
875 implode( ',', $params['ids'] ),
876 "ofield={$params['oldBits']}",
877 "nfield={$params['newBits']}"
883 * Item class for a logging table row
885 class RevDel_LogItem extends RevDel_Item {
886 public function getIdField() {
887 return 'log_id';
890 public function getTimestampField() {
891 return 'log_timestamp';
894 public function getAuthorIdField() {
895 return 'log_user';
898 public function getAuthorNameField() {
899 return 'log_user_text';
902 public function canView() {
903 return LogEventsList::userCan( $this->row, Revision::DELETED_RESTRICTED, $this->list->getUser() );
906 public function canViewContent() {
907 return true; // none
910 public function getBits() {
911 return $this->row->log_deleted;
914 public function setBits( $bits ) {
915 $dbw = wfGetDB( DB_MASTER );
916 $dbw->update( 'recentchanges',
917 array(
918 'rc_deleted' => $bits,
919 'rc_patrolled' => 1
921 array(
922 'rc_logid' => $this->row->log_id,
923 'rc_timestamp' => $this->row->log_timestamp // index
925 __METHOD__
927 $dbw->update( 'logging',
928 array( 'log_deleted' => $bits ),
929 array(
930 'log_id' => $this->row->log_id,
931 'log_deleted' => $this->getBits()
933 __METHOD__
935 return (bool)$dbw->affectedRows();
938 public function getHTML() {
939 $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
940 $this->row->log_timestamp, $this->list->getUser() ) );
941 $title = Title::makeTitle( $this->row->log_namespace, $this->row->log_title );
942 $formatter = LogFormatter::newFromRow( $this->row );
943 $formatter->setContext( $this->list->getContext() );
944 $formatter->setAudience( LogFormatter::FOR_THIS_USER );
946 // Log link for this page
947 $loglink = Linker::link(
948 SpecialPage::getTitleFor( 'Log' ),
949 $this->list->msg( 'log' )->escaped(),
950 array(),
951 array( 'page' => $title->getPrefixedText() )
953 $loglink = $this->list->msg( 'parentheses' )->rawParams( $loglink )->escaped();
954 // User links and action text
955 $action = $formatter->getActionText();
956 // Comment
957 $comment = $this->list->getLanguage()->getDirMark() . Linker::commentBlock( $this->row->log_comment );
958 if ( LogEventsList::isDeleted( $this->row, LogPage::DELETED_COMMENT ) ) {
959 $comment = '<span class="history-deleted">' . $comment . '</span>';
962 return "<li>$loglink $date $action $comment</li>";