a53c2b6636687e5953e831d741bd3caa83d0e34f
3 * Revision/log/file deletion backend
9 * Temporary b/c interface, collection of static functions.
10 * @ingroup SpecialPage
12 class RevisionDeleter
{
14 * Checks for a change in the bitfield for a certain option and updates the
15 * provided array accordingly.
17 * @param $desc String: description to add to the array if the option was
19 * @param $field Integer: the bitmask describing the single option.
20 * @param $diff Integer: the xor of the old and new bitfields.
21 * @param $new Integer: the new bitfield
22 * @param $arr Array: the array to update.
24 protected static function checkItem( $desc, $field, $diff, $new, &$arr ) {
25 if( $diff & $field ) {
26 $arr[ ( $new & $field ) ?
0 : 1 ][] = $desc;
31 * Gets an array of message keys describing the changes made to the visibility
32 * of the revision. If the resulting array is $arr, then $arr[0] will contain an
33 * array of strings describing the items that were hidden, $arr[2] will contain
34 * an array of strings describing the items that were unhidden, and $arr[3] will
35 * contain an array with a single string, which can be one of "applied
36 * restrictions to sysops", "removed restrictions from sysops", or null.
38 * @param $n Integer: the new bitfield.
39 * @param $o Integer: the old bitfield.
40 * @return An array as described above.
42 protected static function getChanges( $n, $o ) {
44 $ret = array( 0 => array(), 1 => array(), 2 => array() );
45 // Build bitfield changes in language
46 self
::checkItem( 'revdelete-content',
47 Revision
::DELETED_TEXT
, $diff, $n, $ret );
48 self
::checkItem( 'revdelete-summary',
49 Revision
::DELETED_COMMENT
, $diff, $n, $ret );
50 self
::checkItem( 'revdelete-uname',
51 Revision
::DELETED_USER
, $diff, $n, $ret );
52 // Restriction application to sysops
53 if( $diff & Revision
::DELETED_RESTRICTED
) {
54 if( $n & Revision
::DELETED_RESTRICTED
)
55 $ret[2][] = 'revdelete-restricted';
57 $ret[2][] = 'revdelete-unrestricted';
63 * Gets a log message to describe the given revision visibility change. This
64 * message will be of the form "[hid {content, edit summary, username}];
65 * [unhid {...}][applied restrictions to sysops] for $count revisions: $comment".
67 * @param $count Integer: The number of effected revisions.
68 * @param $nbitfield Integer: The new bitfield for the revision.
69 * @param $obitfield Integer: The old bitfield for the revision.
70 * @param $isForLog Boolean
71 * @param $forContent Boolean
73 public static function getLogMessage( $count, $nbitfield, $obitfield, $isForLog = false, $forContent = false ) {
74 global $wgLang, $wgContLang;
76 $lang = $forContent ?
$wgContLang : $wgLang;
77 $msgFunc = $forContent ?
"wfMsgForContent" : "wfMsg";
79 $changes = self
::getChanges( $nbitfield, $obitfield );
80 array_walk($changes, 'RevisionDeleter::expandMessageArray', $forContent);
82 $changesText = array();
84 if( count( $changes[0] ) ) {
85 $changesText[] = $msgFunc( 'revdelete-hid', $lang->commaList( $changes[0] ) );
87 if( count( $changes[1] ) ) {
88 $changesText[] = $msgFunc( 'revdelete-unhid', $lang->commaList( $changes[1] ) );
91 $s = $lang->semicolonList( $changesText );
92 if( count( $changes[2] ) ) {
93 $s .= $s ?
' (' . $changes[2][0] . ')' : ' ' . $changes[2][0];
96 $msg = $isForLog ?
'logdelete-log-message' : 'revdelete-log-message';
97 return wfMsgExt( $msg, $forContent ?
array( 'parsemag', 'content' ) : array( 'parsemag' ), $s, $lang->formatNum($count) );
100 private static function expandMessageArray(& $msg, $key, $forContent) {
101 if ( is_array ($msg) ) {
102 array_walk($msg, 'RevisionDeleter::expandMessageArray', $forContent);
105 $msg = wfMsgForContent($msg);
112 // Get DB field name for URL param...
113 // Future code for other things may also track
114 // other types of revision-specific changes.
115 // @returns string One of log_id/rev_id/fa_id/ar_timestamp/oi_archive_name
116 public static function getRelationType( $typeName ) {
117 if ( isset( SpecialRevisionDelete
::$deprecatedTypeMap[$typeName] ) ) {
118 $typeName = SpecialRevisionDelete
::$deprecatedTypeMap[$typeName];
120 if ( isset( SpecialRevisionDelete
::$allowedTypes[$typeName] ) ) {
121 $class = SpecialRevisionDelete
::$allowedTypes[$typeName]['list-class'];
122 $list = new $class( null, null, null );
123 return $list->getIdField();
129 // Checks if a revision still exists in the revision table.
130 // If it doesn't, returns the corresponding ar_timestamp field
131 // so that this key can be used instead.
132 public static function checkRevisionExistence( $title, $revid ) {
133 $dbr = wfGetDB( DB_SLAVE
);
134 $exists = $dbr->selectField( 'revision', '1',
135 array( 'rev_id' => $revid ), __METHOD__
);
141 $timestamp = $dbr->selectField( 'archive', 'ar_timestamp',
142 array( 'ar_namespace' => $title->getNamespace(),
143 'ar_title' => $title->getDBkey(),
144 'ar_rev_id' => $revid ), __METHOD__
);
149 // Creates utility links for log entries.
150 public static function getLogLinks( $title, $paramArray, $skin, $messages ) {
153 if( count($paramArray) >= 2 ) {
154 // Different revision types use different URL params...
155 $originalKey = $key = $paramArray[0];
156 // $paramArray[1] is a CSV of the IDs
157 $Ids = explode( ',', $paramArray[1] );
161 // For if undeleted revisions are found amidst deleted ones.
162 $undeletedRevisions = array();
164 // This is not going to work if some revs are deleted and some
166 if ($key == 'revision') {
167 foreach( $Ids as $k => $id ) {
169 self
::checkRevisionExistence( $title, $id );
171 if ($existResult !== true) {
173 $Ids[$k] = $existResult;
175 // Undeleted revision amidst deleted ones
177 $undeletedRevisions[] = $id;
181 if ( $key == $originalKey ) {
182 $Ids = $undeletedRevisions;
183 $undeletedRevisions = array();
187 // Diff link for single rev deletions
188 if( count($Ids) == 1 && !count($undeletedRevisions) ) {
189 // Live revision diffs...
190 if( in_array( $key, array( 'oldid', 'revision' ) ) ) {
191 $revert[] = $skin->link(
196 'diff' => intval( $Ids[0] ),
199 array( 'known', 'noclasses' )
201 // Deleted revision diffs...
202 } else if( in_array( $key, array( 'artimestamp','archive' ) ) ) {
203 $revert[] = $skin->link(
204 SpecialPage
::getTitleFor( 'Undelete' ),
208 'target' => $title->getPrefixedDBKey(),
210 'timestamp' => $Ids[0]
212 array( 'known', 'noclasses' )
217 // View/modify link...
218 if ( count($undeletedRevisions) ) {
219 // FIXME THIS IS A HORRIBLE HORRIBLE HACK AND SHOULD DIE
220 // It's not possible to pass a list of both deleted and
221 // undeleted revisions to SpecialRevisionDelete, so we're
222 // stuck with two links. See bug 23363.
223 $restoreLinks = array();
225 $restoreLinks[] = $skin->link(
226 SpecialPage
::getTitleFor( 'Revisiondelete' ),
227 $messages['revdel-restore-visible'],
230 'target' => $title->getPrefixedText(),
231 'type' => $originalKey,
232 'ids' => implode(',', $undeletedRevisions),
234 array( 'known', 'noclasses' )
237 $restoreLinks[] = $skin->link(
238 SpecialPage
::getTitleFor( 'Revisiondelete' ),
239 $messages['revdel-restore-deleted'],
242 'target' => $title->getPrefixedText(),
244 'ids' => implode(',', $Ids),
246 array( 'known', 'noclasses' )
249 $revert[] = $messages['revdel-restore'] . ' [' .
250 $wgLang->pipeList( $restoreLinks ) . ']';
252 $revert[] = $skin->link(
253 SpecialPage
::getTitleFor( 'Revisiondelete' ),
254 $messages['revdel-restore'],
257 'target' => $title->getPrefixedText(),
259 'ids' => implode(',', $Ids),
261 array( 'known', 'noclasses' )
266 return wfMsg( 'parentheses', $wgLang->pipeList( $revert ) );
273 * List for revision table items
275 class RevDel_RevisionList
extends RevDel_List
{
277 var $type = 'revision';
278 var $idField = 'rev_id';
279 var $dateField = 'rev_timestamp';
280 var $authorIdField = 'rev_user';
281 var $authorNameField = 'rev_user_text';
283 public function doQuery( $db ) {
284 $ids = array_map( 'intval', $this->ids
);
285 return $db->select( array('revision','page'), '*',
287 'rev_page' => $this->title
->getArticleID(),
292 array( 'ORDER BY' => 'rev_id DESC' )
296 public function newItem( $row ) {
297 return new RevDel_RevisionItem( $this, $row );
300 public function getCurrent() {
301 if ( is_null( $this->currentRevId
) ) {
302 $dbw = wfGetDB( DB_MASTER
);
303 $this->currentRevId
= $dbw->selectField(
304 'page', 'page_latest', $this->title
->pageCond(), __METHOD__
);
306 return $this->currentRevId
;
309 public function getSuppressBit() {
310 return Revision
::DELETED_RESTRICTED
;
313 public function doPreCommitUpdates() {
314 $this->title
->invalidateCache();
315 return Status
::newGood();
318 public function doPostCommitUpdates() {
319 $this->title
->purgeSquid();
320 // Extensions that require referencing previous revisions may need this
321 wfRunHooks( 'ArticleRevisionVisibilitySet', array( &$this->title
) );
322 return Status
::newGood();
327 * Item class for a revision table row
329 class RevDel_RevisionItem
extends RevDel_Item
{
332 public function __construct( $list, $row ) {
333 parent
::__construct( $list, $row );
334 $this->revision
= new Revision( $row );
337 public function canView() {
338 return $this->revision
->userCan( Revision
::DELETED_RESTRICTED
);
341 public function canViewContent() {
342 return $this->revision
->userCan( Revision
::DELETED_TEXT
);
345 public function getBits() {
346 return $this->revision
->mDeleted
;
349 public function setBits( $bits ) {
350 $dbw = wfGetDB( DB_MASTER
);
351 // Update revision table
352 $dbw->update( 'revision',
353 array( 'rev_deleted' => $bits ),
355 'rev_id' => $this->revision
->getId(),
356 'rev_page' => $this->revision
->getPage(),
357 'rev_deleted' => $this->getBits()
361 if ( !$dbw->affectedRows() ) {
365 // Update recentchanges table
366 $dbw->update( 'recentchanges',
368 'rc_deleted' => $bits,
372 'rc_this_oldid' => $this->revision
->getId(), // condition
373 // non-unique timestamp index
374 'rc_timestamp' => $dbw->timestamp( $this->revision
->getTimestamp() ),
381 public function isDeleted() {
382 return $this->revision
->isDeleted( Revision
::DELETED_TEXT
);
385 public function isHideCurrentOp( $newBits ) {
386 return ( $newBits & Revision
::DELETED_TEXT
)
387 && $this->list->getCurrent() == $this->getId();
391 * Get the HTML link to the revision text.
392 * Overridden by RevDel_ArchiveItem.
394 protected function getRevisionLink() {
396 $date = $wgLang->timeanddate( $this->revision
->getTimestamp(), true );
397 if ( $this->isDeleted() && !$this->canViewContent() ) {
400 return $this->special
->skin
->link(
405 'oldid' => $this->revision
->getId(),
412 * Get the HTML link to the diff.
413 * Overridden by RevDel_ArchiveItem
415 protected function getDiffLink() {
416 if ( $this->isDeleted() && !$this->canViewContent() ) {
417 return wfMsgHtml('diff');
420 $this->special
->skin
->link(
425 'diff' => $this->revision
->getId(),
437 public function getHTML() {
438 $difflink = $this->getDiffLink();
439 $revlink = $this->getRevisionLink();
440 $userlink = $this->special
->skin
->revUserLink( $this->revision
);
441 $comment = $this->special
->skin
->revComment( $this->revision
);
442 if ( $this->isDeleted() ) {
443 $revlink = "<span class=\"history-deleted\">$revlink</span>";
445 return "<li>($difflink) $revlink $userlink $comment</li>";
450 * List for archive table items, i.e. revisions deleted via action=delete
452 class RevDel_ArchiveList
extends RevDel_RevisionList
{
453 var $type = 'archive';
454 var $idField = 'ar_timestamp';
455 var $dateField = 'ar_timestamp';
456 var $authorIdField = 'ar_user';
457 var $authorNameField = 'ar_user_text';
459 public function doQuery( $db ) {
460 $timestamps = array();
461 foreach ( $this->ids
as $id ) {
462 $timestamps[] = $db->timestamp( $id );
464 return $db->select( 'archive', '*',
466 'ar_namespace' => $this->title
->getNamespace(),
467 'ar_title' => $this->title
->getDBkey(),
468 'ar_timestamp' => $timestamps
471 array( 'ORDER BY' => 'ar_timestamp DESC' )
475 public function newItem( $row ) {
476 return new RevDel_ArchiveItem( $this, $row );
479 public function doPreCommitUpdates() {
480 return Status
::newGood();
483 public function doPostCommitUpdates() {
484 return Status
::newGood();
489 * Item class for a archive table row
491 class RevDel_ArchiveItem
extends RevDel_RevisionItem
{
492 public function __construct( $list, $row ) {
493 parent
::__construct( $list, $row );
494 $this->revision
= Revision
::newFromArchiveRow( $row,
495 array( 'page' => $this->list->title
->getArticleId() ) );
498 public function getId() {
499 # Convert DB timestamp to MW timestamp
500 return $this->revision
->getTimestamp();
503 public function setBits( $bits ) {
504 $dbw = wfGetDB( DB_MASTER
);
505 $dbw->update( 'archive',
506 array( 'ar_deleted' => $bits ),
507 array( 'ar_namespace' => $this->list->title
->getNamespace(),
508 'ar_title' => $this->list->title
->getDBkey(),
509 // use timestamp for index
510 'ar_timestamp' => $this->row
->ar_timestamp
,
511 'ar_rev_id' => $this->row
->ar_rev_id
,
512 'ar_deleted' => $this->getBits()
515 return (bool)$dbw->affectedRows();
518 protected function getRevisionLink() {
520 $undelete = SpecialPage
::getTitleFor( 'Undelete' );
521 $date = $wgLang->timeanddate( $this->revision
->getTimestamp(), true );
522 if ( $this->isDeleted() && !$this->canViewContent() ) {
525 return $this->special
->skin
->link( $undelete, $date, array(),
527 'target' => $this->list->title
->getPrefixedText(),
528 'timestamp' => $this->revision
->getTimestamp()
532 protected function getDiffLink() {
533 if ( $this->isDeleted() && !$this->canViewContent() ) {
534 return wfMsgHtml( 'diff' );
536 $undelete = SpecialPage
::getTitleFor( 'Undelete' );
537 return $this->special
->skin
->link( $undelete, wfMsgHtml('diff'), array(),
539 'target' => $this->list->title
->getPrefixedText(),
541 'timestamp' => $this->revision
->getTimestamp()
547 * List for oldimage table items
549 class RevDel_FileList
extends RevDel_List
{
550 var $type = 'oldimage';
551 var $idField = 'oi_archive_name';
552 var $dateField = 'oi_timestamp';
553 var $authorIdField = 'oi_user';
554 var $authorNameField = 'oi_user_text';
555 var $storeBatch, $deleteBatch, $cleanupBatch;
557 public function doQuery( $db ) {
558 $archiveNames = array();
559 foreach( $this->ids
as $timestamp ) {
560 $archiveNames[] = $timestamp . '!' . $this->title
->getDBkey();
562 return $db->select( 'oldimage', '*',
564 'oi_name' => $this->title
->getDBkey(),
565 'oi_archive_name' => $archiveNames
568 array( 'ORDER BY' => 'oi_timestamp DESC' )
572 public function newItem( $row ) {
573 return new RevDel_FileItem( $this, $row );
576 public function clearFileOps() {
577 $this->deleteBatch
= array();
578 $this->storeBatch
= array();
579 $this->cleanupBatch
= array();
582 public function doPreCommitUpdates() {
583 $status = Status
::newGood();
584 $repo = RepoGroup
::singleton()->getLocalRepo();
585 if ( $this->storeBatch
) {
586 $status->merge( $repo->storeBatch( $this->storeBatch
, FileRepo
::OVERWRITE_SAME
) );
588 if ( !$status->isOK() ) {
591 if ( $this->deleteBatch
) {
592 $status->merge( $repo->deleteBatch( $this->deleteBatch
) );
594 if ( !$status->isOK() ) {
595 // Running cleanupDeletedBatch() after a failed storeBatch() with the DB already
596 // modified (but destined for rollback) causes data loss
599 if ( $this->cleanupBatch
) {
600 $status->merge( $repo->cleanupDeletedBatch( $this->cleanupBatch
) );
605 public function doPostCommitUpdates() {
606 $file = wfLocalFile( $this->title
);
608 $file->purgeDescription();
609 return Status
::newGood();
612 public function getSuppressBit() {
613 return File
::DELETED_RESTRICTED
;
618 * Item class for an oldimage table row
620 class RevDel_FileItem
extends RevDel_Item
{
623 public function __construct( $list, $row ) {
624 parent
::__construct( $list, $row );
625 $this->file
= RepoGroup
::singleton()->getLocalRepo()->newFileFromRow( $row );
628 public function getId() {
629 $parts = explode( '!', $this->row
->oi_archive_name
);
633 public function canView() {
634 return $this->file
->userCan( File
::DELETED_RESTRICTED
);
637 public function canViewContent() {
638 return $this->file
->userCan( File
::DELETED_FILE
);
641 public function getBits() {
642 return $this->file
->getVisibility();
645 public function setBits( $bits ) {
647 # FIXME: move to LocalFile.php
648 if ( $this->isDeleted() ) {
649 if ( $bits & File
::DELETED_FILE
) {
653 $key = $this->file
->getStorageKey();
654 $srcRel = $this->file
->repo
->getDeletedHashPath( $key ) . $key;
655 $this->list->storeBatch
[] = array(
656 $this->file
->repo
->getVirtualUrl( 'deleted' ) . '/' . $srcRel,
658 $this->file
->getRel()
660 $this->list->cleanupBatch
[] = $key;
662 } elseif ( $bits & File
::DELETED_FILE
) {
664 $key = $this->file
->getStorageKey();
665 $dstRel = $this->file
->repo
->getDeletedHashPath( $key ) . $key;
666 $this->list->deleteBatch
[] = array( $this->file
->getRel(), $dstRel );
669 # Do the database operations
670 $dbw = wfGetDB( DB_MASTER
);
671 $dbw->update( 'oldimage',
672 array( 'oi_deleted' => $bits ),
674 'oi_name' => $this->row
->oi_name
,
675 'oi_timestamp' => $this->row
->oi_timestamp
,
676 'oi_deleted' => $this->getBits()
680 return (bool)$dbw->affectedRows();
683 public function isDeleted() {
684 return $this->file
->isDeleted( File
::DELETED_FILE
);
688 * Get the link to the file.
689 * Overridden by RevDel_ArchivedFileItem.
691 protected function getLink() {
692 global $wgLang, $wgUser;
693 $date = $wgLang->timeanddate( $this->file
->getTimestamp(), true );
694 if ( $this->isDeleted() ) {
696 if ( !$this->canViewContent() ) {
699 $link = $this->special
->skin
->link(
700 $this->special
->getTitle(),
703 'target' => $this->list->title
->getPrefixedText(),
704 'file' => $this->file
->getArchiveName(),
705 'token' => $wgUser->editToken( $this->file
->getArchiveName() )
709 return '<span class="history-deleted">' . $link . '</span>';
712 return Xml
::element( 'a', array( 'href' => $this->file
->getUrl() ), $date );
716 * Generate a user tool link cluster if the current user is allowed to view it
717 * @return string HTML
719 protected function getUserTools() {
720 if( $this->file
->userCan( Revision
::DELETED_USER
) ) {
721 $link = $this->special
->skin
->userLink( $this->file
->user
, $this->file
->user_text
) .
722 $this->special
->skin
->userToolLinks( $this->file
->user
, $this->file
->user_text
);
724 $link = wfMsgHtml( 'rev-deleted-user' );
726 if( $this->file
->isDeleted( Revision
::DELETED_USER
) ) {
727 return '<span class="history-deleted">' . $link . '</span>';
733 * Wrap and format the file's comment block, if the current
734 * user is allowed to view it.
736 * @return string HTML
738 protected function getComment() {
739 if( $this->file
->userCan( File
::DELETED_COMMENT
) ) {
740 $block = $this->special
->skin
->commentBlock( $this->file
->description
);
742 $block = ' ' . wfMsgHtml( 'rev-deleted-comment' );
744 if( $this->file
->isDeleted( File
::DELETED_COMMENT
) ) {
745 return "<span class=\"history-deleted\">$block</span>";
750 public function getHTML() {
755 $wgLang->formatNum( $this->file
->getWidth() ),
756 $wgLang->formatNum( $this->file
->getHeight() )
759 wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $this->file
->getSize() ) ) .
762 return '<li>' . $this->getLink() . ' ' . $this->getUserTools() . ' ' .
763 $data . ' ' . $this->getComment(). '</li>';
768 * List for filearchive table items
770 class RevDel_ArchivedFileList
extends RevDel_FileList
{
771 var $type = 'filearchive';
772 var $idField = 'fa_id';
773 var $dateField = 'fa_timestamp';
774 var $authorIdField = 'fa_user';
775 var $authorNameField = 'fa_user_text';
777 public function doQuery( $db ) {
778 $ids = array_map( 'intval', $this->ids
);
779 return $db->select( 'filearchive', '*',
781 'fa_name' => $this->title
->getDBkey(),
785 array( 'ORDER BY' => 'fa_id DESC' )
789 public function newItem( $row ) {
790 return new RevDel_ArchivedFileItem( $this, $row );
795 * Item class for a filearchive table row
797 class RevDel_ArchivedFileItem
extends RevDel_FileItem
{
798 public function __construct( $list, $row ) {
799 parent
::__construct( $list, $row );
800 $this->file
= ArchivedFile
::newFromRow( $row );
803 public function getId() {
804 return $this->row
->fa_id
;
807 public function setBits( $bits ) {
808 $dbw = wfGetDB( DB_MASTER
);
809 $dbw->update( 'filearchive',
810 array( 'fa_deleted' => $bits ),
812 'fa_id' => $this->row
->fa_id
,
813 'fa_deleted' => $this->getBits(),
817 return (bool)$dbw->affectedRows();
820 protected function getLink() {
821 global $wgLang, $wgUser;
822 $date = $wgLang->timeanddate( $this->file
->getTimestamp(), true );
823 $undelete = SpecialPage
::getTitleFor( 'Undelete' );
824 $key = $this->file
->getKey();
826 if( !$this->canViewContent() ) {
829 $link = $this->special
->skin
->link( $undelete, $date, array(),
831 'target' => $this->list->title
->getPrefixedText(),
833 'token' => $wgUser->editToken( $key )
837 if( $this->isDeleted() ) {
838 $link = '<span class="history-deleted">' . $link . '</span>';
845 * List for logging table items
847 class RevDel_LogList
extends RevDel_List
{
848 var $type = 'logging';
849 var $idField = 'log_id';
850 var $dateField = 'log_timestamp';
851 var $authorIdField = 'log_user';
852 var $authorNameField = 'log_user_text';
854 public function doQuery( $db ) {
855 $ids = array_map( 'intval', $this->ids
);
856 return $db->select( 'logging', '*',
857 array( 'log_id' => $ids ),
859 array( 'ORDER BY' => 'log_id DESC' )
863 public function newItem( $row ) {
864 return new RevDel_LogItem( $this, $row );
867 public function getSuppressBit() {
868 return Revision
::DELETED_RESTRICTED
;
871 public function getLogAction() {
875 public function getLogParams( $params ) {
877 implode( ',', $params['ids'] ),
878 "ofield={$params['oldBits']}",
879 "nfield={$params['newBits']}"
885 * Item class for a logging table row
887 class RevDel_LogItem
extends RevDel_Item
{
888 public function canView() {
889 return LogEventsList
::userCan( $this->row
, Revision
::DELETED_RESTRICTED
);
892 public function canViewContent() {
896 public function getBits() {
897 return $this->row
->log_deleted
;
900 public function setBits( $bits ) {
901 $dbw = wfGetDB( DB_MASTER
);
902 $dbw->update( 'recentchanges',
904 'rc_deleted' => $bits,
908 'rc_logid' => $this->row
->log_id
,
909 'rc_timestamp' => $this->row
->log_timestamp
// index
913 $dbw->update( 'logging',
914 array( 'log_deleted' => $bits ),
916 'log_id' => $this->row
->log_id
,
917 'log_deleted' => $this->getBits()
921 return (bool)$dbw->affectedRows();
924 public function getHTML() {
927 $date = htmlspecialchars( $wgLang->timeanddate( $this->row
->log_timestamp
) );
928 $paramArray = LogPage
::extractParams( $this->row
->log_params
);
929 $title = Title
::makeTitle( $this->row
->log_namespace
, $this->row
->log_title
);
931 // Log link for this page
932 $loglink = $this->special
->skin
->link(
933 SpecialPage
::getTitleFor( 'Log' ),
936 array( 'page' => $title->getPrefixedText() )
939 if( !$this->canView() ) {
940 $action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
942 $action = LogPage
::actionText( $this->row
->log_type
, $this->row
->log_action
, $title,
943 $this->special
->skin
, $paramArray, true, true );
944 if( $this->row
->log_deleted
& LogPage
::DELETED_ACTION
)
945 $action = '<span class="history-deleted">' . $action . '</span>';
948 $userLink = $this->special
->skin
->userLink( $this->row
->log_user
,
949 User
::WhoIs( $this->row
->log_user
) );
950 if( LogEventsList
::isDeleted($this->row
,LogPage
::DELETED_USER
) ) {
951 $userLink = '<span class="history-deleted">' . $userLink . '</span>';
954 $comment = $wgLang->getDirMark() . $this->special
->skin
->commentBlock( $this->row
->log_comment
);
955 if( LogEventsList
::isDeleted($this->row
,LogPage
::DELETED_COMMENT
) ) {
956 $comment = '<span class="history-deleted">' . $comment . '</span>';
958 return "<li>($loglink) $date $userLink $action $comment</li>";