072aef1968d5159182326aca71eaa9b2322d933b
[lhc/web/wiklou.git] / includes / revisiondelete / RevisionDelete.php
1 <?php
2 /**
3 * List for revision table items
4 *
5 * This will check both the 'revision' table for live revisions and the
6 * 'archive' table for traditionally-deleted revisions that have an
7 * ar_rev_id saved.
8 *
9 * See RevDel_RevisionItem and RevDel_ArchivedRevisionItem for items.
10 */
11 class RevDel_RevisionList extends RevDel_List {
12 var $currentRevId;
13
14 public function getType() {
15 return 'revision';
16 }
17
18 public static function getRelationType() {
19 return 'rev_id';
20 }
21
22 /**
23 * @param $db DatabaseBase
24 * @return mixed
25 */
26 public function doQuery( $db ) {
27 $ids = array_map( 'intval', $this->ids );
28 $live = $db->select(
29 array( 'revision', 'page', 'user' ),
30 array_merge( Revision::selectFields(), Revision::selectUserFields() ),
31 array(
32 'rev_page' => $this->title->getArticleID(),
33 'rev_id' => $ids,
34 ),
35 __METHOD__,
36 array( 'ORDER BY' => 'rev_id DESC' ),
37 array(
38 'page' => Revision::pageJoinCond(),
39 'user' => Revision::userJoinCond() )
40 );
41
42 if ( $live->numRows() >= count( $ids ) ) {
43 // All requested revisions are live, keeps things simple!
44 return $live;
45 }
46
47 // Check if any requested revisions are available fully deleted.
48 $archived = $db->select( array( 'archive' ), '*',
49 array(
50 'ar_rev_id' => $ids
51 ),
52 __METHOD__,
53 array( 'ORDER BY' => 'ar_rev_id DESC' )
54 );
55
56 if ( $archived->numRows() == 0 ) {
57 return $live;
58 } elseif ( $live->numRows() == 0 ) {
59 return $archived;
60 } else {
61 // Combine the two! Whee
62 $rows = array();
63 foreach ( $live as $row ) {
64 $rows[$row->rev_id] = $row;
65 }
66 foreach ( $archived as $row ) {
67 $rows[$row->ar_rev_id] = $row;
68 }
69 krsort( $rows );
70 return new FakeResultWrapper( array_values( $rows ) );
71 }
72 }
73
74 public function newItem( $row ) {
75 if ( isset( $row->rev_id ) ) {
76 return new RevDel_RevisionItem( $this, $row );
77 } elseif ( isset( $row->ar_rev_id ) ) {
78 return new RevDel_ArchivedRevisionItem( $this, $row );
79 } else {
80 // This shouldn't happen. :)
81 throw new MWException( 'Invalid row type in RevDel_RevisionList' );
82 }
83 }
84
85 public function getCurrent() {
86 if ( is_null( $this->currentRevId ) ) {
87 $dbw = wfGetDB( DB_MASTER );
88 $this->currentRevId = $dbw->selectField(
89 'page', 'page_latest', $this->title->pageCond(), __METHOD__ );
90 }
91 return $this->currentRevId;
92 }
93
94 public function getSuppressBit() {
95 return Revision::DELETED_RESTRICTED;
96 }
97
98 public function doPreCommitUpdates() {
99 $this->title->invalidateCache();
100 return Status::newGood();
101 }
102
103 public function doPostCommitUpdates() {
104 $this->title->purgeSquid();
105 // Extensions that require referencing previous revisions may need this
106 wfRunHooks( 'ArticleRevisionVisibilitySet', array( &$this->title ) );
107 return Status::newGood();
108 }
109 }
110
111 /**
112 * Item class for a live revision table row
113 */
114 class RevDel_RevisionItem extends RevDel_Item {
115 var $revision;
116
117 public function __construct( $list, $row ) {
118 parent::__construct( $list, $row );
119 $this->revision = new Revision( $row );
120 }
121
122 public function getIdField() {
123 return 'rev_id';
124 }
125
126 public function getTimestampField() {
127 return 'rev_timestamp';
128 }
129
130 public function getAuthorIdField() {
131 return 'rev_user';
132 }
133
134 public function getAuthorNameField() {
135 return 'user_name'; // see Revision::selectUserFields()
136 }
137
138 public function canView() {
139 return $this->revision->userCan( Revision::DELETED_RESTRICTED, $this->list->getUser() );
140 }
141
142 public function canViewContent() {
143 return $this->revision->userCan( Revision::DELETED_TEXT, $this->list->getUser() );
144 }
145
146 public function getBits() {
147 return $this->revision->getVisibility();
148 }
149
150 public function setBits( $bits ) {
151 $dbw = wfGetDB( DB_MASTER );
152 // Update revision table
153 $dbw->update( 'revision',
154 array( 'rev_deleted' => $bits ),
155 array(
156 'rev_id' => $this->revision->getId(),
157 'rev_page' => $this->revision->getPage(),
158 'rev_deleted' => $this->getBits()
159 ),
160 __METHOD__
161 );
162 if ( !$dbw->affectedRows() ) {
163 // Concurrent fail!
164 return false;
165 }
166 // Update recentchanges table
167 $dbw->update( 'recentchanges',
168 array(
169 'rc_deleted' => $bits,
170 'rc_patrolled' => 1
171 ),
172 array(
173 'rc_this_oldid' => $this->revision->getId(), // condition
174 // non-unique timestamp index
175 'rc_timestamp' => $dbw->timestamp( $this->revision->getTimestamp() ),
176 ),
177 __METHOD__
178 );
179 return true;
180 }
181
182 public function isDeleted() {
183 return $this->revision->isDeleted( Revision::DELETED_TEXT );
184 }
185
186 public function isHideCurrentOp( $newBits ) {
187 return ( $newBits & Revision::DELETED_TEXT )
188 && $this->list->getCurrent() == $this->getId();
189 }
190
191 /**
192 * Get the HTML link to the revision text.
193 * Overridden by RevDel_ArchiveItem.
194 * @return string
195 */
196 protected function getRevisionLink() {
197 $date = $this->list->getLanguage()->timeanddate( $this->revision->getTimestamp(), true );
198 if ( $this->isDeleted() && !$this->canViewContent() ) {
199 return $date;
200 }
201 return Linker::link(
202 $this->list->title,
203 $date,
204 array(),
205 array(
206 'oldid' => $this->revision->getId(),
207 'unhide' => 1
208 )
209 );
210 }
211
212 /**
213 * Get the HTML link to the diff.
214 * Overridden by RevDel_ArchiveItem
215 * @return string
216 */
217 protected function getDiffLink() {
218 if ( $this->isDeleted() && !$this->canViewContent() ) {
219 return wfMsgHtml('diff');
220 } else {
221 return
222 Linker::link(
223 $this->list->title,
224 wfMsgHtml('diff'),
225 array(),
226 array(
227 'diff' => $this->revision->getId(),
228 'oldid' => 'prev',
229 'unhide' => 1
230 ),
231 array(
232 'known',
233 'noclasses'
234 )
235 );
236 }
237 }
238
239 public function getHTML() {
240 $difflink = $this->getDiffLink();
241 $revlink = $this->getRevisionLink();
242 $userlink = Linker::revUserLink( $this->revision );
243 $comment = Linker::revComment( $this->revision );
244 if ( $this->isDeleted() ) {
245 $revlink = "<span class=\"history-deleted\">$revlink</span>";
246 }
247 return "<li>($difflink) $revlink $userlink $comment</li>";
248 }
249 }
250
251 /**
252 * List for archive table items, i.e. revisions deleted via action=delete
253 */
254 class RevDel_ArchiveList extends RevDel_RevisionList {
255 public function getType() {
256 return 'archive';
257 }
258
259 public static function getRelationType() {
260 return 'ar_timestamp';
261 }
262
263 /**
264 * @param $db DatabaseBase
265 * @return mixed
266 */
267 public function doQuery( $db ) {
268 $timestamps = array();
269 foreach ( $this->ids as $id ) {
270 $timestamps[] = $db->timestamp( $id );
271 }
272 return $db->select( 'archive', '*',
273 array(
274 'ar_namespace' => $this->title->getNamespace(),
275 'ar_title' => $this->title->getDBkey(),
276 'ar_timestamp' => $timestamps
277 ),
278 __METHOD__,
279 array( 'ORDER BY' => 'ar_timestamp DESC' )
280 );
281 }
282
283 public function newItem( $row ) {
284 return new RevDel_ArchiveItem( $this, $row );
285 }
286
287 public function doPreCommitUpdates() {
288 return Status::newGood();
289 }
290
291 public function doPostCommitUpdates() {
292 return Status::newGood();
293 }
294 }
295
296 /**
297 * Item class for a archive table row
298 */
299 class RevDel_ArchiveItem extends RevDel_RevisionItem {
300 public function __construct( $list, $row ) {
301 RevDel_Item::__construct( $list, $row );
302 $this->revision = Revision::newFromArchiveRow( $row,
303 array( 'page' => $this->list->title->getArticleId() ) );
304 }
305
306 public function getIdField() {
307 return 'ar_timestamp';
308 }
309
310 public function getTimestampField() {
311 return 'ar_timestamp';
312 }
313
314 public function getAuthorIdField() {
315 return 'ar_user';
316 }
317
318 public function getAuthorNameField() {
319 return 'ar_user_text';
320 }
321
322 public function getId() {
323 # Convert DB timestamp to MW timestamp
324 return $this->revision->getTimestamp();
325 }
326
327 public function setBits( $bits ) {
328 $dbw = wfGetDB( DB_MASTER );
329 $dbw->update( 'archive',
330 array( 'ar_deleted' => $bits ),
331 array(
332 'ar_namespace' => $this->list->title->getNamespace(),
333 'ar_title' => $this->list->title->getDBkey(),
334 // use timestamp for index
335 'ar_timestamp' => $this->row->ar_timestamp,
336 'ar_rev_id' => $this->row->ar_rev_id,
337 'ar_deleted' => $this->getBits()
338 ),
339 __METHOD__ );
340 return (bool)$dbw->affectedRows();
341 }
342
343 protected function getRevisionLink() {
344 $undelete = SpecialPage::getTitleFor( 'Undelete' );
345 $date = $this->list->getLanguage()->timeanddate( $this->revision->getTimestamp(), true );
346 if ( $this->isDeleted() && !$this->canViewContent() ) {
347 return $date;
348 }
349 return Linker::link( $undelete, $date, array(),
350 array(
351 'target' => $this->list->title->getPrefixedText(),
352 'timestamp' => $this->revision->getTimestamp()
353 ) );
354 }
355
356 protected function getDiffLink() {
357 if ( $this->isDeleted() && !$this->canViewContent() ) {
358 return wfMsgHtml( 'diff' );
359 }
360 $undelete = SpecialPage::getTitleFor( 'Undelete' );
361 return Linker::link( $undelete, wfMsgHtml('diff'), array(),
362 array(
363 'target' => $this->list->title->getPrefixedText(),
364 'diff' => 'prev',
365 'timestamp' => $this->revision->getTimestamp()
366 ) );
367 }
368 }
369
370
371 /**
372 * Item class for a archive table row by ar_rev_id -- actually
373 * used via RevDel_RevisionList.
374 */
375 class RevDel_ArchivedRevisionItem extends RevDel_ArchiveItem {
376 public function __construct( $list, $row ) {
377 RevDel_Item::__construct( $list, $row );
378
379 $this->revision = Revision::newFromArchiveRow( $row,
380 array( 'page' => $this->list->title->getArticleId() ) );
381 }
382
383 public function getIdField() {
384 return 'ar_rev_id';
385 }
386
387 public function getId() {
388 return $this->revision->getId();
389 }
390
391 public function setBits( $bits ) {
392 $dbw = wfGetDB( DB_MASTER );
393 $dbw->update( 'archive',
394 array( 'ar_deleted' => $bits ),
395 array( 'ar_rev_id' => $this->row->ar_rev_id,
396 'ar_deleted' => $this->getBits()
397 ),
398 __METHOD__ );
399 return (bool)$dbw->affectedRows();
400 }
401 }
402
403 /**
404 * List for oldimage table items
405 */
406 class RevDel_FileList extends RevDel_List {
407 public function getType() {
408 return 'oldimage';
409 }
410
411 public static function getRelationType() {
412 return 'oi_archive_name';
413 }
414
415 var $storeBatch, $deleteBatch, $cleanupBatch;
416
417 /**
418 * @param $db DatabaseBase
419 * @return mixed
420 */
421 public function doQuery( $db ) {
422 $archiveNames = array();
423 foreach( $this->ids as $timestamp ) {
424 $archiveNames[] = $timestamp . '!' . $this->title->getDBkey();
425 }
426 return $db->select( 'oldimage', '*',
427 array(
428 'oi_name' => $this->title->getDBkey(),
429 'oi_archive_name' => $archiveNames
430 ),
431 __METHOD__,
432 array( 'ORDER BY' => 'oi_timestamp DESC' )
433 );
434 }
435
436 public function newItem( $row ) {
437 return new RevDel_FileItem( $this, $row );
438 }
439
440 public function clearFileOps() {
441 $this->deleteBatch = array();
442 $this->storeBatch = array();
443 $this->cleanupBatch = array();
444 }
445
446 public function doPreCommitUpdates() {
447 $status = Status::newGood();
448 $repo = RepoGroup::singleton()->getLocalRepo();
449 if ( $this->storeBatch ) {
450 $status->merge( $repo->storeBatch( $this->storeBatch, FileRepo::OVERWRITE_SAME ) );
451 }
452 if ( !$status->isOK() ) {
453 return $status;
454 }
455 if ( $this->deleteBatch ) {
456 $status->merge( $repo->deleteBatch( $this->deleteBatch ) );
457 }
458 if ( !$status->isOK() ) {
459 // Running cleanupDeletedBatch() after a failed storeBatch() with the DB already
460 // modified (but destined for rollback) causes data loss
461 return $status;
462 }
463 if ( $this->cleanupBatch ) {
464 $status->merge( $repo->cleanupDeletedBatch( $this->cleanupBatch ) );
465 }
466 return $status;
467 }
468
469 public function doPostCommitUpdates() {
470 $file = wfLocalFile( $this->title );
471 $file->purgeCache();
472 $file->purgeDescription();
473 return Status::newGood();
474 }
475
476 public function getSuppressBit() {
477 return File::DELETED_RESTRICTED;
478 }
479 }
480
481 /**
482 * Item class for an oldimage table row
483 */
484 class RevDel_FileItem extends RevDel_Item {
485
486 /**
487 * @var File
488 */
489 var $file;
490
491 public function __construct( $list, $row ) {
492 parent::__construct( $list, $row );
493 $this->file = RepoGroup::singleton()->getLocalRepo()->newFileFromRow( $row );
494 }
495
496 public function getIdField() {
497 return 'oi_archive_name';
498 }
499
500 public function getTimestampField() {
501 return 'oi_timestamp';
502 }
503
504 public function getAuthorIdField() {
505 return 'oi_user';
506 }
507
508 public function getAuthorNameField() {
509 return 'oi_user_text';
510 }
511
512 public function getId() {
513 $parts = explode( '!', $this->row->oi_archive_name );
514 return $parts[0];
515 }
516
517 public function canView() {
518 return $this->file->userCan( File::DELETED_RESTRICTED, $this->list->getUser() );
519 }
520
521 public function canViewContent() {
522 return $this->file->userCan( File::DELETED_FILE, $this->list->getUser() );
523 }
524
525 public function getBits() {
526 return $this->file->getVisibility();
527 }
528
529 public function setBits( $bits ) {
530 # Queue the file op
531 # @todo FIXME: Move to LocalFile.php
532 if ( $this->isDeleted() ) {
533 if ( $bits & File::DELETED_FILE ) {
534 # Still deleted
535 } else {
536 # Newly undeleted
537 $key = $this->file->getStorageKey();
538 $srcRel = $this->file->repo->getDeletedHashPath( $key ) . $key;
539 $this->list->storeBatch[] = array(
540 $this->file->repo->getVirtualUrl( 'deleted' ) . '/' . $srcRel,
541 'public',
542 $this->file->getRel()
543 );
544 $this->list->cleanupBatch[] = $key;
545 }
546 } elseif ( $bits & File::DELETED_FILE ) {
547 # Newly deleted
548 $key = $this->file->getStorageKey();
549 $dstRel = $this->file->repo->getDeletedHashPath( $key ) . $key;
550 $this->list->deleteBatch[] = array( $this->file->getRel(), $dstRel );
551 }
552
553 # Do the database operations
554 $dbw = wfGetDB( DB_MASTER );
555 $dbw->update( 'oldimage',
556 array( 'oi_deleted' => $bits ),
557 array(
558 'oi_name' => $this->row->oi_name,
559 'oi_timestamp' => $this->row->oi_timestamp,
560 'oi_deleted' => $this->getBits()
561 ),
562 __METHOD__
563 );
564 return (bool)$dbw->affectedRows();
565 }
566
567 public function isDeleted() {
568 return $this->file->isDeleted( File::DELETED_FILE );
569 }
570
571 /**
572 * Get the link to the file.
573 * Overridden by RevDel_ArchivedFileItem.
574 * @return string
575 */
576 protected function getLink() {
577 $date = $this->list->getLanguage()->timeanddate( $this->file->getTimestamp(), true );
578 if ( $this->isDeleted() ) {
579 # Hidden files...
580 if ( !$this->canViewContent() ) {
581 $link = $date;
582 } else {
583 $revdelete = SpecialPage::getTitleFor( 'Revisiondelete' );
584 $link = Linker::link(
585 $revdelete,
586 $date, array(),
587 array(
588 'target' => $this->list->title->getPrefixedText(),
589 'file' => $this->file->getArchiveName(),
590 'token' => $this->list->getUser()->getEditToken(
591 $this->file->getArchiveName() )
592 )
593 );
594 }
595 return '<span class="history-deleted">' . $link . '</span>';
596 } else {
597 # Regular files...
598 return Xml::element( 'a', array( 'href' => $this->file->getUrl() ), $date );
599 }
600 }
601 /**
602 * Generate a user tool link cluster if the current user is allowed to view it
603 * @return string HTML
604 */
605 protected function getUserTools() {
606 if( $this->file->userCan( Revision::DELETED_USER, $this->list->getUser() ) ) {
607 $link = Linker::userLink( $this->file->user, $this->file->user_text ) .
608 Linker::userToolLinks( $this->file->user, $this->file->user_text );
609 } else {
610 $link = wfMsgHtml( 'rev-deleted-user' );
611 }
612 if( $this->file->isDeleted( Revision::DELETED_USER ) ) {
613 return '<span class="history-deleted">' . $link . '</span>';
614 }
615 return $link;
616 }
617
618 /**
619 * Wrap and format the file's comment block, if the current
620 * user is allowed to view it.
621 *
622 * @return string HTML
623 */
624 protected function getComment() {
625 if( $this->file->userCan( File::DELETED_COMMENT, $this->list->getUser() ) ) {
626 $block = Linker::commentBlock( $this->file->description );
627 } else {
628 $block = ' ' . wfMsgHtml( 'rev-deleted-comment' );
629 }
630 if( $this->file->isDeleted( File::DELETED_COMMENT ) ) {
631 return "<span class=\"history-deleted\">$block</span>";
632 }
633 return $block;
634 }
635
636 public function getHTML() {
637 $data =
638 wfMsg(
639 'widthheight',
640 $this->list->getLanguage()->formatNum( $this->file->getWidth() ),
641 $this->list->getLanguage()->formatNum( $this->file->getHeight() )
642 ) .
643 ' (' .
644 wfMsgExt( 'nbytes', 'parsemag', $this->list->getLanguage()->formatNum( $this->file->getSize() ) ) .
645 ')';
646
647 return '<li>' . $this->getLink() . ' ' . $this->getUserTools() . ' ' .
648 $data . ' ' . $this->getComment(). '</li>';
649 }
650 }
651
652 /**
653 * List for filearchive table items
654 */
655 class RevDel_ArchivedFileList extends RevDel_FileList {
656 public function getType() {
657 return 'filearchive';
658 }
659
660 public static function getRelationType() {
661 return 'fa_id';
662 }
663
664 /**
665 * @param $db DatabaseBase
666 * @return mixed
667 */
668 public function doQuery( $db ) {
669 $ids = array_map( 'intval', $this->ids );
670 return $db->select( 'filearchive', '*',
671 array(
672 'fa_name' => $this->title->getDBkey(),
673 'fa_id' => $ids
674 ),
675 __METHOD__,
676 array( 'ORDER BY' => 'fa_id DESC' )
677 );
678 }
679
680 public function newItem( $row ) {
681 return new RevDel_ArchivedFileItem( $this, $row );
682 }
683 }
684
685 /**
686 * Item class for a filearchive table row
687 */
688 class RevDel_ArchivedFileItem extends RevDel_FileItem {
689 public function __construct( $list, $row ) {
690 RevDel_Item::__construct( $list, $row );
691 $this->file = ArchivedFile::newFromRow( $row );
692 }
693
694 public function getIdField() {
695 return 'fa_id';
696 }
697
698 public function getTimestampField() {
699 return 'fa_timestamp';
700 }
701
702 public function getAuthorIdField() {
703 return 'fa_user';
704 }
705
706 public function getAuthorNameField() {
707 return 'fa_user_text';
708 }
709
710 public function getId() {
711 return $this->row->fa_id;
712 }
713
714 public function setBits( $bits ) {
715 $dbw = wfGetDB( DB_MASTER );
716 $dbw->update( 'filearchive',
717 array( 'fa_deleted' => $bits ),
718 array(
719 'fa_id' => $this->row->fa_id,
720 'fa_deleted' => $this->getBits(),
721 ),
722 __METHOD__
723 );
724 return (bool)$dbw->affectedRows();
725 }
726
727 protected function getLink() {
728 $date = $this->list->getLanguage()->timeanddate( $this->file->getTimestamp(), true );
729 $undelete = SpecialPage::getTitleFor( 'Undelete' );
730 $key = $this->file->getKey();
731 # Hidden files...
732 if( !$this->canViewContent() ) {
733 $link = $date;
734 } else {
735 $link = Linker::link( $undelete, $date, array(),
736 array(
737 'target' => $this->list->title->getPrefixedText(),
738 'file' => $key,
739 'token' => $this->list->getUser()->getEditToken( $key )
740 )
741 );
742 }
743 if( $this->isDeleted() ) {
744 $link = '<span class="history-deleted">' . $link . '</span>';
745 }
746 return $link;
747 }
748 }
749
750 /**
751 * List for logging table items
752 */
753 class RevDel_LogList extends RevDel_List {
754 public function getType() {
755 return 'logging';
756 }
757
758 public static function getRelationType() {
759 return 'log_id';
760 }
761
762 /**
763 * @param $db DatabaseBase
764 * @return mixed
765 */
766 public function doQuery( $db ) {
767 $ids = array_map( 'intval', $this->ids );
768 return $db->select( 'logging', '*',
769 array( 'log_id' => $ids ),
770 __METHOD__,
771 array( 'ORDER BY' => 'log_id DESC' )
772 );
773 }
774
775 public function newItem( $row ) {
776 return new RevDel_LogItem( $this, $row );
777 }
778
779 public function getSuppressBit() {
780 return Revision::DELETED_RESTRICTED;
781 }
782
783 public function getLogAction() {
784 return 'event';
785 }
786
787 public function getLogParams( $params ) {
788 return array(
789 implode( ',', $params['ids'] ),
790 "ofield={$params['oldBits']}",
791 "nfield={$params['newBits']}"
792 );
793 }
794 }
795
796 /**
797 * Item class for a logging table row
798 */
799 class RevDel_LogItem extends RevDel_Item {
800 public function getIdField() {
801 return 'log_id';
802 }
803
804 public function getTimestampField() {
805 return 'log_timestamp';
806 }
807
808 public function getAuthorIdField() {
809 return 'log_user';
810 }
811
812 public function getAuthorNameField() {
813 return 'log_user_text';
814 }
815
816 public function canView() {
817 return LogEventsList::userCan( $this->row, Revision::DELETED_RESTRICTED, $this->list->getUser() );
818 }
819
820 public function canViewContent() {
821 return true; // none
822 }
823
824 public function getBits() {
825 return $this->row->log_deleted;
826 }
827
828 public function setBits( $bits ) {
829 $dbw = wfGetDB( DB_MASTER );
830 $dbw->update( 'recentchanges',
831 array(
832 'rc_deleted' => $bits,
833 'rc_patrolled' => 1
834 ),
835 array(
836 'rc_logid' => $this->row->log_id,
837 'rc_timestamp' => $this->row->log_timestamp // index
838 ),
839 __METHOD__
840 );
841 $dbw->update( 'logging',
842 array( 'log_deleted' => $bits ),
843 array(
844 'log_id' => $this->row->log_id,
845 'log_deleted' => $this->getBits()
846 ),
847 __METHOD__
848 );
849 return (bool)$dbw->affectedRows();
850 }
851
852 public function getHTML() {
853 $date = htmlspecialchars( $this->list->getLanguage()->timeanddate( $this->row->log_timestamp ) );
854 $title = Title::makeTitle( $this->row->log_namespace, $this->row->log_title );
855 $formatter = LogFormatter::newFromRow( $this->row );
856 $formatter->setAudience( LogFormatter::FOR_THIS_USER );
857
858 // Log link for this page
859 $loglink = Linker::link(
860 SpecialPage::getTitleFor( 'Log' ),
861 wfMsgHtml( 'log' ),
862 array(),
863 array( 'page' => $title->getPrefixedText() )
864 );
865 // User links and action text
866 $action = $formatter->getActionText();
867 // Comment
868 $comment = $this->list->getLanguage()->getDirMark() . Linker::commentBlock( $this->row->log_comment );
869 if( LogEventsList::isDeleted($this->row,LogPage::DELETED_COMMENT) ) {
870 $comment = '<span class="history-deleted">' . $comment . '</span>';
871 }
872
873 return "<li>($loglink) $date $action $comment</li>";
874 }
875 }