3 * Special page allowing users with the appropriate permissions to view
4 * and hide revisions. Log items can also be hidden.
10 class SpecialRevisionDelete
extends UnlistedSpecialPage
{
14 /** True if the submit button was clicked, and the form was posted */
20 /** Archive name, for reviewing deleted files */
23 /** Edit token for securing image views against XSS */
26 /** Title object for target parameter */
29 /** Deletion type, may be revision, archive, oldimage, filearchive, logging. */
32 /** Array of checkbox specs (message, name, deletion bits) */
35 /** Information about the current type */
38 /** The RevDel_List object, storing the list of items to be deleted/undeleted */
42 * Assorted information about each type, needed by the special page.
43 * TODO Move some of this to the list class
45 static $allowedTypes = array(
47 'check-label' => 'revdelete-hide-text',
48 'deletion-bits' => Revision
::DELETED_TEXT
,
49 'success' => 'revdelete-success',
50 'failure' => 'revdelete-failure',
51 'list-class' => 'RevDel_RevisionList',
54 'check-label' => 'revdelete-hide-text',
55 'deletion-bits' => Revision
::DELETED_TEXT
,
56 'success' => 'revdelete-success',
57 'failure' => 'revdelete-failure',
58 'list-class' => 'RevDel_ArchiveList',
61 'check-label' => 'revdelete-hide-image',
62 'deletion-bits' => File
::DELETED_FILE
,
63 'success' => 'revdelete-success',
64 'failure' => 'revdelete-failure',
65 'list-class' => 'RevDel_FileList',
67 'filearchive' => array(
68 'check-label' => 'revdelete-hide-image',
69 'deletion-bits' => File
::DELETED_FILE
,
70 'success' => 'revdelete-success',
71 'failure' => 'revdelete-failure',
72 'list-class' => 'RevDel_ArchivedFileList',
75 'check-label' => 'revdelete-hide-name',
76 'deletion-bits' => LogPage
::DELETED_ACTION
,
77 'success' => 'logdelete-success',
78 'failure' => 'logdelete-failure',
79 'list-class' => 'RevDel_LogList',
83 /** Type map to support old log entries */
84 static $deprecatedTypeMap = array(
85 'oldid' => 'revision',
86 'artimestamp' => 'archive',
87 'oldimage' => 'oldimage',
88 'fileid' => 'filearchive',
92 public function __construct() {
93 parent
::__construct( 'Revisiondelete', 'deletedrevision' );
96 public function execute( $par ) {
97 global $wgOut, $wgUser, $wgRequest;
98 if( !$wgUser->isAllowed( 'deletedrevision' ) ) {
99 $wgOut->permissionRequired( 'deletedrevision' );
101 } else if( wfReadOnly() ) {
102 $wgOut->readOnlyPage();
105 $this->mIsAllowed
= $wgUser->isAllowed('deleterevision'); // for changes
106 $this->skin
= $wgUser->getSkin();
108 $this->outputHeader();
109 $this->submitClicked
= $wgRequest->wasPosted() && $wgRequest->getBool( 'wpSubmit' );
110 # Handle our many different possible input types.
111 $ids = $wgRequest->getVal( 'ids' );
112 if ( !is_null( $ids ) ) {
113 # Allow CSV, for backwards compatibility, or a single ID for show/hide links
114 $this->ids
= explode( ',', $ids );
117 $this->ids
= array_keys( $wgRequest->getArray('ids',array()) );
119 // $this->ids = array_map( 'intval', $this->ids );
120 $this->ids
= array_unique( array_filter( $this->ids
) );
122 if ( $wgRequest->getVal( 'action' ) == 'revisiondelete' ) {
123 # For show/hide form submission from history page
124 $this->targetObj
= $GLOBALS['wgTitle'];
125 $this->typeName
= 'revision';
127 $this->typeName
= $wgRequest->getVal( 'type' );
128 $this->targetObj
= Title
::newFromText( $wgRequest->getText( 'target' ) );
131 # For reviewing deleted files...
132 $this->archiveName
= $wgRequest->getVal( 'file' );
133 $this->token
= $wgRequest->getVal( 'token' );
134 if ( $this->archiveName
&& $this->targetObj
) {
135 $this->tryShowFile( $this->archiveName
);
139 if ( isset( self
::$deprecatedTypeMap[$this->typeName
] ) ) {
140 $this->typeName
= self
::$deprecatedTypeMap[$this->typeName
];
144 if( !isset( self
::$allowedTypes[$this->typeName
] ) ||
count( $this->ids
) == 0 ) {
145 $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
148 $this->typeInfo
= self
::$allowedTypes[$this->typeName
];
150 # If we have revisions, get the title from the first one
151 # since they should all be from the same page. This allows
152 # for more flexibility with page moves...
153 if( $this->typeName
== 'revision' ) {
154 $rev = Revision
::newFromId( $this->ids
[0] );
155 $this->targetObj
= $rev ?
$rev->getTitle() : $this->targetObj
;
158 $this->otherReason
= $wgRequest->getVal( 'wpReason' );
159 # We need a target page!
160 if( is_null($this->targetObj
) ) {
161 $wgOut->addWikiMsg( 'undelete-header' );
164 # Give a link to the logs/hist for this page
165 $this->showConvenienceLinks();
167 # Initialise checkboxes
168 $this->checks
= array(
169 array( $this->typeInfo
['check-label'], 'wpHidePrimary', $this->typeInfo
['deletion-bits'] ),
170 array( 'revdelete-hide-comment', 'wpHideComment', Revision
::DELETED_COMMENT
),
171 array( 'revdelete-hide-user', 'wpHideUser', Revision
::DELETED_USER
)
173 if( $wgUser->isAllowed('suppressrevision') ) {
174 $this->checks
[] = array( 'revdelete-hide-restricted',
175 'wpHideRestricted', Revision
::DELETED_RESTRICTED
);
178 # Either submit or create our form
179 if( $this->mIsAllowed
&& $this->submitClicked
) {
180 $this->submit( $wgRequest );
184 $qc = $this->getLogQueryCond();
185 # Show relevant lines from the deletion log
186 $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage
::logName( 'delete' ) ) . "</h2>\n" );
187 LogEventsList
::showLogExtract( $wgOut, 'delete',
188 $this->targetObj
->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) );
189 # Show relevant lines from the suppression log
190 if( $wgUser->isAllowed( 'suppressionlog' ) ) {
191 $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage
::logName( 'suppress' ) ) . "</h2>\n" );
192 LogEventsList
::showLogExtract( $wgOut, 'suppress',
193 $this->targetObj
->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) );
198 * Show some useful links in the subtitle
200 protected function showConvenienceLinks() {
201 global $wgOut, $wgUser, $wgLang;
202 # Give a link to the logs/hist for this page
203 if( $this->targetObj
) {
205 $links[] = $this->skin
->linkKnown(
206 SpecialPage
::getTitleFor( 'Log' ),
207 wfMsgHtml( 'viewpagelogs' ),
209 array( 'page' => $this->targetObj
->getPrefixedText() )
211 if ( $this->targetObj
->getNamespace() != NS_SPECIAL
) {
212 # Give a link to the page history
213 $links[] = $this->skin
->linkKnown(
215 wfMsgHtml( 'pagehist' ),
217 array( 'action' => 'history' )
219 # Link to deleted edits
220 if( $wgUser->isAllowed('undelete') ) {
221 $undelete = SpecialPage
::getTitleFor( 'Undelete' );
222 $links[] = $this->skin
->linkKnown(
224 wfMsgHtml( 'deletedhist' ),
226 array( 'target' => $this->targetObj
->getPrefixedDBkey() )
230 # Logs themselves don't have histories or archived revisions
231 $wgOut->setSubtitle( '<p>' . $wgLang->pipeList( $links ) . '</p>' );
236 * Get the condition used for fetching log snippets
238 protected function getLogQueryCond() {
240 // Revision delete logs for these item
241 $conds['log_type'] = array('delete','suppress');
242 $conds['log_action'] = $this->getList()->getLogAction();
243 $conds['ls_field'] = RevisionDeleter
::getRelationType( $this->typeName
);
244 $conds['ls_value'] = $this->ids
;
249 * Show a deleted file version requested by the visitor.
250 * TODO Mostly copied from Special:Undelete. Refactor.
252 protected function tryShowFile( $archiveName ) {
253 global $wgOut, $wgRequest, $wgUser, $wgLang;
255 $repo = RepoGroup
::singleton()->getLocalRepo();
256 $oimage = $repo->newFromArchiveName( $this->targetObj
, $archiveName );
258 // Check if user is allowed to see this file
259 if ( !$oimage->exists() ) {
260 $wgOut->addWikiMsg( 'revdelete-no-file' );
263 if( !$oimage->userCan(File
::DELETED_FILE
) ) {
264 $wgOut->permissionRequired( 'suppressrevision' );
267 if ( !$wgUser->matchEditToken( $this->token
, $archiveName ) ) {
268 $wgOut->addWikiMsg( 'revdelete-show-file-confirm',
269 $this->targetObj
->getText(),
270 $wgLang->date( $oimage->getTimestamp() ),
271 $wgLang->time( $oimage->getTimestamp() ) );
273 Xml
::openElement( 'form', array(
275 'action' => $this->getTitle()->getLocalUrl(
276 'target=' . urlencode( $oimage->getName() ) .
277 '&file=' . urlencode( $archiveName ) .
278 '&token=' . urlencode( $wgUser->editToken( $archiveName ) ) )
281 Xml
::submitButton( wfMsg( 'revdelete-show-file-submit' ) ) .
287 # We mustn't allow the output to be Squid cached, otherwise
288 # if an admin previews a deleted image, and it's cached, then
289 # a user without appropriate permissions can toddle off and
290 # nab the image, and Squid will serve it
291 $wgRequest->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
292 $wgRequest->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
293 $wgRequest->response()->header( 'Pragma: no-cache' );
295 # Stream the file to the client
297 require_once( "$IP/includes/StreamFile.php" );
298 $key = $oimage->getStorageKey();
299 $path = $repo->getZonePath( 'deleted' ) . '/' . $repo->getDeletedHashPath( $key ) . $key;
300 wfStreamFile( $path );
304 * Get the list object for this request
306 protected function getList() {
307 if ( is_null( $this->list ) ) {
308 $class = $this->typeInfo
['list-class'];
309 $this->list = new $class( $this, $this->targetObj
, $this->ids
);
315 * Show a list of items that we will operate on, and show a form with checkboxes
316 * which will allow the user to choose new visibility settings.
318 protected function showForm() {
319 global $wgOut, $wgUser, $wgLang;
322 if ( $this->typeName
== 'logging' ) {
323 $wgOut->addWikiMsg( 'logdelete-selected', $wgLang->formatNum( count($this->ids
) ) );
325 $wgOut->addWikiMsg( 'revdelete-selected',
326 $this->targetObj
->getPrefixedText(), count( $this->ids
) );
330 $wgOut->addHTML( "<ul>" );
332 $where = $revObjs = array();
336 $list = $this->getList();
337 for ( $list->reset(); $list->current(); $list->next() ) {
338 $item = $list->current();
339 if ( !$item->canView() ) {
340 if( !$this->submitClicked
) {
341 $wgOut->permissionRequired( 'suppressrevision' );
344 $UserAllowed = false;
347 $bitfields |
= $item->getBits();
348 $wgOut->addHTML( $item->getHTML() );
351 if( !$numRevisions ) {
352 $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
356 $wgOut->addHTML( "</ul>" );
358 $this->addUsageText();
360 // Normal sysops can always see what they did, but can't always change it
361 if( !$UserAllowed ) return;
363 // Show form if the user can submit
364 if( $this->mIsAllowed
) {
365 $out = Xml
::openElement( 'form', array( 'method' => 'post',
366 'action' => $this->getTitle()->getLocalUrl( array( 'action' => 'submit' ) ),
367 'id' => 'mw-revdel-form-revisions' ) ) .
368 Xml
::fieldset( wfMsg( 'revdelete-legend' ) ) .
369 $this->buildCheckBoxes( $bitfields ) .
370 Xml
::openElement( 'table' ) .
372 '<td class="mw-label">' .
373 Xml
::label( wfMsg( 'revdelete-log' ), 'wpRevDeleteReasonList' ) .
375 '<td class="mw-input">' .
376 Xml
::listDropDown( 'wpRevDeleteReasonList',
377 wfMsgForContent( 'revdelete-reason-dropdown' ),
378 wfMsgForContent( 'revdelete-reasonotherlist' ), '', 'wpReasonDropDown', 1
382 '<td class="mw-label">' .
383 Xml
::label( wfMsg( 'revdelete-otherreason' ), 'wpReason' ) .
385 '<td class="mw-input">' .
386 Xml
::input( 'wpReason', 60, $this->otherReason
, array( 'id' => 'wpReason' ) ) .
390 '<td class="mw-submit">' .
391 Xml
::submitButton( wfMsg( 'revdelete-submit' ), array( 'name' => 'wpSubmit' ) ) .
394 Xml
::closeElement( 'table' ) .
395 Xml
::hidden( 'wpEditToken', $wgUser->editToken() ) .
396 Xml
::hidden( 'target', $this->targetObj
->getPrefixedText() ) .
397 Xml
::hidden( 'type', $this->typeName
) .
398 Xml
::hidden( 'ids', implode( ',', $this->ids
) ) .
399 Xml
::closeElement( 'fieldset' ) . "\n";
403 // Show link to edit the dropdown reasons
404 if( $wgUser->isAllowed( 'editinterface' ) ) {
405 $title = Title
::makeTitle( NS_MEDIAWIKI
, 'revdelete-reason-dropdown' );
406 $link = $wgUser->getSkin()->link(
408 wfMsgHtml( 'revdelete-edit-reasonlist' ),
410 array( 'action' => 'edit' )
412 $out .= Xml
::tags( 'p', array( 'class' => 'mw-revdel-editreasons' ), $link ) . "\n";
414 if( $this->mIsAllowed
) {
415 $out .= Xml
::closeElement( 'form' ) . "\n";
417 $wgOut->addHTML( $out );
421 * Show some introductory text
422 * FIXME Wikimedia-specific policy text
424 protected function addUsageText() {
425 global $wgOut, $wgUser;
426 $wgOut->addWikiMsg( 'revdelete-text' );
427 if( $wgUser->isAllowed( 'suppressrevision' ) ) {
428 $wgOut->addWikiMsg( 'revdelete-suppress-text' );
433 * @param $bitfields Interger: aggregate bitfield of all the bitfields
434 * @return String: HTML
436 protected function buildCheckBoxes( $bitfields ) {
438 // FIXME: all items checked for just one rev are checked, even if not set for the others
439 foreach( $this->checks
as $item ) {
440 list( $message, $name, $field ) = $item;
441 $innerHTML = Xml
::checkLabel( wfMsg($message), $name, $name, $bitfields & $field );
442 if( $field == Revision
::DELETED_RESTRICTED
)
443 $innerHTML = "<b>$innerHTML</b>";
444 $line = Xml
::tags( 'td', array( 'class' => 'mw-input' ), $innerHTML );
445 $html .= '<tr>' . $line . "</tr>\n";
452 * UI entry point for form submission.
453 * @param $request WebRequest
455 protected function submit( $request ) {
456 global $wgUser, $wgOut;
457 # Check edit token on submission
458 if( $this->submitClicked
&& !$wgUser->matchEditToken( $request->getVal('wpEditToken') ) ) {
459 $wgOut->addWikiMsg( 'sessionfailure' );
462 $bitfield = $this->extractBitfield( $request );
463 $listReason = $request->getText( 'wpRevDeleteReasonList', 'other' ); // from dropdown
464 $comment = $listReason;
465 if( $comment != 'other' && $this->otherReason
!= '' ) {
466 // Entry from drop down menu + additional comment
467 $comment .= wfMsgForContent( 'colon-separator' ) . $this->otherReason
;
468 } elseif( $comment == 'other' ) {
469 $comment = $this->otherReason
;
471 # Can the user set this field?
472 if( $bitfield & Revision
::DELETED_RESTRICTED
&& !$wgUser->isAllowed('suppressrevision') ) {
473 $wgOut->permissionRequired( 'suppressrevision' );
476 # If the save went through, go to success message...
477 $status = $this->save( $bitfield, $comment, $this->targetObj
);
478 if ( $status->isGood() ) {
481 # ...otherwise, bounce back to form...
483 $this->failure( $status );
489 * Report that the submit operation succeeded
491 protected function success() {
493 $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
494 $wgOut->wrapWikiMsg( '<span class="success">$1</span>', $this->typeInfo
['success'] );
495 $this->list->reloadFromMaster();
500 * Report that the submit operation failed
502 protected function failure( $status ) {
504 $wgOut->setPagetitle( wfMsg( 'actionfailed' ) );
505 $wgOut->addWikiText( $status->getWikiText( $this->typeInfo
['failure'] ) );
510 * Put together a rev_deleted bitfield from the submitted checkboxes
511 * @param $request WebRequest
514 protected function extractBitfield( $request ) {
516 foreach( $this->checks
as $item ) {
517 list( /* message */ , $name, $field ) = $item;
518 if( $request->getCheck( $name ) ) {
526 * Do the write operations. Simple wrapper for RevDel_*List::setVisibility().
528 protected function save( $bitfield, $reason, $title ) {
529 // Don't allow simply locking the interface for no reason
530 if( $bitfield == Revision
::DELETED_RESTRICTED
) {
531 return Status
::newFatal( 'revdelete-only-restricted' );
533 return $this->getList()->setVisibility( array(
534 'value' => $bitfield,
535 'comment' => $reason ) );
540 * Temporary b/c interface, collection of static functions.
541 * @ingroup SpecialPage
543 class RevisionDeleter
{
545 * Checks for a change in the bitfield for a certain option and updates the
546 * provided array accordingly.
548 * @param $desc String: description to add to the array if the option was
549 * enabled / disabled.
550 * @param $field Integer: the bitmask describing the single option.
551 * @param $diff Integer: the xor of the old and new bitfields.
552 * @param $new Integer: the new bitfield
553 * @param $arr Array: the array to update.
555 protected static function checkItem( $desc, $field, $diff, $new, &$arr ) {
556 if( $diff & $field ) {
557 $arr[ ( $new & $field ) ?
0 : 1 ][] = $desc;
562 * Gets an array describing the changes made to the visibilit of the revision.
563 * If the resulting array is $arr, then $arr[0] will contain an array of strings
564 * describing the items that were hidden, $arr[2] will contain an array of strings
565 * describing the items that were unhidden, and $arr[3] will contain an array with
566 * a single string, which can be one of "applied restrictions to sysops",
567 * "removed restrictions from sysops", or null.
569 * @param $n Integer: the new bitfield.
570 * @param $o Integer: the old bitfield.
571 * @return An array as described above.
573 protected static function getChanges( $n, $o ) {
575 $ret = array( 0 => array(), 1 => array(), 2 => array() );
576 // Build bitfield changes in language
577 self
::checkItem( wfMsgForContent( 'revdelete-content' ),
578 Revision
::DELETED_TEXT
, $diff, $n, $ret );
579 self
::checkItem( wfMsgForContent( 'revdelete-summary' ),
580 Revision
::DELETED_COMMENT
, $diff, $n, $ret );
581 self
::checkItem( wfMsgForContent( 'revdelete-uname' ),
582 Revision
::DELETED_USER
, $diff, $n, $ret );
583 // Restriction application to sysops
584 if( $diff & Revision
::DELETED_RESTRICTED
) {
585 if( $n & Revision
::DELETED_RESTRICTED
)
586 $ret[2][] = wfMsgForContent( 'revdelete-restricted' );
588 $ret[2][] = wfMsgForContent( 'revdelete-unrestricted' );
594 * Gets a log message to describe the given revision visibility change. This
595 * message will be of the form "[hid {content, edit summary, username}];
596 * [unhid {...}][applied restrictions to sysops] for $count revisions: $comment".
598 * @param $count Integer: The number of effected revisions.
599 * @param $nbitfield Integer: The new bitfield for the revision.
600 * @param $obitfield Integer: The old bitfield for the revision.
601 * @param $isForLog Boolean
603 public static function getLogMessage( $count, $nbitfield, $obitfield, $isForLog = false ) {
606 $changes = self
::getChanges( $nbitfield, $obitfield );
607 if( count( $changes[0] ) ) {
608 $s .= wfMsgForContent( 'revdelete-hid', implode( ', ', $changes[0] ) );
610 if( count( $changes[1] ) ) {
612 $s .= wfMsgForContent( 'revdelete-unhid', implode( ', ', $changes[1] ) );
614 if( count( $changes[2] ) ) {
615 $s .= $s ?
' (' . $changes[2][0] . ')' : $changes[2][0];
617 $msg = $isForLog ?
'logdelete-log-message' : 'revdelete-log-message';
618 return wfMsgExt( $msg, array( 'parsemag', 'content' ), $s, $wgLang->formatNum($count) );
622 // Get DB field name for URL param...
623 // Future code for other things may also track
624 // other types of revision-specific changes.
625 // @returns string One of log_id/rev_id/fa_id/ar_timestamp/oi_archive_name
626 public static function getRelationType( $typeName ) {
627 if ( isset( SpecialRevisionDelete
::$deprecatedTypeMap[$typeName] ) ) {
628 $typeName = SpecialRevisionDelete
::$deprecatedTypeMap[$typeName];
630 if ( isset( SpecialRevisionDelete
::$allowedTypes[$typeName] ) ) {
631 $class = SpecialRevisionDelete
::$allowedTypes[$typeName]['list-class'];
632 $list = new $class( null, null, null );
633 return $list->getIdField();
641 * Abstract base class for a list of deletable items
643 abstract class RevDel_List
{
644 var $special, $title, $ids, $res, $current;
645 var $type = null; // override this
646 var $idField = null; // override this
647 var $dateField = false; // override this
648 var $authorIdField = false; // override this
649 var $authorNameField = false; // override this
652 * @param $special The parent SpecialPage
653 * @param $title The target title
654 * @param $ids Array of IDs
656 public function __construct( $special, $title, $ids ) {
657 $this->special
= $special;
658 $this->title
= $title;
663 * Get the internal type name of this list. Equal to the table name.
665 public function getType() {
670 * Get the DB field name associated with the ID list
672 public function getIdField() {
673 return $this->idField
;
677 * Get the DB field name storing timestamps
679 public function getTimestampField() {
680 return $this->dateField
;
684 * Get the DB field name storing user ids
686 public function getAuthorIdField() {
687 return $this->authorIdField
;
691 * Get the DB field name storing user names
693 public function getAuthorNameField() {
694 return $this->authorNameField
;
697 * Set the visibility for the revisions in this list. Logging and
698 * transactions are done here.
700 * @param $params Associative array of parameters. Members are:
701 * value: The integer value to set the visibility to
702 * comment: The log comment.
705 public function setVisibility( $params ) {
706 $newBits = $params['value'];
707 $comment = $params['comment'];
710 $dbw = wfGetDB( DB_MASTER
);
711 $this->doQuery( $dbw );
713 $status = Status
::newGood();
714 $missing = array_flip( $this->ids
);
715 $this->clearFileOps();
716 $idsForLog = array();
717 $authorIds = $authorIPs = array();
719 for ( $this->reset(); $this->current(); $this->next() ) {
720 $item = $this->current();
721 unset( $missing[ $item->getId() ] );
723 // Make error messages less vague
724 $oldBits = $item->getBits();
725 if ( $oldBits == $newBits ) {
726 $status->warning( 'revdelete-no-change', $item->formatDate(), $item->formatTime() );
727 $status->failCount++
;
729 } elseif ( $oldBits == 0 && $newBits != 0 ) {
731 } elseif ( $oldBits != 0 && $newBits == 0 ) {
737 if ( $item->isHideCurrentOp( $newBits ) ) {
738 // Cannot hide current version text
739 $status->error( 'revdelete-hide-current', $item->formatDate(), $item->formatTime() );
740 $status->failCount++
;
743 if ( !$item->canView() ) {
744 // Cannot access this revision
745 $msg = $opType == 'show' ?
'revdelete-show-no-access' : 'revdelete-modify-no-access';
746 $status->error( $msg, $item->formatDate(), $item->formatTime() );
747 $status->failCount++
;
751 // Update the revision
752 $ok = $item->setBits( $newBits );
755 $idsForLog[] = $item->getId();
756 $status->successCount++
;
757 if( $item->getAuthorId() > 0 ) {
758 $authorIds[] = $item->getAuthorId();
759 } else if( IP
::isIPAddress( $item->getAuthorName() ) ) {
760 $authorIPs[] = $item->getAuthorName();
763 $status->error( 'revdelete-concurrent-change', $item->formatDate(), $item->formatTime() );
764 $status->failCount++
;
768 // Handle missing revisions
769 foreach ( $missing as $id => $unused ) {
770 $status->error( 'revdelete-modify-missing', $id );
771 $status->failCount++
;
774 if ( $status->successCount
== 0 ) {
780 // Save success count
781 $successCount = $status->successCount
;
783 // Move files, if there are any
784 $status->merge( $this->doPreCommitUpdates() );
785 if ( !$status->isOK() ) {
786 // Fatal error, such as no configured archive directory
792 $this->updateLog( array(
793 'title' => $this->title
,
794 'count' => $successCount,
795 'newBits' => $newBits,
796 'oldBits' => $oldBits,
797 'comment' => $comment,
799 'authorIds' => $authorIds,
800 'authorIPs' => $authorIPs
805 $status->merge( $this->doPostCommitUpdates() );
810 * Reload the list data from the master DB. This can be done after setVisibility()
811 * to allow $item->getHTML() to show the new data.
813 function reloadFromMaster() {
814 $dbw = wfGetDB( DB_MASTER
);
815 $this->res
= $this->doQuery( $dbw );
819 * Record a log entry on the action
820 * @param $params Associative array of parameters:
821 * newBits: The new value of the *_deleted bitfield
822 * oldBits: The old value of the *_deleted bitfield.
823 * title: The target title
825 * comment: The log comment
826 * authorsIds: The array of the user IDs of the offenders
827 * authorsIPs: The array of the IP/anon user offenders
829 protected function updateLog( $params ) {
830 // Get the URL param's corresponding DB field
831 $field = RevisionDeleter
::getRelationType( $this->getType() );
833 throw new MWException( "Bad log URL param type!" );
835 // Put things hidden from sysops in the oversight log
836 if ( ( $params['newBits'] |
$params['oldBits'] ) & $this->getSuppressBit() ) {
837 $logType = 'suppress';
841 // Add params for effected page and ids
842 $logParams = $this->getLogParams( $params );
843 // Actually add the deletion log entry
844 $log = new LogPage( $logType );
845 $logid = $log->addEntry( $this->getLogAction(), $params['title'],
846 $params['comment'], $logParams );
847 // Allow for easy searching of deletion log items for revision/log items
848 $log->addRelations( $field, $params['ids'], $logid );
849 $log->addRelations( 'target_author_id', $params['authorIds'], $logid );
850 $log->addRelations( 'target_author_ip', $params['authorIPs'], $logid );
854 * Get the log action for this list type
856 public function getLogAction() {
861 * Get log parameter array.
862 * @param $params Associative array of log parameters, same as updateLog()
865 public function getLogParams( $params ) {
868 implode( ',', $params['ids'] ),
869 "ofield={$params['oldBits']}",
870 "nfield={$params['newBits']}"
875 * Initialise the current iteration pointer
877 protected function initCurrent() {
878 $row = $this->res
->current();
880 $this->current
= $this->newItem( $row );
882 $this->current
= false;
887 * Start iteration. This must be called before current() or next().
888 * @return First list item
890 public function reset() {
892 $this->res
= $this->doQuery( wfGetDB( DB_SLAVE
) );
894 $this->res
->rewind();
896 $this->initCurrent();
897 return $this->current
;
901 * Get the current list item, or false if we are at the end
903 public function current() {
904 return $this->current
;
908 * Move the iteration pointer to the next list item, and return it.
910 public function next() {
912 $this->initCurrent();
913 return $this->current
;
917 * Clear any data structures needed for doPreCommitUpdates() and doPostCommitUpdates()
920 public function clearFileOps() {
924 * A hook for setVisibility(): do batch updates pre-commit.
928 public function doPreCommitUpdates() {
929 return Status
::newGood();
933 * A hook for setVisibility(): do any necessary updates post-commit.
937 public function doPostCommitUpdates() {
938 return Status
::newGood();
942 * Create an item object from a DB result row
943 * @param $row stdclass
945 abstract public function newItem( $row );
948 * Do the DB query to iterate through the objects.
949 * @param $db Database object to use for the query
951 abstract public function doQuery( $db );
954 * Get the integer value of the flag used for suppression
956 abstract public function getSuppressBit();
960 * Abstract base class for deletable items
962 abstract class RevDel_Item
{
963 /** The parent SpecialPage */
966 /** The parent RevDel_List */
969 /** The DB result row */
973 * @param $list RevDel_List
974 * @param $row DB result row
976 public function __construct( $list, $row ) {
977 $this->special
= $list->special
;
983 * Get the ID, as it would appear in the ids URL parameter
985 public function getId() {
986 $field = $this->list->getIdField();
987 return $this->row
->$field;
991 * Get the date, formatted with $wgLang
993 public function formatDate() {
995 return $wgLang->date( $this->getTimestamp() );
999 * Get the time, formatted with $wgLang
1001 public function formatTime() {
1003 return $wgLang->time( $this->getTimestamp() );
1007 * Get the timestamp in MW 14-char form
1009 public function getTimestamp() {
1010 $field = $this->list->getTimestampField();
1011 return wfTimestamp( TS_MW
, $this->row
->$field );
1015 * Get the author user ID
1017 public function getAuthorId() {
1018 $field = $this->list->getAuthorIdField();
1019 return intval( $this->row
->$field );
1023 * Get the author user name
1025 public function getAuthorName() {
1026 $field = $this->list->getAuthorNameField();
1027 return strval( $this->row
->$field );
1031 * Returns true if the item is "current", and the operation to set the given
1032 * bits can't be executed for that reason
1035 public function isHideCurrentOp( $newBits ) {
1040 * Returns true if the current user can view the item
1042 abstract public function canView();
1045 * Get the current deletion bitfield value
1047 abstract public function getBits();
1050 * Get the HTML of the list item. Should be include <li></li> tags.
1051 * This is used to show the list in HTML form, by the special page.
1053 abstract public function getHTML();
1056 * Set the visibility of the item. This should do any necessary DB queries.
1058 * The DB update query should have a condition which forces it to only update
1059 * if the value in the DB matches the value fetched earlier with the SELECT.
1060 * If the update fails because it did not match, the function should return
1061 * false. This prevents concurrency problems.
1063 * @return boolean success
1065 abstract public function setBits( $newBits );
1069 * List for revision table items
1071 class RevDel_RevisionList
extends RevDel_List
{
1073 var $type = 'revision';
1074 var $idField = 'rev_id';
1075 var $dateField = 'rev_timestamp';
1076 var $authorIdField = 'rev_user';
1077 var $authorNameField = 'rev_user_text';
1079 public function doQuery( $db ) {
1080 $ids = array_map( 'intval', $this->ids
);
1081 return $db->select( array('revision','page'), '*',
1083 'rev_page' => $this->title
->getArticleID(),
1085 'rev_page = page_id'
1091 public function newItem( $row ) {
1092 return new RevDel_RevisionItem( $this, $row );
1095 public function getCurrent() {
1096 if ( is_null( $this->currentRevId
) ) {
1097 $dbw = wfGetDB( DB_MASTER
);
1098 $this->currentRevId
= $dbw->selectField(
1099 'page', 'page_latest', $this->title
->pageCond(), __METHOD__
);
1101 return $this->currentRevId
;
1104 public function getSuppressBit() {
1105 return Revision
::DELETED_RESTRICTED
;
1108 public function doPreCommitUpdates() {
1109 $this->title
->invalidateCache();
1110 return Status
::newGood();
1113 public function doPostCommitUpdates() {
1114 $this->title
->purgeSquid();
1115 // Extensions that require referencing previous revisions may need this
1116 wfRunHooks( 'ArticleRevisionVisiblitySet', array( &$this->title
) );
1117 return Status
::newGood();
1122 * Item class for a revision table row
1124 class RevDel_RevisionItem
extends RevDel_Item
{
1127 public function __construct( $list, $row ) {
1128 parent
::__construct( $list, $row );
1129 $this->revision
= new Revision( $row );
1132 public function canView() {
1133 return $this->revision
->userCan( Revision
::DELETED_RESTRICTED
);
1136 public function getBits() {
1137 return $this->revision
->mDeleted
;
1140 public function setBits( $bits ) {
1141 $dbw = wfGetDB( DB_MASTER
);
1142 // Update revision table
1143 $dbw->update( 'revision',
1144 array( 'rev_deleted' => $bits ),
1146 'rev_id' => $this->revision
->getId(),
1147 'rev_page' => $this->revision
->getPage(),
1148 'rev_deleted' => $this->getBits()
1152 if ( !$dbw->affectedRows() ) {
1156 // Update recentchanges table
1157 $dbw->update( 'recentchanges',
1159 'rc_deleted' => $bits,
1163 'rc_this_oldid' => $this->revision
->getId(), // condition
1164 // non-unique timestamp index
1165 'rc_timestamp' => $dbw->timestamp( $this->revision
->getTimestamp() ),
1172 public function isDeleted() {
1173 return $this->revision
->isDeleted( Revision
::DELETED_TEXT
);
1176 public function isHideCurrentOp( $newBits ) {
1177 return ( $newBits & Revision
::DELETED_TEXT
)
1178 && $this->list->getCurrent() == $this->getId();
1182 * Get the HTML link to the revision text.
1183 * Overridden by RevDel_ArchiveItem.
1185 protected function getRevisionLink() {
1187 $date = $wgLang->timeanddate( $this->revision
->getTimestamp(), true );
1188 if ( $this->isDeleted() && !$this->canView() ) {
1191 return $this->special
->skin
->link(
1196 'oldid' => $this->revision
->getId(),
1203 * Get the HTML link to the diff.
1204 * Overridden by RevDel_ArchiveItem
1206 protected function getDiffLink() {
1207 if ( $this->isDeleted() && !$this->canView() ) {
1208 return wfMsgHtml('diff');
1211 $this->special
->skin
->link(
1216 'diff' => $this->revision
->getId(),
1228 public function getHTML() {
1229 $difflink = $this->getDiffLink();
1230 $revlink = $this->getRevisionLink();
1231 $userlink = $this->special
->skin
->revUserLink( $this->revision
);
1232 $comment = $this->special
->skin
->revComment( $this->revision
);
1233 if ( $this->isDeleted() ) {
1234 $revlink = "<span class=\"history-deleted\">$revlink</span>";
1236 return "<li>($difflink) $revlink $userlink $comment</li>";
1241 * List for archive table items, i.e. revisions deleted via action=delete
1243 class RevDel_ArchiveList
extends RevDel_RevisionList
{
1244 var $type = 'archive';
1245 var $idField = 'ar_timestamp';
1246 var $dateField = 'ar_timestamp';
1247 var $authorIdField = 'ar_user';
1248 var $authorNameField = 'ar_user_text';
1250 public function doQuery( $db ) {
1251 $timestamps = array();
1252 foreach ( $this->ids
as $id ) {
1253 $timestamps[] = $db->timestamp( $id );
1255 return $db->select( 'archive', '*',
1257 'ar_namespace' => $this->title
->getNamespace(),
1258 'ar_title' => $this->title
->getDBkey(),
1259 'ar_timestamp' => $timestamps
1265 public function newItem( $row ) {
1266 return new RevDel_ArchiveItem( $this, $row );
1269 public function doPreCommitUpdates() {
1270 return Status
::newGood();
1273 public function doPostCommitUpdates() {
1274 return Status
::newGood();
1279 * Item class for a archive table row
1281 class RevDel_ArchiveItem
extends RevDel_RevisionItem
{
1282 public function __construct( $list, $row ) {
1283 RevDel_Item
::__construct( $list, $row );
1284 $this->revision
= Revision
::newFromArchiveRow( $row,
1285 array( 'page' => $this->list->title
->getArticleId() ) );
1288 public function getId() {
1289 # Convert DB timestamp to MW timestamp
1290 return $this->revision
->getTimestamp();
1293 public function setBits( $bits ) {
1294 $dbw = wfGetDB( DB_MASTER
);
1295 $dbw->update( 'archive',
1296 array( 'ar_deleted' => $bits ),
1297 array( 'ar_namespace' => $this->list->title
->getNamespace(),
1298 'ar_title' => $this->list->title
->getDBkey(),
1299 // use timestamp for index
1300 'ar_timestamp' => $this->row
->ar_timestamp
,
1301 'ar_rev_id' => $this->row
->ar_rev_id
,
1302 'ar_deleted' => $this->getBits()
1305 return (bool)$dbw->affectedRows();
1308 protected function getRevisionLink() {
1310 $undelete = SpecialPage
::getTitleFor( 'Undelete' );
1311 $date = $wgLang->timeanddate( $this->revision
->getTimestamp(), true );
1312 if ( $this->isDeleted() && !$this->canView() ) {
1315 return $this->special
->skin
->link( $undelete, $date, array(),
1317 'target' => $this->list->title
->getPrefixedText(),
1318 'timestamp' => $this->revision
->getTimestamp()
1322 protected function getDiffLink() {
1323 if ( $this->isDeleted() && !$this->canView() ) {
1324 return wfMsgHtml( 'diff' );
1326 $undelete = SpecialPage
::getTitleFor( 'Undelete' );
1327 return $this->special
->skin
->link( $undelete, wfMsgHtml('diff'), array(),
1329 'target' => $this->list->title
->getPrefixedText(),
1331 'timestamp' => $this->revision
->getTimestamp()
1337 * List for oldimage table items
1339 class RevDel_FileList
extends RevDel_List
{
1340 var $type = 'oldimage';
1341 var $idField = 'oi_archive_name';
1342 var $dateField = 'oi_timestamp';
1343 var $authorIdField = 'oi_user';
1344 var $authorNameField = 'oi_user_text';
1345 var $storeBatch, $deleteBatch, $cleanupBatch;
1347 public function doQuery( $db ) {
1348 $archiveName = array();
1349 foreach( $this->ids
as $timestamp ) {
1350 $archiveNames[] = $timestamp . '!' . $this->title
->getDBkey();
1352 return $db->select( 'oldimage', '*',
1354 'oi_name' => $this->title
->getDBkey(),
1355 'oi_archive_name' => $archiveNames
1361 public function newItem( $row ) {
1362 return new RevDel_FileItem( $this, $row );
1365 public function clearFileOps() {
1366 $this->deleteBatch
= array();
1367 $this->storeBatch
= array();
1368 $this->cleanupBatch
= array();
1371 public function doPreCommitUpdates() {
1372 $status = Status
::newGood();
1373 $repo = RepoGroup
::singleton()->getLocalRepo();
1374 if ( $this->storeBatch
) {
1375 $status->merge( $repo->storeBatch( $this->storeBatch
, FileRepo
::OVERWRITE_SAME
) );
1377 if ( !$status->isOK() ) {
1380 if ( $this->deleteBatch
) {
1381 $status->merge( $repo->deleteBatch( $this->deleteBatch
) );
1383 if ( !$status->isOK() ) {
1384 // Running cleanupDeletedBatch() after a failed storeBatch() with the DB already
1385 // modified (but destined for rollback) causes data loss
1388 if ( $this->cleanupBatch
) {
1389 $status->merge( $repo->cleanupDeletedBatch( $this->cleanupBatch
) );
1394 public function doPostCommitUpdates() {
1395 $file = wfLocalFile( $this->title
);
1396 $file->purgeCache();
1397 $file->purgeDescription();
1398 return Status
::newGood();
1401 public function getSuppressBit() {
1402 return File
::DELETED_RESTRICTED
;
1407 * Item class for an oldimage table row
1409 class RevDel_FileItem
extends RevDel_Item
{
1412 public function __construct( $list, $row ) {
1413 parent
::__construct( $list, $row );
1414 $this->file
= RepoGroup
::singleton()->getLocalRepo()->newFileFromRow( $row );
1417 public function getId() {
1418 $parts = explode( '!', $this->row
->oi_archive_name
);
1422 public function canView() {
1423 return $this->file
->userCan( File
::DELETED_RESTRICTED
);
1426 public function getBits() {
1427 return $this->file
->getVisibility();
1430 public function setBits( $bits ) {
1432 # FIXME: move to LocalFile.php
1433 if ( $this->isDeleted() ) {
1434 if ( $bits & File
::DELETED_FILE
) {
1438 $key = $this->file
->getStorageKey();
1439 $srcRel = $this->file
->repo
->getDeletedHashPath( $key ) . $key;
1440 $this->list->storeBatch
[] = array(
1441 $this->file
->repo
->getVirtualUrl( 'deleted' ) . '/' . $srcRel,
1443 $this->file
->getRel()
1445 $this->list->cleanupBatch
[] = $key;
1447 } elseif ( $bits & File
::DELETED_FILE
) {
1449 $key = $this->file
->getStorageKey();
1450 $dstRel = $this->file
->repo
->getDeletedHashPath( $key ) . $key;
1451 $this->list->deleteBatch
[] = array( $this->file
->getRel(), $dstRel );
1454 # Do the database operations
1455 $dbw = wfGetDB( DB_MASTER
);
1456 $dbw->update( 'oldimage',
1457 array( 'oi_deleted' => $bits ),
1459 'oi_name' => $this->row
->oi_name
,
1460 'oi_timestamp' => $this->row
->oi_timestamp
,
1461 'oi_deleted' => $this->getBits()
1465 return (bool)$dbw->affectedRows();
1468 public function isDeleted() {
1469 return $this->file
->isDeleted( File
::DELETED_FILE
);
1473 * Get the link to the file.
1474 * Overridden by RevDel_ArchivedFileItem.
1476 protected function getLink() {
1478 $date = $wgLang->timeanddate( $this->file
->getTimestamp(), true );
1479 if ( $this->isDeleted() ) {
1481 if ( !$this->canView() ) {
1484 $link = $this->special
->skin
->link(
1485 $this->special
->getTitle(),
1488 'target' => $this->list->title
->getPrefixedText(),
1489 'file' => $this->file
->sha1
. '.' . $this->file
->getExtension()
1493 return '<span class="history-deleted">' . $link . '</span>';
1496 $url = $this->file
->getUrl();
1497 return Xml
::element( 'a', array( 'href' => $this->file
->getUrl() ), $date );
1501 * Generate a user tool link cluster if the current user is allowed to view it
1502 * @return string HTML
1504 protected function getUserTools() {
1505 if( $this->file
->userCan( Revision
::DELETED_USER
) ) {
1506 $link = $this->special
->skin
->userLink( $this->file
->user
, $this->file
->user_text
) .
1507 $this->special
->skin
->userToolLinks( $this->file
->user
, $this->file
->user_text
);
1509 $link = wfMsgHtml( 'rev-deleted-user' );
1511 if( $this->file
->isDeleted( Revision
::DELETED_USER
) ) {
1512 return '<span class="history-deleted">' . $link . '</span>';
1518 * Wrap and format the file's comment block, if the current
1519 * user is allowed to view it.
1521 * @return string HTML
1523 protected function getComment() {
1524 if( $this->file
->userCan( File
::DELETED_COMMENT
) ) {
1525 $block = $this->special
->skin
->commentBlock( $this->file
->description
);
1527 $block = ' ' . wfMsgHtml( 'rev-deleted-comment' );
1529 if( $this->file
->isDeleted( File
::DELETED_COMMENT
) ) {
1530 return "<span class=\"history-deleted\">$block</span>";
1535 public function getHTML() {
1540 $wgLang->formatNum( $this->file
->getWidth() ),
1541 $wgLang->formatNum( $this->file
->getHeight() )
1544 wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $this->file
->getSize() ) ) .
1546 $pageLink = $this->getLink();
1548 return '<li>' . $this->getLink() . ' ' . $this->getUserTools() . ' ' .
1549 $data . ' ' . $this->getComment(). '</li>';
1554 * List for filearchive table items
1556 class RevDel_ArchivedFileList
extends RevDel_FileList
{
1557 var $type = 'filearchive';
1558 var $idField = 'fa_id';
1559 var $dateField = 'fa_timestamp';
1560 var $authorIdField = 'fa_user';
1561 var $authorNameField = 'fa_user_text';
1563 public function doQuery( $db ) {
1564 $ids = array_map( 'intval', $this->ids
);
1565 return $db->select( 'filearchive', '*',
1567 'fa_name' => $this->title
->getDBkey(),
1574 public function newItem( $row ) {
1575 return new RevDel_ArchivedFileItem( $this, $row );
1580 * Item class for a filearchive table row
1582 class RevDel_ArchivedFileItem
extends RevDel_FileItem
{
1583 public function __construct( $list, $row ) {
1584 RevDel_Item
::__construct( $list, $row );
1585 $this->file
= ArchivedFile
::newFromRow( $row );
1588 public function getId() {
1589 return $this->row
->fa_id
;
1592 public function setBits( $bits ) {
1593 $dbw = wfGetDB( DB_MASTER
);
1594 $dbw->update( 'filearchive',
1595 array( 'fa_deleted' => $bits ),
1597 'fa_id' => $this->row
->fa_id
,
1598 'fa_deleted' => $this->getBits(),
1602 return (bool)$dbw->affectedRows();
1605 protected function getLink() {
1606 global $wgLang, $wgUser;
1607 $date = $wgLang->timeanddate( $this->file
->getTimestamp(), true );
1608 $undelete = SpecialPage
::getTitleFor( 'Undelete' );
1609 $key = $this->file
->getKey();
1610 return $this->special
->skin
->link( $undelete, $date, array(),
1612 'target' => $this->list->title
->getPrefixedText(),
1614 'token' => $wgUser->editToken( $key )
1621 * List for logging table items
1623 class RevDel_LogList
extends RevDel_List
{
1624 var $type = 'logging';
1625 var $idField = 'log_id';
1626 var $dateField = 'log_timestamp';
1627 var $authorIdField = 'log_user';
1628 var $authorNameField = 'log_user_text';
1630 public function doQuery( $db ) {
1631 global $wgMessageCache;
1632 $wgMessageCache->loadAllMessages();
1633 $ids = array_map( 'intval', $this->ids
);
1634 return $db->select( 'logging', '*',
1635 array( 'log_id' => $ids ),
1640 public function newItem( $row ) {
1641 return new RevDel_LogItem( $this, $row );
1644 public function getSuppressBit() {
1645 return Revision
::DELETED_RESTRICTED
;
1648 public function getLogAction() {
1652 public function getLogParams( $params ) {
1654 implode( ',', $params['ids'] ),
1655 "ofield={$params['oldBits']}",
1656 "nfield={$params['newBits']}"
1662 * Item class for a logging table row
1664 class RevDel_LogItem
extends RevDel_Item
{
1665 public function canView() {
1666 return LogEventsList
::userCan( $this->row
, Revision
::DELETED_RESTRICTED
);
1669 public function getBits() {
1670 return $this->row
->log_deleted
;
1673 public function setBits( $bits ) {
1674 $dbw = wfGetDB( DB_MASTER
);
1675 $dbw->update( 'recentchanges',
1677 'rc_deleted' => $bits,
1681 'rc_logid' => $this->row
->log_id
,
1682 'rc_timestamp' => $this->row
->log_timestamp
// index
1686 $dbw->update( 'logging',
1687 array( 'log_deleted' => $bits ),
1689 'log_id' => $this->row
->log_id
,
1690 'log_deleted' => $this->getBits()
1694 return (bool)$dbw->affectedRows();
1697 public function getHTML() {
1700 $date = htmlspecialchars( $wgLang->timeanddate( $this->row
->log_timestamp
) );
1701 $paramArray = LogPage
::extractParams( $this->row
->log_params
);
1702 $title = Title
::makeTitle( $this->row
->log_namespace
, $this->row
->log_title
);
1704 // Log link for this page
1705 $loglink = $this->special
->skin
->link(
1706 SpecialPage
::getTitleFor( 'Log' ),
1709 array( 'page' => $title->getPrefixedText() )
1712 if( !$this->canView() ) {
1713 $action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
1715 $action = LogPage
::actionText( $this->row
->log_type
, $this->row
->log_action
, $title,
1716 $this->special
->skin
, $paramArray, true, true );
1717 if( $this->row
->log_deleted
& LogPage
::DELETED_ACTION
)
1718 $action = '<span class="history-deleted">' . $action . '</span>';
1721 $userLink = $this->special
->skin
->userLink( $this->row
->log_user
,
1722 User
::WhoIs( $this->row
->log_user
) );
1723 if( LogEventsList
::isDeleted($this->row
,LogPage
::DELETED_USER
) ) {
1724 $userLink = '<span class="history-deleted">' . $userLink . '</span>';
1727 $comment = $wgLang->getDirMark() . $this->special
->skin
->commentBlock( $this->row
->log_comment
);
1728 if( LogEventsList
::isDeleted($this->row
,LogPage
::DELETED_COMMENT
) ) {
1729 $comment = '<span class="history-deleted">' . $comment . '</span>';
1731 return "<li>($loglink) $date $userLink $action $comment</li>";