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', 'deletedhistory' );
96 public function execute( $par ) {
97 global $wgOut, $wgUser, $wgRequest;
98 if( !$wgUser->isAllowed( 'deletedhistory' ) ) {
99 $wgOut->permissionRequired( 'deletedhistory' );
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' ) == 'historysubmit' ) {
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 if( $oimage->isDeleted( File
::DELETED_RESTRICTED
) ) {
265 $wgOut->permissionRequired( 'suppressrevision' );
267 $wgOut->permissionRequired( 'deletedtext' );
271 if ( !$wgUser->matchEditToken( $this->token
, $archiveName ) ) {
272 $wgOut->addWikiMsg( 'revdelete-show-file-confirm',
273 $this->targetObj
->getText(),
274 $wgLang->date( $oimage->getTimestamp() ),
275 $wgLang->time( $oimage->getTimestamp() ) );
277 Xml
::openElement( 'form', array(
279 'action' => $this->getTitle()->getLocalUrl(
280 'target=' . urlencode( $oimage->getName() ) .
281 '&file=' . urlencode( $archiveName ) .
282 '&token=' . urlencode( $wgUser->editToken( $archiveName ) ) )
285 Xml
::submitButton( wfMsg( 'revdelete-show-file-submit' ) ) .
291 # We mustn't allow the output to be Squid cached, otherwise
292 # if an admin previews a deleted image, and it's cached, then
293 # a user without appropriate permissions can toddle off and
294 # nab the image, and Squid will serve it
295 $wgRequest->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
296 $wgRequest->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
297 $wgRequest->response()->header( 'Pragma: no-cache' );
299 # Stream the file to the client
301 require_once( "$IP/includes/StreamFile.php" );
302 $key = $oimage->getStorageKey();
303 $path = $repo->getZonePath( 'deleted' ) . '/' . $repo->getDeletedHashPath( $key ) . $key;
304 wfStreamFile( $path );
308 * Get the list object for this request
310 protected function getList() {
311 if ( is_null( $this->list ) ) {
312 $class = $this->typeInfo
['list-class'];
313 $this->list = new $class( $this, $this->targetObj
, $this->ids
);
319 * Show a list of items that we will operate on, and show a form with checkboxes
320 * which will allow the user to choose new visibility settings.
322 protected function showForm() {
323 global $wgOut, $wgUser, $wgLang;
326 if ( $this->typeName
== 'logging' ) {
327 $wgOut->addWikiMsg( 'logdelete-selected', $wgLang->formatNum( count($this->ids
) ) );
329 $wgOut->addWikiMsg( 'revdelete-selected',
330 $this->targetObj
->getPrefixedText(), count( $this->ids
) );
334 $wgOut->addHTML( "<ul>" );
336 $where = $revObjs = array();
340 $list = $this->getList();
341 for ( $list->reset(); $list->current(); $list->next() ) {
342 $item = $list->current();
343 if ( !$item->canView() ) {
344 if( !$this->submitClicked
) {
345 $wgOut->permissionRequired( 'suppressrevision' );
348 $UserAllowed = false;
351 $bitfields |
= $item->getBits();
352 $wgOut->addHTML( $item->getHTML() );
355 if( !$numRevisions ) {
356 $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
360 $wgOut->addHTML( "</ul>" );
362 $this->addUsageText();
364 // Normal sysops can always see what they did, but can't always change it
365 if( !$UserAllowed ) return;
367 // Show form if the user can submit
368 if( $this->mIsAllowed
) {
369 $out = Xml
::openElement( 'form', array( 'method' => 'post',
370 'action' => $this->getTitle()->getLocalUrl( array( 'action' => 'submit' ) ),
371 'id' => 'mw-revdel-form-revisions' ) ) .
372 Xml
::fieldset( wfMsg( 'revdelete-legend' ) ) .
373 $this->buildCheckBoxes( $bitfields ) .
374 Xml
::openElement( 'table' ) .
376 '<td class="mw-label">' .
377 Xml
::label( wfMsg( 'revdelete-log' ), 'wpRevDeleteReasonList' ) .
379 '<td class="mw-input">' .
380 Xml
::listDropDown( 'wpRevDeleteReasonList',
381 wfMsgForContent( 'revdelete-reason-dropdown' ),
382 wfMsgForContent( 'revdelete-reasonotherlist' ), '', 'wpReasonDropDown', 1
386 '<td class="mw-label">' .
387 Xml
::label( wfMsg( 'revdelete-otherreason' ), 'wpReason' ) .
389 '<td class="mw-input">' .
390 Xml
::input( 'wpReason', 60, $this->otherReason
, array( 'id' => 'wpReason' ) ) .
394 '<td class="mw-submit">' .
395 Xml
::submitButton( wfMsg( 'revdelete-submit' ), array( 'name' => 'wpSubmit' ) ) .
398 Xml
::closeElement( 'table' ) .
399 Xml
::hidden( 'wpEditToken', $wgUser->editToken() ) .
400 Xml
::hidden( 'target', $this->targetObj
->getPrefixedText() ) .
401 Xml
::hidden( 'type', $this->typeName
) .
402 Xml
::hidden( 'ids', implode( ',', $this->ids
) ) .
403 Xml
::closeElement( 'fieldset' ) . "\n";
407 // Show link to edit the dropdown reasons
408 if( $wgUser->isAllowed( 'editinterface' ) ) {
409 $title = Title
::makeTitle( NS_MEDIAWIKI
, 'revdelete-reason-dropdown' );
410 $link = $wgUser->getSkin()->link(
412 wfMsgHtml( 'revdelete-edit-reasonlist' ),
414 array( 'action' => 'edit' )
416 $out .= Xml
::tags( 'p', array( 'class' => 'mw-revdel-editreasons' ), $link ) . "\n";
418 if( $this->mIsAllowed
) {
419 $out .= Xml
::closeElement( 'form' ) . "\n";
421 $wgOut->addHTML( $out );
425 * Show some introductory text
426 * FIXME Wikimedia-specific policy text
428 protected function addUsageText() {
429 global $wgOut, $wgUser;
430 $wgOut->addWikiMsg( 'revdelete-text' );
431 if( $wgUser->isAllowed( 'suppressrevision' ) ) {
432 $wgOut->addWikiMsg( 'revdelete-suppress-text' );
437 * @param $bitfields Interger: aggregate bitfield of all the bitfields
438 * @return String: HTML
440 protected function buildCheckBoxes( $bitfields ) {
442 // FIXME: all items checked for just one rev are checked, even if not set for the others
443 foreach( $this->checks
as $item ) {
444 list( $message, $name, $field ) = $item;
445 $innerHTML = Xml
::checkLabel( wfMsg($message), $name, $name, $bitfields & $field );
446 if( $field == Revision
::DELETED_RESTRICTED
)
447 $innerHTML = "<b>$innerHTML</b>";
448 $line = Xml
::tags( 'td', array( 'class' => 'mw-input' ), $innerHTML );
449 $html .= '<tr>' . $line . "</tr>\n";
456 * UI entry point for form submission.
457 * @param $request WebRequest
459 protected function submit( $request ) {
460 global $wgUser, $wgOut;
461 # Check edit token on submission
462 if( $this->submitClicked
&& !$wgUser->matchEditToken( $request->getVal('wpEditToken') ) ) {
463 $wgOut->addWikiMsg( 'sessionfailure' );
466 $bitfield = $this->extractBitfield( $request );
467 $listReason = $request->getText( 'wpRevDeleteReasonList', 'other' ); // from dropdown
468 $comment = $listReason;
469 if( $comment != 'other' && $this->otherReason
!= '' ) {
470 // Entry from drop down menu + additional comment
471 $comment .= wfMsgForContent( 'colon-separator' ) . $this->otherReason
;
472 } elseif( $comment == 'other' ) {
473 $comment = $this->otherReason
;
475 # Can the user set this field?
476 if( $bitfield & Revision
::DELETED_RESTRICTED
&& !$wgUser->isAllowed('suppressrevision') ) {
477 $wgOut->permissionRequired( 'suppressrevision' );
480 # If the save went through, go to success message...
481 $status = $this->save( $bitfield, $comment, $this->targetObj
);
482 if ( $status->isGood() ) {
485 # ...otherwise, bounce back to form...
487 $this->failure( $status );
493 * Report that the submit operation succeeded
495 protected function success() {
497 $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
498 $wgOut->wrapWikiMsg( '<span class="success">$1</span>', $this->typeInfo
['success'] );
499 $this->list->reloadFromMaster();
504 * Report that the submit operation failed
506 protected function failure( $status ) {
508 $wgOut->setPagetitle( wfMsg( 'actionfailed' ) );
509 $wgOut->addWikiText( $status->getWikiText( $this->typeInfo
['failure'] ) );
514 * Put together a rev_deleted bitfield from the submitted checkboxes
515 * @param $request WebRequest
518 protected function extractBitfield( $request ) {
520 foreach( $this->checks
as $item ) {
521 list( /* message */ , $name, $field ) = $item;
522 if( $request->getCheck( $name ) ) {
530 * Do the write operations. Simple wrapper for RevDel_*List::setVisibility().
532 protected function save( $bitfield, $reason, $title ) {
533 // Don't allow simply locking the interface for no reason
534 if( $bitfield == Revision
::DELETED_RESTRICTED
) {
535 return Status
::newFatal( 'revdelete-only-restricted' );
537 return $this->getList()->setVisibility( array(
538 'value' => $bitfield,
539 'comment' => $reason ) );
544 * Temporary b/c interface, collection of static functions.
545 * @ingroup SpecialPage
547 class RevisionDeleter
{
549 * Checks for a change in the bitfield for a certain option and updates the
550 * provided array accordingly.
552 * @param $desc String: description to add to the array if the option was
553 * enabled / disabled.
554 * @param $field Integer: the bitmask describing the single option.
555 * @param $diff Integer: the xor of the old and new bitfields.
556 * @param $new Integer: the new bitfield
557 * @param $arr Array: the array to update.
559 protected static function checkItem( $desc, $field, $diff, $new, &$arr ) {
560 if( $diff & $field ) {
561 $arr[ ( $new & $field ) ?
0 : 1 ][] = $desc;
566 * Gets an array describing the changes made to the visibilit of the revision.
567 * If the resulting array is $arr, then $arr[0] will contain an array of strings
568 * describing the items that were hidden, $arr[2] will contain an array of strings
569 * describing the items that were unhidden, and $arr[3] will contain an array with
570 * a single string, which can be one of "applied restrictions to sysops",
571 * "removed restrictions from sysops", or null.
573 * @param $n Integer: the new bitfield.
574 * @param $o Integer: the old bitfield.
575 * @return An array as described above.
577 protected static function getChanges( $n, $o ) {
579 $ret = array( 0 => array(), 1 => array(), 2 => array() );
580 // Build bitfield changes in language
581 self
::checkItem( wfMsgForContent( 'revdelete-content' ),
582 Revision
::DELETED_TEXT
, $diff, $n, $ret );
583 self
::checkItem( wfMsgForContent( 'revdelete-summary' ),
584 Revision
::DELETED_COMMENT
, $diff, $n, $ret );
585 self
::checkItem( wfMsgForContent( 'revdelete-uname' ),
586 Revision
::DELETED_USER
, $diff, $n, $ret );
587 // Restriction application to sysops
588 if( $diff & Revision
::DELETED_RESTRICTED
) {
589 if( $n & Revision
::DELETED_RESTRICTED
)
590 $ret[2][] = wfMsgForContent( 'revdelete-restricted' );
592 $ret[2][] = wfMsgForContent( 'revdelete-unrestricted' );
598 * Gets a log message to describe the given revision visibility change. This
599 * message will be of the form "[hid {content, edit summary, username}];
600 * [unhid {...}][applied restrictions to sysops] for $count revisions: $comment".
602 * @param $count Integer: The number of effected revisions.
603 * @param $nbitfield Integer: The new bitfield for the revision.
604 * @param $obitfield Integer: The old bitfield for the revision.
605 * @param $isForLog Boolean
607 public static function getLogMessage( $count, $nbitfield, $obitfield, $isForLog = false ) {
610 $changes = self
::getChanges( $nbitfield, $obitfield );
611 if( count( $changes[0] ) ) {
612 $s .= wfMsgForContent( 'revdelete-hid', implode( ', ', $changes[0] ) );
614 if( count( $changes[1] ) ) {
616 $s .= wfMsgForContent( 'revdelete-unhid', implode( ', ', $changes[1] ) );
618 if( count( $changes[2] ) ) {
619 $s .= $s ?
' (' . $changes[2][0] . ')' : $changes[2][0];
621 $msg = $isForLog ?
'logdelete-log-message' : 'revdelete-log-message';
622 return wfMsgExt( $msg, array( 'parsemag', 'content' ), $s, $wgLang->formatNum($count) );
626 // Get DB field name for URL param...
627 // Future code for other things may also track
628 // other types of revision-specific changes.
629 // @returns string One of log_id/rev_id/fa_id/ar_timestamp/oi_archive_name
630 public static function getRelationType( $typeName ) {
631 if ( isset( SpecialRevisionDelete
::$deprecatedTypeMap[$typeName] ) ) {
632 $typeName = SpecialRevisionDelete
::$deprecatedTypeMap[$typeName];
634 if ( isset( SpecialRevisionDelete
::$allowedTypes[$typeName] ) ) {
635 $class = SpecialRevisionDelete
::$allowedTypes[$typeName]['list-class'];
636 $list = new $class( null, null, null );
637 return $list->getIdField();
645 * Abstract base class for a list of deletable items
647 abstract class RevDel_List
{
648 var $special, $title, $ids, $res, $current;
649 var $type = null; // override this
650 var $idField = null; // override this
651 var $dateField = false; // override this
652 var $authorIdField = false; // override this
653 var $authorNameField = false; // override this
656 * @param $special The parent SpecialPage
657 * @param $title The target title
658 * @param $ids Array of IDs
660 public function __construct( $special, $title, $ids ) {
661 $this->special
= $special;
662 $this->title
= $title;
667 * Get the internal type name of this list. Equal to the table name.
669 public function getType() {
674 * Get the DB field name associated with the ID list
676 public function getIdField() {
677 return $this->idField
;
681 * Get the DB field name storing timestamps
683 public function getTimestampField() {
684 return $this->dateField
;
688 * Get the DB field name storing user ids
690 public function getAuthorIdField() {
691 return $this->authorIdField
;
695 * Get the DB field name storing user names
697 public function getAuthorNameField() {
698 return $this->authorNameField
;
701 * Set the visibility for the revisions in this list. Logging and
702 * transactions are done here.
704 * @param $params Associative array of parameters. Members are:
705 * value: The integer value to set the visibility to
706 * comment: The log comment.
709 public function setVisibility( $params ) {
710 $newBits = $params['value'];
711 $comment = $params['comment'];
714 $dbw = wfGetDB( DB_MASTER
);
715 $this->doQuery( $dbw );
717 $status = Status
::newGood();
718 $missing = array_flip( $this->ids
);
719 $this->clearFileOps();
720 $idsForLog = array();
721 $authorIds = $authorIPs = array();
723 for ( $this->reset(); $this->current(); $this->next() ) {
724 $item = $this->current();
725 unset( $missing[ $item->getId() ] );
727 // Make error messages less vague
728 $oldBits = $item->getBits();
729 if ( $oldBits == $newBits ) {
730 $status->warning( 'revdelete-no-change', $item->formatDate(), $item->formatTime() );
731 $status->failCount++
;
733 } elseif ( $oldBits == 0 && $newBits != 0 ) {
735 } elseif ( $oldBits != 0 && $newBits == 0 ) {
741 if ( $item->isHideCurrentOp( $newBits ) ) {
742 // Cannot hide current version text
743 $status->error( 'revdelete-hide-current', $item->formatDate(), $item->formatTime() );
744 $status->failCount++
;
747 if ( !$item->canView() ) {
748 // Cannot access this revision
749 $msg = $opType == 'show' ?
'revdelete-show-no-access' : 'revdelete-modify-no-access';
750 $status->error( $msg, $item->formatDate(), $item->formatTime() );
751 $status->failCount++
;
755 // Update the revision
756 $ok = $item->setBits( $newBits );
759 $idsForLog[] = $item->getId();
760 $status->successCount++
;
761 if( $item->getAuthorId() > 0 ) {
762 $authorIds[] = $item->getAuthorId();
763 } else if( IP
::isIPAddress( $item->getAuthorName() ) ) {
764 $authorIPs[] = $item->getAuthorName();
767 $status->error( 'revdelete-concurrent-change', $item->formatDate(), $item->formatTime() );
768 $status->failCount++
;
772 // Handle missing revisions
773 foreach ( $missing as $id => $unused ) {
774 $status->error( 'revdelete-modify-missing', $id );
775 $status->failCount++
;
778 if ( $status->successCount
== 0 ) {
784 // Save success count
785 $successCount = $status->successCount
;
787 // Move files, if there are any
788 $status->merge( $this->doPreCommitUpdates() );
789 if ( !$status->isOK() ) {
790 // Fatal error, such as no configured archive directory
796 $this->updateLog( array(
797 'title' => $this->title
,
798 'count' => $successCount,
799 'newBits' => $newBits,
800 'oldBits' => $oldBits,
801 'comment' => $comment,
803 'authorIds' => $authorIds,
804 'authorIPs' => $authorIPs
809 $status->merge( $this->doPostCommitUpdates() );
814 * Reload the list data from the master DB. This can be done after setVisibility()
815 * to allow $item->getHTML() to show the new data.
817 function reloadFromMaster() {
818 $dbw = wfGetDB( DB_MASTER
);
819 $this->res
= $this->doQuery( $dbw );
823 * Record a log entry on the action
824 * @param $params Associative array of parameters:
825 * newBits: The new value of the *_deleted bitfield
826 * oldBits: The old value of the *_deleted bitfield.
827 * title: The target title
829 * comment: The log comment
830 * authorsIds: The array of the user IDs of the offenders
831 * authorsIPs: The array of the IP/anon user offenders
833 protected function updateLog( $params ) {
834 // Get the URL param's corresponding DB field
835 $field = RevisionDeleter
::getRelationType( $this->getType() );
837 throw new MWException( "Bad log URL param type!" );
839 // Put things hidden from sysops in the oversight log
840 if ( ( $params['newBits'] |
$params['oldBits'] ) & $this->getSuppressBit() ) {
841 $logType = 'suppress';
845 // Add params for effected page and ids
846 $logParams = $this->getLogParams( $params );
847 // Actually add the deletion log entry
848 $log = new LogPage( $logType );
849 $logid = $log->addEntry( $this->getLogAction(), $params['title'],
850 $params['comment'], $logParams );
851 // Allow for easy searching of deletion log items for revision/log items
852 $log->addRelations( $field, $params['ids'], $logid );
853 $log->addRelations( 'target_author_id', $params['authorIds'], $logid );
854 $log->addRelations( 'target_author_ip', $params['authorIPs'], $logid );
858 * Get the log action for this list type
860 public function getLogAction() {
865 * Get log parameter array.
866 * @param $params Associative array of log parameters, same as updateLog()
869 public function getLogParams( $params ) {
872 implode( ',', $params['ids'] ),
873 "ofield={$params['oldBits']}",
874 "nfield={$params['newBits']}"
879 * Initialise the current iteration pointer
881 protected function initCurrent() {
882 $row = $this->res
->current();
884 $this->current
= $this->newItem( $row );
886 $this->current
= false;
891 * Start iteration. This must be called before current() or next().
892 * @return First list item
894 public function reset() {
896 $this->res
= $this->doQuery( wfGetDB( DB_SLAVE
) );
898 $this->res
->rewind();
900 $this->initCurrent();
901 return $this->current
;
905 * Get the current list item, or false if we are at the end
907 public function current() {
908 return $this->current
;
912 * Move the iteration pointer to the next list item, and return it.
914 public function next() {
916 $this->initCurrent();
917 return $this->current
;
921 * Clear any data structures needed for doPreCommitUpdates() and doPostCommitUpdates()
924 public function clearFileOps() {
928 * A hook for setVisibility(): do batch updates pre-commit.
932 public function doPreCommitUpdates() {
933 return Status
::newGood();
937 * A hook for setVisibility(): do any necessary updates post-commit.
941 public function doPostCommitUpdates() {
942 return Status
::newGood();
946 * Create an item object from a DB result row
947 * @param $row stdclass
949 abstract public function newItem( $row );
952 * Do the DB query to iterate through the objects.
953 * @param $db Database object to use for the query
955 abstract public function doQuery( $db );
958 * Get the integer value of the flag used for suppression
960 abstract public function getSuppressBit();
964 * Abstract base class for deletable items
966 abstract class RevDel_Item
{
967 /** The parent SpecialPage */
970 /** The parent RevDel_List */
973 /** The DB result row */
977 * @param $list RevDel_List
978 * @param $row DB result row
980 public function __construct( $list, $row ) {
981 $this->special
= $list->special
;
987 * Get the ID, as it would appear in the ids URL parameter
989 public function getId() {
990 $field = $this->list->getIdField();
991 return $this->row
->$field;
995 * Get the date, formatted with $wgLang
997 public function formatDate() {
999 return $wgLang->date( $this->getTimestamp() );
1003 * Get the time, formatted with $wgLang
1005 public function formatTime() {
1007 return $wgLang->time( $this->getTimestamp() );
1011 * Get the timestamp in MW 14-char form
1013 public function getTimestamp() {
1014 $field = $this->list->getTimestampField();
1015 return wfTimestamp( TS_MW
, $this->row
->$field );
1019 * Get the author user ID
1021 public function getAuthorId() {
1022 $field = $this->list->getAuthorIdField();
1023 return intval( $this->row
->$field );
1027 * Get the author user name
1029 public function getAuthorName() {
1030 $field = $this->list->getAuthorNameField();
1031 return strval( $this->row
->$field );
1035 * Returns true if the item is "current", and the operation to set the given
1036 * bits can't be executed for that reason
1039 public function isHideCurrentOp( $newBits ) {
1044 * Returns true if the current user can view the item
1046 abstract public function canView();
1049 * Get the current deletion bitfield value
1051 abstract public function getBits();
1054 * Get the HTML of the list item. Should be include <li></li> tags.
1055 * This is used to show the list in HTML form, by the special page.
1057 abstract public function getHTML();
1060 * Set the visibility of the item. This should do any necessary DB queries.
1062 * The DB update query should have a condition which forces it to only update
1063 * if the value in the DB matches the value fetched earlier with the SELECT.
1064 * If the update fails because it did not match, the function should return
1065 * false. This prevents concurrency problems.
1067 * @return boolean success
1069 abstract public function setBits( $newBits );
1073 * List for revision table items
1075 class RevDel_RevisionList
extends RevDel_List
{
1077 var $type = 'revision';
1078 var $idField = 'rev_id';
1079 var $dateField = 'rev_timestamp';
1080 var $authorIdField = 'rev_user';
1081 var $authorNameField = 'rev_user_text';
1083 public function doQuery( $db ) {
1084 $ids = array_map( 'intval', $this->ids
);
1085 return $db->select( array('revision','page'), '*',
1087 'rev_page' => $this->title
->getArticleID(),
1089 'rev_page = page_id'
1095 public function newItem( $row ) {
1096 return new RevDel_RevisionItem( $this, $row );
1099 public function getCurrent() {
1100 if ( is_null( $this->currentRevId
) ) {
1101 $dbw = wfGetDB( DB_MASTER
);
1102 $this->currentRevId
= $dbw->selectField(
1103 'page', 'page_latest', $this->title
->pageCond(), __METHOD__
);
1105 return $this->currentRevId
;
1108 public function getSuppressBit() {
1109 return Revision
::DELETED_RESTRICTED
;
1112 public function doPreCommitUpdates() {
1113 $this->title
->invalidateCache();
1114 return Status
::newGood();
1117 public function doPostCommitUpdates() {
1118 $this->title
->purgeSquid();
1119 // Extensions that require referencing previous revisions may need this
1120 wfRunHooks( 'ArticleRevisionVisiblitySet', array( &$this->title
) );
1121 return Status
::newGood();
1126 * Item class for a revision table row
1128 class RevDel_RevisionItem
extends RevDel_Item
{
1131 public function __construct( $list, $row ) {
1132 parent
::__construct( $list, $row );
1133 $this->revision
= new Revision( $row );
1136 public function canView() {
1137 return $this->revision
->userCan( Revision
::DELETED_RESTRICTED
);
1140 public function getBits() {
1141 return $this->revision
->mDeleted
;
1144 public function setBits( $bits ) {
1145 $dbw = wfGetDB( DB_MASTER
);
1146 // Update revision table
1147 $dbw->update( 'revision',
1148 array( 'rev_deleted' => $bits ),
1150 'rev_id' => $this->revision
->getId(),
1151 'rev_page' => $this->revision
->getPage(),
1152 'rev_deleted' => $this->getBits()
1156 if ( !$dbw->affectedRows() ) {
1160 // Update recentchanges table
1161 $dbw->update( 'recentchanges',
1163 'rc_deleted' => $bits,
1167 'rc_this_oldid' => $this->revision
->getId(), // condition
1168 // non-unique timestamp index
1169 'rc_timestamp' => $dbw->timestamp( $this->revision
->getTimestamp() ),
1176 public function isDeleted() {
1177 return $this->revision
->isDeleted( Revision
::DELETED_TEXT
);
1180 public function isHideCurrentOp( $newBits ) {
1181 return ( $newBits & Revision
::DELETED_TEXT
)
1182 && $this->list->getCurrent() == $this->getId();
1186 * Get the HTML link to the revision text.
1187 * Overridden by RevDel_ArchiveItem.
1189 protected function getRevisionLink() {
1191 $date = $wgLang->timeanddate( $this->revision
->getTimestamp(), true );
1192 if ( $this->isDeleted() && !$this->canView() ) {
1195 return $this->special
->skin
->link(
1200 'oldid' => $this->revision
->getId(),
1207 * Get the HTML link to the diff.
1208 * Overridden by RevDel_ArchiveItem
1210 protected function getDiffLink() {
1211 if ( $this->isDeleted() && !$this->canView() ) {
1212 return wfMsgHtml('diff');
1215 $this->special
->skin
->link(
1220 'diff' => $this->revision
->getId(),
1232 public function getHTML() {
1233 $difflink = $this->getDiffLink();
1234 $revlink = $this->getRevisionLink();
1235 $userlink = $this->special
->skin
->revUserLink( $this->revision
);
1236 $comment = $this->special
->skin
->revComment( $this->revision
);
1237 if ( $this->isDeleted() ) {
1238 $revlink = "<span class=\"history-deleted\">$revlink</span>";
1240 return "<li>($difflink) $revlink $userlink $comment</li>";
1245 * List for archive table items, i.e. revisions deleted via action=delete
1247 class RevDel_ArchiveList
extends RevDel_RevisionList
{
1248 var $type = 'archive';
1249 var $idField = 'ar_timestamp';
1250 var $dateField = 'ar_timestamp';
1251 var $authorIdField = 'ar_user';
1252 var $authorNameField = 'ar_user_text';
1254 public function doQuery( $db ) {
1255 $timestamps = array();
1256 foreach ( $this->ids
as $id ) {
1257 $timestamps[] = $db->timestamp( $id );
1259 return $db->select( 'archive', '*',
1261 'ar_namespace' => $this->title
->getNamespace(),
1262 'ar_title' => $this->title
->getDBkey(),
1263 'ar_timestamp' => $timestamps
1269 public function newItem( $row ) {
1270 return new RevDel_ArchiveItem( $this, $row );
1273 public function doPreCommitUpdates() {
1274 return Status
::newGood();
1277 public function doPostCommitUpdates() {
1278 return Status
::newGood();
1283 * Item class for a archive table row
1285 class RevDel_ArchiveItem
extends RevDel_RevisionItem
{
1286 public function __construct( $list, $row ) {
1287 RevDel_Item
::__construct( $list, $row );
1288 $this->revision
= Revision
::newFromArchiveRow( $row,
1289 array( 'page' => $this->list->title
->getArticleId() ) );
1292 public function getId() {
1293 # Convert DB timestamp to MW timestamp
1294 return $this->revision
->getTimestamp();
1297 public function setBits( $bits ) {
1298 $dbw = wfGetDB( DB_MASTER
);
1299 $dbw->update( 'archive',
1300 array( 'ar_deleted' => $bits ),
1301 array( 'ar_namespace' => $this->list->title
->getNamespace(),
1302 'ar_title' => $this->list->title
->getDBkey(),
1303 // use timestamp for index
1304 'ar_timestamp' => $this->row
->ar_timestamp
,
1305 'ar_rev_id' => $this->row
->ar_rev_id
,
1306 'ar_deleted' => $this->getBits()
1309 return (bool)$dbw->affectedRows();
1312 protected function getRevisionLink() {
1314 $undelete = SpecialPage
::getTitleFor( 'Undelete' );
1315 $date = $wgLang->timeanddate( $this->revision
->getTimestamp(), true );
1316 if ( $this->isDeleted() && !$this->canView() ) {
1319 return $this->special
->skin
->link( $undelete, $date, array(),
1321 'target' => $this->list->title
->getPrefixedText(),
1322 'timestamp' => $this->revision
->getTimestamp()
1326 protected function getDiffLink() {
1327 if ( $this->isDeleted() && !$this->canView() ) {
1328 return wfMsgHtml( 'diff' );
1330 $undelete = SpecialPage
::getTitleFor( 'Undelete' );
1331 return $this->special
->skin
->link( $undelete, wfMsgHtml('diff'), array(),
1333 'target' => $this->list->title
->getPrefixedText(),
1335 'timestamp' => $this->revision
->getTimestamp()
1341 * List for oldimage table items
1343 class RevDel_FileList
extends RevDel_List
{
1344 var $type = 'oldimage';
1345 var $idField = 'oi_archive_name';
1346 var $dateField = 'oi_timestamp';
1347 var $authorIdField = 'oi_user';
1348 var $authorNameField = 'oi_user_text';
1349 var $storeBatch, $deleteBatch, $cleanupBatch;
1351 public function doQuery( $db ) {
1352 $archiveName = array();
1353 foreach( $this->ids
as $timestamp ) {
1354 $archiveNames[] = $timestamp . '!' . $this->title
->getDBkey();
1356 return $db->select( 'oldimage', '*',
1358 'oi_name' => $this->title
->getDBkey(),
1359 'oi_archive_name' => $archiveNames
1365 public function newItem( $row ) {
1366 return new RevDel_FileItem( $this, $row );
1369 public function clearFileOps() {
1370 $this->deleteBatch
= array();
1371 $this->storeBatch
= array();
1372 $this->cleanupBatch
= array();
1375 public function doPreCommitUpdates() {
1376 $status = Status
::newGood();
1377 $repo = RepoGroup
::singleton()->getLocalRepo();
1378 if ( $this->storeBatch
) {
1379 $status->merge( $repo->storeBatch( $this->storeBatch
, FileRepo
::OVERWRITE_SAME
) );
1381 if ( !$status->isOK() ) {
1384 if ( $this->deleteBatch
) {
1385 $status->merge( $repo->deleteBatch( $this->deleteBatch
) );
1387 if ( !$status->isOK() ) {
1388 // Running cleanupDeletedBatch() after a failed storeBatch() with the DB already
1389 // modified (but destined for rollback) causes data loss
1392 if ( $this->cleanupBatch
) {
1393 $status->merge( $repo->cleanupDeletedBatch( $this->cleanupBatch
) );
1398 public function doPostCommitUpdates() {
1399 $file = wfLocalFile( $this->title
);
1400 $file->purgeCache();
1401 $file->purgeDescription();
1402 return Status
::newGood();
1405 public function getSuppressBit() {
1406 return File
::DELETED_RESTRICTED
;
1411 * Item class for an oldimage table row
1413 class RevDel_FileItem
extends RevDel_Item
{
1416 public function __construct( $list, $row ) {
1417 parent
::__construct( $list, $row );
1418 $this->file
= RepoGroup
::singleton()->getLocalRepo()->newFileFromRow( $row );
1421 public function getId() {
1422 $parts = explode( '!', $this->row
->oi_archive_name
);
1426 public function canView() {
1427 return $this->file
->userCan( File
::DELETED_RESTRICTED
);
1430 public function getBits() {
1431 return $this->file
->getVisibility();
1434 public function setBits( $bits ) {
1436 # FIXME: move to LocalFile.php
1437 if ( $this->isDeleted() ) {
1438 if ( $bits & File
::DELETED_FILE
) {
1442 $key = $this->file
->getStorageKey();
1443 $srcRel = $this->file
->repo
->getDeletedHashPath( $key ) . $key;
1444 $this->list->storeBatch
[] = array(
1445 $this->file
->repo
->getVirtualUrl( 'deleted' ) . '/' . $srcRel,
1447 $this->file
->getRel()
1449 $this->list->cleanupBatch
[] = $key;
1451 } elseif ( $bits & File
::DELETED_FILE
) {
1453 $key = $this->file
->getStorageKey();
1454 $dstRel = $this->file
->repo
->getDeletedHashPath( $key ) . $key;
1455 $this->list->deleteBatch
[] = array( $this->file
->getRel(), $dstRel );
1458 # Do the database operations
1459 $dbw = wfGetDB( DB_MASTER
);
1460 $dbw->update( 'oldimage',
1461 array( 'oi_deleted' => $bits ),
1463 'oi_name' => $this->row
->oi_name
,
1464 'oi_timestamp' => $this->row
->oi_timestamp
,
1465 'oi_deleted' => $this->getBits()
1469 return (bool)$dbw->affectedRows();
1472 public function isDeleted() {
1473 return $this->file
->isDeleted( File
::DELETED_FILE
);
1477 * Get the link to the file.
1478 * Overridden by RevDel_ArchivedFileItem.
1480 protected function getLink() {
1481 global $wgLang, $wgUser;
1482 $date = $wgLang->timeanddate( $this->file
->getTimestamp(), true );
1483 if ( $this->isDeleted() ) {
1485 if ( !$this->canView() ) {
1488 $link = $this->special
->skin
->link(
1489 $this->special
->getTitle(),
1492 'target' => $this->list->title
->getPrefixedText(),
1493 'file' => $this->file
->getArchiveName(),
1494 'token' => $wgUser->editToken( $this->file
->getArchiveName() )
1498 return '<span class="history-deleted">' . $link . '</span>';
1501 $url = $this->file
->getUrl();
1502 return Xml
::element( 'a', array( 'href' => $this->file
->getUrl() ), $date );
1506 * Generate a user tool link cluster if the current user is allowed to view it
1507 * @return string HTML
1509 protected function getUserTools() {
1510 if( $this->file
->userCan( Revision
::DELETED_USER
) ) {
1511 $link = $this->special
->skin
->userLink( $this->file
->user
, $this->file
->user_text
) .
1512 $this->special
->skin
->userToolLinks( $this->file
->user
, $this->file
->user_text
);
1514 $link = wfMsgHtml( 'rev-deleted-user' );
1516 if( $this->file
->isDeleted( Revision
::DELETED_USER
) ) {
1517 return '<span class="history-deleted">' . $link . '</span>';
1523 * Wrap and format the file's comment block, if the current
1524 * user is allowed to view it.
1526 * @return string HTML
1528 protected function getComment() {
1529 if( $this->file
->userCan( File
::DELETED_COMMENT
) ) {
1530 $block = $this->special
->skin
->commentBlock( $this->file
->description
);
1532 $block = ' ' . wfMsgHtml( 'rev-deleted-comment' );
1534 if( $this->file
->isDeleted( File
::DELETED_COMMENT
) ) {
1535 return "<span class=\"history-deleted\">$block</span>";
1540 public function getHTML() {
1545 $wgLang->formatNum( $this->file
->getWidth() ),
1546 $wgLang->formatNum( $this->file
->getHeight() )
1549 wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $this->file
->getSize() ) ) .
1551 $pageLink = $this->getLink();
1553 return '<li>' . $this->getLink() . ' ' . $this->getUserTools() . ' ' .
1554 $data . ' ' . $this->getComment(). '</li>';
1559 * List for filearchive table items
1561 class RevDel_ArchivedFileList
extends RevDel_FileList
{
1562 var $type = 'filearchive';
1563 var $idField = 'fa_id';
1564 var $dateField = 'fa_timestamp';
1565 var $authorIdField = 'fa_user';
1566 var $authorNameField = 'fa_user_text';
1568 public function doQuery( $db ) {
1569 $ids = array_map( 'intval', $this->ids
);
1570 return $db->select( 'filearchive', '*',
1572 'fa_name' => $this->title
->getDBkey(),
1579 public function newItem( $row ) {
1580 return new RevDel_ArchivedFileItem( $this, $row );
1585 * Item class for a filearchive table row
1587 class RevDel_ArchivedFileItem
extends RevDel_FileItem
{
1588 public function __construct( $list, $row ) {
1589 RevDel_Item
::__construct( $list, $row );
1590 $this->file
= ArchivedFile
::newFromRow( $row );
1593 public function getId() {
1594 return $this->row
->fa_id
;
1597 public function setBits( $bits ) {
1598 $dbw = wfGetDB( DB_MASTER
);
1599 $dbw->update( 'filearchive',
1600 array( 'fa_deleted' => $bits ),
1602 'fa_id' => $this->row
->fa_id
,
1603 'fa_deleted' => $this->getBits(),
1607 return (bool)$dbw->affectedRows();
1610 protected function getLink() {
1611 global $wgLang, $wgUser;
1612 $date = $wgLang->timeanddate( $this->file
->getTimestamp(), true );
1613 $undelete = SpecialPage
::getTitleFor( 'Undelete' );
1614 $key = $this->file
->getKey();
1616 if( !$this->canView() ) {
1619 $link = $this->special
->skin
->link( $undelete, $date, array(),
1621 'target' => $this->list->title
->getPrefixedText(),
1623 'token' => $wgUser->editToken( $key )
1627 if( $this->isDeleted() ) {
1628 $link = '<span class="history-deleted">' . $link . '</span>';
1635 * List for logging table items
1637 class RevDel_LogList
extends RevDel_List
{
1638 var $type = 'logging';
1639 var $idField = 'log_id';
1640 var $dateField = 'log_timestamp';
1641 var $authorIdField = 'log_user';
1642 var $authorNameField = 'log_user_text';
1644 public function doQuery( $db ) {
1645 global $wgMessageCache;
1646 $wgMessageCache->loadAllMessages();
1647 $ids = array_map( 'intval', $this->ids
);
1648 return $db->select( 'logging', '*',
1649 array( 'log_id' => $ids ),
1654 public function newItem( $row ) {
1655 return new RevDel_LogItem( $this, $row );
1658 public function getSuppressBit() {
1659 return Revision
::DELETED_RESTRICTED
;
1662 public function getLogAction() {
1666 public function getLogParams( $params ) {
1668 implode( ',', $params['ids'] ),
1669 "ofield={$params['oldBits']}",
1670 "nfield={$params['newBits']}"
1676 * Item class for a logging table row
1678 class RevDel_LogItem
extends RevDel_Item
{
1679 public function canView() {
1680 return LogEventsList
::userCan( $this->row
, Revision
::DELETED_RESTRICTED
);
1683 public function getBits() {
1684 return $this->row
->log_deleted
;
1687 public function setBits( $bits ) {
1688 $dbw = wfGetDB( DB_MASTER
);
1689 $dbw->update( 'recentchanges',
1691 'rc_deleted' => $bits,
1695 'rc_logid' => $this->row
->log_id
,
1696 'rc_timestamp' => $this->row
->log_timestamp
// index
1700 $dbw->update( 'logging',
1701 array( 'log_deleted' => $bits ),
1703 'log_id' => $this->row
->log_id
,
1704 'log_deleted' => $this->getBits()
1708 return (bool)$dbw->affectedRows();
1711 public function getHTML() {
1714 $date = htmlspecialchars( $wgLang->timeanddate( $this->row
->log_timestamp
) );
1715 $paramArray = LogPage
::extractParams( $this->row
->log_params
);
1716 $title = Title
::makeTitle( $this->row
->log_namespace
, $this->row
->log_title
);
1718 // Log link for this page
1719 $loglink = $this->special
->skin
->link(
1720 SpecialPage
::getTitleFor( 'Log' ),
1723 array( 'page' => $title->getPrefixedText() )
1726 if( !$this->canView() ) {
1727 $action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
1729 $action = LogPage
::actionText( $this->row
->log_type
, $this->row
->log_action
, $title,
1730 $this->special
->skin
, $paramArray, true, true );
1731 if( $this->row
->log_deleted
& LogPage
::DELETED_ACTION
)
1732 $action = '<span class="history-deleted">' . $action . '</span>';
1735 $userLink = $this->special
->skin
->userLink( $this->row
->log_user
,
1736 User
::WhoIs( $this->row
->log_user
) );
1737 if( LogEventsList
::isDeleted($this->row
,LogPage
::DELETED_USER
) ) {
1738 $userLink = '<span class="history-deleted">' . $userLink . '</span>';
1741 $comment = $wgLang->getDirMark() . $this->special
->skin
->commentBlock( $this->row
->log_comment
);
1742 if( LogEventsList
::isDeleted($this->row
,LogPage
::DELETED_COMMENT
) ) {
1743 $comment = '<span class="history-deleted">' . $comment . '</span>';
1745 return "<li>($loglink) $date $userLink $action $comment</li>";