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', 'deleterevision' );
96 public function execute( $par ) {
97 global $wgOut, $wgUser, $wgRequest;
98 if( !$wgUser->isAllowed( 'deleterevision' ) ) {
99 $wgOut->permissionRequired( 'deleterevision' );
101 } else if( wfReadOnly() ) {
102 $wgOut->readOnlyPage();
105 $this->skin
= $wgUser->getSkin();
107 $this->outputHeader();
108 $this->submitClicked
= $wgRequest->wasPosted() && $wgRequest->getBool( 'wpSubmit' );
109 # Handle our many different possible input types.
110 $ids = $wgRequest->getVal( 'ids' );
111 if ( !is_null( $ids ) ) {
112 # Allow CSV, for backwards compatibility, or a single ID for show/hide links
113 $this->ids
= explode( ',', $ids );
116 $this->ids
= array_keys( $wgRequest->getArray('ids',array()) );
118 // $this->ids = array_map( 'intval', $this->ids );
119 $this->ids
= array_unique( array_filter( $this->ids
) );
121 if ( $wgRequest->getVal( 'action' ) == 'revisiondelete' ) {
122 # For show/hide form submission from history page
123 $this->targetObj
= $GLOBALS['wgTitle'];
124 $this->typeName
= 'revision';
126 $this->typeName
= $wgRequest->getVal( 'type' );
127 $this->targetObj
= Title
::newFromText( $wgRequest->getText( 'target' ) );
130 # For reviewing deleted files...
131 $this->archiveName
= $wgRequest->getVal( 'file' );
132 $this->token
= $wgRequest->getVal( 'token' );
133 if ( $this->archiveName
&& $this->targetObj
) {
134 $this->tryShowFile( $this->archiveName
);
138 if ( isset( self
::$deprecatedTypeMap[$this->typeName
] ) ) {
139 $this->typeName
= self
::$deprecatedTypeMap[$this->typeName
];
143 if( !isset( self
::$allowedTypes[$this->typeName
] ) ||
count( $this->ids
) == 0 ) {
144 $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
147 $this->typeInfo
= self
::$allowedTypes[$this->typeName
];
149 # If we have revisions, get the title from the first one
150 # since they should all be from the same page. This allows
151 # for more flexibility with page moves...
152 if( $this->typeName
== 'revision' ) {
153 $rev = Revision
::newFromId( $this->ids
[0] );
154 $this->targetObj
= $rev ?
$rev->getTitle() : $this->targetObj
;
157 $this->otherReason
= $wgRequest->getVal( 'wpReason' );
158 # We need a target page!
159 if( is_null($this->targetObj
) ) {
160 $wgOut->addWikiMsg( 'undelete-header' );
163 # Give a link to the logs/hist for this page
164 $this->showConvenienceLinks();
166 # Initialise checkboxes
167 $this->checks
= array(
168 array( $this->typeInfo
['check-label'], 'wpHidePrimary', $this->typeInfo
['deletion-bits'] ),
169 array( 'revdelete-hide-comment', 'wpHideComment', Revision
::DELETED_COMMENT
),
170 array( 'revdelete-hide-user', 'wpHideUser', Revision
::DELETED_USER
)
172 if( $wgUser->isAllowed('suppressrevision') ) {
173 $this->checks
[] = array( 'revdelete-hide-restricted',
174 'wpHideRestricted', Revision
::DELETED_RESTRICTED
);
177 # Either submit or create our form
178 if( $this->submitClicked
) {
179 $this->submit( $wgRequest );
183 $qc = $this->getLogQueryCond();
184 # Show relevant lines from the deletion log
185 $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage
::logName( 'delete' ) ) . "</h2>\n" );
186 LogEventsList
::showLogExtract( $wgOut, 'delete',
187 $this->targetObj
->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) );
188 # Show relevant lines from the suppression log
189 if( $wgUser->isAllowed( 'suppressionlog' ) ) {
190 $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage
::logName( 'suppress' ) ) . "</h2>\n" );
191 LogEventsList
::showLogExtract( $wgOut, 'suppress',
192 $this->targetObj
->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) );
197 * Show some useful links in the subtitle
199 protected function showConvenienceLinks() {
200 global $wgOut, $wgUser, $wgLang;
201 # Give a link to the logs/hist for this page
202 if( $this->targetObj
) {
204 $links[] = $this->skin
->linkKnown(
205 SpecialPage
::getTitleFor( 'Log' ),
206 wfMsgHtml( 'viewpagelogs' ),
208 array( 'page' => $this->targetObj
->getPrefixedText() )
210 if ( $this->targetObj
->getNamespace() != NS_SPECIAL
) {
211 # Give a link to the page history
212 $links[] = $this->skin
->linkKnown(
214 wfMsgHtml( 'pagehist' ),
216 array( 'action' => 'history' )
218 # Link to deleted edits
219 if( $wgUser->isAllowed('undelete') ) {
220 $undelete = SpecialPage
::getTitleFor( 'Undelete' );
221 $links[] = $this->skin
->linkKnown(
223 wfMsgHtml( 'deletedhist' ),
225 array( 'target' => $this->targetObj
->getPrefixedDBkey() )
229 # Logs themselves don't have histories or archived revisions
230 $wgOut->setSubtitle( '<p>' . $wgLang->pipeList( $links ) . '</p>' );
235 * Get the condition used for fetching log snippets
237 protected function getLogQueryCond() {
239 // Revision delete logs for these item
240 $conds['log_type'] = array('delete','suppress');
241 $conds['log_action'] = $this->getList()->getLogAction();
242 $conds['ls_field'] = RevisionDeleter
::getRelationType( $this->typeName
);
243 $conds['ls_value'] = $this->ids
;
248 * Show a deleted file version requested by the visitor.
249 * TODO Mostly copied from Special:Undelete. Refactor.
251 protected function tryShowFile( $archiveName ) {
252 global $wgOut, $wgRequest, $wgUser, $wgLang;
254 $repo = RepoGroup
::singleton()->getLocalRepo();
255 $oimage = $repo->newFromArchiveName( $this->targetObj
, $archiveName );
257 // Check if user is allowed to see this file
258 if ( !$oimage->exists() ) {
259 $wgOut->addWikiMsg( 'revdelete-no-file' );
262 if( !$oimage->userCan(File
::DELETED_FILE
) ) {
263 $wgOut->permissionRequired( 'suppressrevision' );
266 if ( !$wgUser->matchEditToken( $this->token
, $archiveName ) ) {
267 $wgOut->addWikiMsg( 'revdelete-show-file-confirm',
268 $this->targetObj
->getText(),
269 $wgLang->date( $oimage->getTimestamp() ),
270 $wgLang->time( $oimage->getTimestamp() ) );
272 Xml
::openElement( 'form', array(
274 'action' => $this->getTitle()->getLocalUrl(
275 'target=' . urlencode( $oimage->getName() ) .
276 '&file=' . urlencode( $archiveName ) .
277 '&token=' . urlencode( $wgUser->editToken( $archiveName ) ) )
280 Xml
::submitButton( wfMsg( 'revdelete-show-file-submit' ) ) .
286 # We mustn't allow the output to be Squid cached, otherwise
287 # if an admin previews a deleted image, and it's cached, then
288 # a user without appropriate permissions can toddle off and
289 # nab the image, and Squid will serve it
290 $wgRequest->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
291 $wgRequest->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
292 $wgRequest->response()->header( 'Pragma: no-cache' );
294 # Stream the file to the client
296 require_once( "$IP/includes/StreamFile.php" );
297 $key = $oimage->getStorageKey();
298 $path = $repo->getZonePath( 'deleted' ) . '/' . $repo->getDeletedHashPath( $key ) . $key;
299 wfStreamFile( $path );
303 * Get the list object for this request
305 protected function getList() {
306 if ( is_null( $this->list ) ) {
307 $class = $this->typeInfo
['list-class'];
308 $this->list = new $class( $this, $this->targetObj
, $this->ids
);
314 * Show a list of items that we will operate on, and show a form with checkboxes
315 * which will allow the user to choose new visibility settings.
317 protected function showForm() {
318 global $wgOut, $wgUser, $wgLang;
321 if ( $this->typeName
== 'logging' ) {
322 $wgOut->addWikiMsg( 'logdelete-selected', $wgLang->formatNum( count($this->ids
) ) );
324 $wgOut->addWikiMsg( 'revdelete-selected',
325 $this->targetObj
->getPrefixedText(), count( $this->ids
) );
329 $wgOut->addHTML( "<ul>" );
331 $where = $revObjs = array();
335 $list = $this->getList();
336 for ( $list->reset(); $list->current(); $list->next() ) {
337 $item = $list->current();
338 if ( !$item->canView() ) {
339 if( !$this->submitClicked
) {
340 $wgOut->permissionRequired( 'suppressrevision' );
343 $UserAllowed = false;
346 $bitfields |
= $item->getBits();
347 $wgOut->addHTML( $item->getHTML() );
350 if( !$numRevisions ) {
351 $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' );
355 $wgOut->addHTML( "</ul>" );
357 $this->addUsageText();
359 // Normal sysops can always see what they did, but can't always change it
360 if( !$UserAllowed ) return;
362 $out = Xml
::openElement( 'form', array( 'method' => 'post',
363 'action' => $this->getTitle()->getLocalUrl( array( 'action' => 'submit' ) ),
364 'id' => 'mw-revdel-form-revisions' ) ) .
365 Xml
::fieldset( wfMsg( 'revdelete-legend' ) ) .
366 $this->buildCheckBoxes( $bitfields ) .
367 Xml
::openElement( 'table' ) .
369 '<td class="mw-label">' .
370 Xml
::label( wfMsg( 'revdelete-log' ), 'wpRevDeleteReasonList' ) .
372 '<td class="mw-input">' .
373 Xml
::listDropDown( 'wpRevDeleteReasonList',
374 wfMsgForContent( 'revdelete-reason-dropdown' ),
375 wfMsgForContent( 'revdelete-reasonotherlist' ), '', 'wpReasonDropDown', 1
379 '<td class="mw-label">' .
380 Xml
::label( wfMsg( 'revdelete-otherreason' ), 'wpReason' ) .
382 '<td class="mw-input">' .
383 Xml
::input( 'wpReason', 60, $this->otherReason
, array( 'id' => 'wpReason' ) ) .
387 '<td class="mw-submit">' .
388 Xml
::submitButton( wfMsg( 'revdelete-submit' ), array( 'name' => 'wpSubmit' ) ) .
391 Xml
::closeElement( 'table' ) .
392 Xml
::hidden( 'wpEditToken', $wgUser->editToken() ) .
393 Xml
::hidden( 'target', $this->targetObj
->getPrefixedText() ) .
394 Xml
::hidden( 'type', $this->typeName
) .
395 Xml
::hidden( 'ids', implode( ',', $this->ids
) ) .
396 Xml
::closeElement( 'fieldset' ) . "\n";
398 if( $wgUser->isAllowed( 'editinterface' ) ) {
399 $title = Title
::makeTitle( NS_MEDIAWIKI
, 'revdelete-reason-dropdown' );
400 $link = $wgUser->getSkin()->link(
402 wfMsgHtml( 'revdelete-edit-reasonlist' ),
404 array( 'action' => 'edit' )
406 $out .= Xml
::tags( 'p', array( 'class' => 'mw-revdel-editreasons' ), $link ) . "\n";
408 $out .= Xml
::closeElement( 'form' ) . "\n";
410 $wgOut->addHTML( $out );
414 * Show some introductory text
415 * FIXME Wikimedia-specific policy text
417 protected function addUsageText() {
418 global $wgOut, $wgUser;
419 $wgOut->addWikiMsg( 'revdelete-text' );
420 if( $wgUser->isAllowed( 'suppressrevision' ) ) {
421 $wgOut->addWikiMsg( 'revdelete-suppress-text' );
426 * @param $bitfields Interger: aggregate bitfield of all the bitfields
427 * @return String: HTML
429 protected function buildCheckBoxes( $bitfields ) {
431 // FIXME: all items checked for just one rev are checked, even if not set for the others
432 foreach( $this->checks
as $item ) {
433 list( $message, $name, $field ) = $item;
434 $innerHTML = Xml
::checkLabel( wfMsg($message), $name, $name, $bitfields & $field );
435 if( $field == Revision
::DELETED_RESTRICTED
)
436 $innerHTML = "<b>$innerHTML</b>";
437 $line = Xml
::tags( 'td', array( 'class' => 'mw-input' ), $innerHTML );
438 $html .= '<tr>' . $line . "</tr>\n";
445 * UI entry point for form submission.
446 * @param $request WebRequest
448 protected function submit( $request ) {
449 global $wgUser, $wgOut;
450 # Check edit token on submission
451 if( $this->submitClicked
&& !$wgUser->matchEditToken( $request->getVal('wpEditToken') ) ) {
452 $wgOut->addWikiMsg( 'sessionfailure' );
455 $bitfield = $this->extractBitfield( $request );
456 $listReason = $request->getText( 'wpRevDeleteReasonList', 'other' ); // from dropdown
457 $comment = $listReason;
458 if( $comment != 'other' && $this->otherReason
!= '' ) {
459 // Entry from drop down menu + additional comment
460 $comment .= wfMsgForContent( 'colon-separator' ) . $this->otherReason
;
461 } elseif( $comment == 'other' ) {
462 $comment = $this->otherReason
;
464 # Can the user set this field?
465 if( $bitfield & Revision
::DELETED_RESTRICTED
&& !$wgUser->isAllowed('suppressrevision') ) {
466 $wgOut->permissionRequired( 'suppressrevision' );
469 # If the save went through, go to success message...
470 $status = $this->save( $bitfield, $comment, $this->targetObj
);
471 if ( $status->isGood() ) {
474 # ...otherwise, bounce back to form...
476 $this->failure( $status );
482 * Report that the submit operation succeeded
484 protected function success() {
486 $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
487 $wgOut->wrapWikiMsg( '<span class="success">$1</span>', $this->typeInfo
['success'] );
488 $this->list->reloadFromMaster();
493 * Report that the submit operation failed
495 protected function failure( $status ) {
497 $wgOut->setPagetitle( wfMsg( 'actionfailed' ) );
498 $wgOut->addWikiText( $status->getWikiText( $this->typeInfo
['failure'] ) );
503 * Put together a rev_deleted bitfield from the submitted checkboxes
504 * @param $request WebRequest
507 protected function extractBitfield( $request ) {
509 foreach( $this->checks
as $item ) {
510 list( /* message */ , $name, $field ) = $item;
511 if( $request->getCheck( $name ) ) {
519 * Do the write operations. Simple wrapper for RevDel_*List::setVisibility().
521 protected function save( $bitfield, $reason, $title ) {
522 // Don't allow simply locking the interface for no reason
523 if( $bitfield == Revision
::DELETED_RESTRICTED
) {
524 return Status
::newFatal( 'revdelete-only-restricted' );
526 return $this->getList()->setVisibility( array(
527 'value' => $bitfield,
528 'comment' => $reason ) );
533 * Temporary b/c interface, collection of static functions.
534 * @ingroup SpecialPage
536 class RevisionDeleter
{
538 * Checks for a change in the bitfield for a certain option and updates the
539 * provided array accordingly.
541 * @param $desc String: description to add to the array if the option was
542 * enabled / disabled.
543 * @param $field Integer: the bitmask describing the single option.
544 * @param $diff Integer: the xor of the old and new bitfields.
545 * @param $new Integer: the new bitfield
546 * @param $arr Array: the array to update.
548 protected static function checkItem( $desc, $field, $diff, $new, &$arr ) {
549 if( $diff & $field ) {
550 $arr[ ( $new & $field ) ?
0 : 1 ][] = $desc;
555 * Gets an array describing the changes made to the visibilit of the revision.
556 * If the resulting array is $arr, then $arr[0] will contain an array of strings
557 * describing the items that were hidden, $arr[2] will contain an array of strings
558 * describing the items that were unhidden, and $arr[3] will contain an array with
559 * a single string, which can be one of "applied restrictions to sysops",
560 * "removed restrictions from sysops", or null.
562 * @param $n Integer: the new bitfield.
563 * @param $o Integer: the old bitfield.
564 * @return An array as described above.
566 protected static function getChanges( $n, $o ) {
568 $ret = array( 0 => array(), 1 => array(), 2 => array() );
569 // Build bitfield changes in language
570 self
::checkItem( wfMsgForContent( 'revdelete-content' ),
571 Revision
::DELETED_TEXT
, $diff, $n, $ret );
572 self
::checkItem( wfMsgForContent( 'revdelete-summary' ),
573 Revision
::DELETED_COMMENT
, $diff, $n, $ret );
574 self
::checkItem( wfMsgForContent( 'revdelete-uname' ),
575 Revision
::DELETED_USER
, $diff, $n, $ret );
576 // Restriction application to sysops
577 if( $diff & Revision
::DELETED_RESTRICTED
) {
578 if( $n & Revision
::DELETED_RESTRICTED
)
579 $ret[2][] = wfMsgForContent( 'revdelete-restricted' );
581 $ret[2][] = wfMsgForContent( 'revdelete-unrestricted' );
587 * Gets a log message to describe the given revision visibility change. This
588 * message will be of the form "[hid {content, edit summary, username}];
589 * [unhid {...}][applied restrictions to sysops] for $count revisions: $comment".
591 * @param $count Integer: The number of effected revisions.
592 * @param $nbitfield Integer: The new bitfield for the revision.
593 * @param $obitfield Integer: The old bitfield for the revision.
594 * @param $isForLog Boolean
596 public static function getLogMessage( $count, $nbitfield, $obitfield, $isForLog = false ) {
599 $changes = self
::getChanges( $nbitfield, $obitfield );
600 if( count( $changes[0] ) ) {
601 $s .= wfMsgForContent( 'revdelete-hid', implode( ', ', $changes[0] ) );
603 if( count( $changes[1] ) ) {
605 $s .= wfMsgForContent( 'revdelete-unhid', implode( ', ', $changes[1] ) );
607 if( count( $changes[2] ) ) {
608 $s .= $s ?
' (' . $changes[2][0] . ')' : $changes[2][0];
610 $msg = $isForLog ?
'logdelete-log-message' : 'revdelete-log-message';
611 return wfMsgExt( $msg, array( 'parsemag', 'content' ), $s, $wgLang->formatNum($count) );
615 // Get DB field name for URL param...
616 // Future code for other things may also track
617 // other types of revision-specific changes.
618 // @returns string One of log_id/rev_id/fa_id/ar_timestamp/oi_archive_name
619 public static function getRelationType( $typeName ) {
620 if ( isset( SpecialRevisionDelete
::$deprecatedTypeMap[$typeName] ) ) {
621 $typeName = SpecialRevisionDelete
::$deprecatedTypeMap[$typeName];
623 if ( isset( SpecialRevisionDelete
::$allowedTypes[$typeName] ) ) {
624 $class = SpecialRevisionDelete
::$allowedTypes[$typeName]['list-class'];
625 $list = new $class( null, null, null );
626 return $list->getIdField();
634 * Abstract base class for a list of deletable items
636 abstract class RevDel_List
{
637 var $special, $title, $ids, $res, $current;
638 var $type = null; // override this
639 var $idField = null; // override this
640 var $dateField = false; // override this
641 var $authorIdField = false; // override this
642 var $authorNameField = false; // override this
645 * @param $special The parent SpecialPage
646 * @param $title The target title
647 * @param $ids Array of IDs
649 public function __construct( $special, $title, $ids ) {
650 $this->special
= $special;
651 $this->title
= $title;
656 * Get the internal type name of this list. Equal to the table name.
658 public function getType() {
663 * Get the DB field name associated with the ID list
665 public function getIdField() {
666 return $this->idField
;
670 * Get the DB field name storing timestamps
672 public function getTimestampField() {
673 return $this->dateField
;
677 * Get the DB field name storing user ids
679 public function getAuthorIdField() {
680 return $this->authorIdField
;
684 * Get the DB field name storing user names
686 public function getAuthorNameField() {
687 return $this->authorNameField
;
690 * Set the visibility for the revisions in this list. Logging and
691 * transactions are done here.
693 * @param $params Associative array of parameters. Members are:
694 * value: The integer value to set the visibility to
695 * comment: The log comment.
698 public function setVisibility( $params ) {
699 $newBits = $params['value'];
700 $comment = $params['comment'];
703 $dbw = wfGetDB( DB_MASTER
);
704 $this->doQuery( $dbw );
706 $status = Status
::newGood();
707 $missing = array_flip( $this->ids
);
708 $this->clearFileOps();
709 $idsForLog = array();
710 $authorIds = $authorIPs = array();
712 for ( $this->reset(); $this->current(); $this->next() ) {
713 $item = $this->current();
714 unset( $missing[ $item->getId() ] );
716 // Make error messages less vague
717 $oldBits = $item->getBits();
718 if ( $oldBits == $newBits ) {
719 $status->warning( 'revdelete-no-change', $item->formatDate(), $item->formatTime() );
720 $status->failCount++
;
722 } elseif ( $oldBits == 0 && $newBits != 0 ) {
724 } elseif ( $oldBits != 0 && $newBits == 0 ) {
730 if ( $item->isHideCurrentOp( $newBits ) ) {
731 // Cannot hide current version text
732 $status->error( 'revdelete-hide-current', $item->formatDate(), $item->formatTime() );
733 $status->failCount++
;
736 if ( !$item->canView() ) {
737 // Cannot access this revision
738 $msg = $opType == 'show' ?
'revdelete-show-no-access' : 'revdelete-modify-no-access';
739 $status->error( $msg, $item->formatDate(), $item->formatTime() );
740 $status->failCount++
;
744 // Update the revision
745 $ok = $item->setBits( $newBits );
748 $idsForLog[] = $item->getId();
749 $status->successCount++
;
750 if( $item->getAuthorId() > 0 ) {
751 $authorIds[] = $item->getAuthorId();
752 } else if( IP
::isIPAddress( $item->getAuthorName() ) ) {
753 $authorIPs[] = $item->getAuthorName();
756 $status->error( 'revdelete-concurrent-change', $item->formatDate(), $item->formatTime() );
757 $status->failCount++
;
761 // Handle missing revisions
762 foreach ( $missing as $id => $unused ) {
763 $status->error( 'revdelete-modify-missing', $id );
764 $status->failCount++
;
767 if ( $status->successCount
== 0 ) {
773 // Save success count
774 $successCount = $status->successCount
;
776 // Move files, if there are any
777 $status->merge( $this->doPreCommitUpdates() );
778 if ( !$status->isOK() ) {
779 // Fatal error, such as no configured archive directory
785 $this->updateLog( array(
786 'title' => $this->title
,
787 'count' => $successCount,
788 'newBits' => $newBits,
789 'oldBits' => $oldBits,
790 'comment' => $comment,
792 'authorIds' => $authorIds,
793 'authorIPs' => $authorIPs
798 $status->merge( $this->doPostCommitUpdates() );
803 * Reload the list data from the master DB. This can be done after setVisibility()
804 * to allow $item->getHTML() to show the new data.
806 function reloadFromMaster() {
807 $dbw = wfGetDB( DB_MASTER
);
808 $this->res
= $this->doQuery( $dbw );
812 * Record a log entry on the action
813 * @param $params Associative array of parameters:
814 * newBits: The new value of the *_deleted bitfield
815 * oldBits: The old value of the *_deleted bitfield.
816 * title: The target title
818 * comment: The log comment
819 * authorsIds: The array of the user IDs of the offenders
820 * authorsIPs: The array of the IP/anon user offenders
822 protected function updateLog( $params ) {
823 // Get the URL param's corresponding DB field
824 $field = RevisionDeleter
::getRelationType( $this->getType() );
826 throw new MWException( "Bad log URL param type!" );
828 // Put things hidden from sysops in the oversight log
829 if ( ( $params['newBits'] |
$params['oldBits'] ) & $this->getSuppressBit() ) {
830 $logType = 'suppress';
834 // Add params for effected page and ids
835 $logParams = $this->getLogParams( $params );
836 // Actually add the deletion log entry
837 $log = new LogPage( $logType );
838 $logid = $log->addEntry( $this->getLogAction(), $params['title'],
839 $params['comment'], $logParams );
840 // Allow for easy searching of deletion log items for revision/log items
841 $log->addRelations( $field, $params['ids'], $logid );
842 $log->addRelations( 'target_author_id', $params['authorIds'], $logid );
843 $log->addRelations( 'target_author_ip', $params['authorIPs'], $logid );
847 * Get the log action for this list type
849 public function getLogAction() {
854 * Get log parameter array.
855 * @param $params Associative array of log parameters, same as updateLog()
858 public function getLogParams( $params ) {
861 implode( ',', $params['ids'] ),
862 "ofield={$params['oldBits']}",
863 "nfield={$params['newBits']}"
868 * Initialise the current iteration pointer
870 protected function initCurrent() {
871 $row = $this->res
->current();
873 $this->current
= $this->newItem( $row );
875 $this->current
= false;
880 * Start iteration. This must be called before current() or next().
881 * @return First list item
883 public function reset() {
885 $this->res
= $this->doQuery( wfGetDB( DB_SLAVE
) );
887 $this->res
->rewind();
889 $this->initCurrent();
890 return $this->current
;
894 * Get the current list item, or false if we are at the end
896 public function current() {
897 return $this->current
;
901 * Move the iteration pointer to the next list item, and return it.
903 public function next() {
905 $this->initCurrent();
906 return $this->current
;
910 * Clear any data structures needed for doPreCommitUpdates() and doPostCommitUpdates()
913 public function clearFileOps() {
917 * A hook for setVisibility(): do batch updates pre-commit.
921 public function doPreCommitUpdates() {
922 return Status
::newGood();
926 * A hook for setVisibility(): do any necessary updates post-commit.
930 public function doPostCommitUpdates() {
931 return Status
::newGood();
935 * Create an item object from a DB result row
936 * @param $row stdclass
938 abstract public function newItem( $row );
941 * Do the DB query to iterate through the objects.
942 * @param $db Database object to use for the query
944 abstract public function doQuery( $db );
947 * Get the integer value of the flag used for suppression
949 abstract public function getSuppressBit();
953 * Abstract base class for deletable items
955 abstract class RevDel_Item
{
956 /** The parent SpecialPage */
959 /** The parent RevDel_List */
962 /** The DB result row */
966 * @param $list RevDel_List
967 * @param $row DB result row
969 public function __construct( $list, $row ) {
970 $this->special
= $list->special
;
976 * Get the ID, as it would appear in the ids URL parameter
978 public function getId() {
979 $field = $this->list->getIdField();
980 return $this->row
->$field;
984 * Get the date, formatted with $wgLang
986 public function formatDate() {
988 return $wgLang->date( $this->getTimestamp() );
992 * Get the time, formatted with $wgLang
994 public function formatTime() {
996 return $wgLang->time( $this->getTimestamp() );
1000 * Get the timestamp in MW 14-char form
1002 public function getTimestamp() {
1003 $field = $this->list->getTimestampField();
1004 return wfTimestamp( TS_MW
, $this->row
->$field );
1008 * Get the author user ID
1010 public function getAuthorId() {
1011 $field = $this->list->getAuthorIdField();
1012 return intval( $this->row
->$field );
1016 * Get the author user name
1018 public function getAuthorName() {
1019 $field = $this->list->getAuthorNameField();
1020 return strval( $this->row
->$field );
1024 * Returns true if the item is "current", and the operation to set the given
1025 * bits can't be executed for that reason
1028 public function isHideCurrentOp( $newBits ) {
1033 * Returns true if the current user can view the item
1035 abstract public function canView();
1038 * Get the current deletion bitfield value
1040 abstract public function getBits();
1043 * Get the HTML of the list item. Should be include <li></li> tags.
1044 * This is used to show the list in HTML form, by the special page.
1046 abstract public function getHTML();
1049 * Set the visibility of the item. This should do any necessary DB queries.
1051 * The DB update query should have a condition which forces it to only update
1052 * if the value in the DB matches the value fetched earlier with the SELECT.
1053 * If the update fails because it did not match, the function should return
1054 * false. This prevents concurrency problems.
1056 * @return boolean success
1058 abstract public function setBits( $newBits );
1062 * List for revision table items
1064 class RevDel_RevisionList
extends RevDel_List
{
1066 var $type = 'revision';
1067 var $idField = 'rev_id';
1068 var $dateField = 'rev_timestamp';
1069 var $authorIdField = 'rev_user';
1070 var $authorNameField = 'rev_user_text';
1072 public function doQuery( $db ) {
1073 $ids = array_map( 'intval', $this->ids
);
1074 return $db->select( array('revision','page'), '*',
1076 'rev_page' => $this->title
->getArticleID(),
1078 'rev_page = page_id'
1084 public function newItem( $row ) {
1085 return new RevDel_RevisionItem( $this, $row );
1088 public function getCurrent() {
1089 if ( is_null( $this->currentRevId
) ) {
1090 $dbw = wfGetDB( DB_MASTER
);
1091 $this->currentRevId
= $dbw->selectField(
1092 'page', 'page_latest', $this->title
->pageCond(), __METHOD__
);
1094 return $this->currentRevId
;
1097 public function getSuppressBit() {
1098 return Revision
::DELETED_RESTRICTED
;
1101 public function doPreCommitUpdates() {
1102 $this->title
->invalidateCache();
1103 return Status
::newGood();
1106 public function doPostCommitUpdates() {
1107 $this->title
->purgeSquid();
1108 // Extensions that require referencing previous revisions may need this
1109 wfRunHooks( 'ArticleRevisionVisiblitySet', array( &$this->title
) );
1110 return Status
::newGood();
1115 * Item class for a revision table row
1117 class RevDel_RevisionItem
extends RevDel_Item
{
1120 public function __construct( $list, $row ) {
1121 parent
::__construct( $list, $row );
1122 $this->revision
= new Revision( $row );
1125 public function canView() {
1126 return $this->revision
->userCan( Revision
::DELETED_RESTRICTED
);
1129 public function getBits() {
1130 return $this->revision
->mDeleted
;
1133 public function setBits( $bits ) {
1134 $dbw = wfGetDB( DB_MASTER
);
1135 // Update revision table
1136 $dbw->update( 'revision',
1137 array( 'rev_deleted' => $bits ),
1139 'rev_id' => $this->revision
->getId(),
1140 'rev_page' => $this->revision
->getPage(),
1141 'rev_deleted' => $this->getBits()
1145 if ( !$dbw->affectedRows() ) {
1149 // Update recentchanges table
1150 $dbw->update( 'recentchanges',
1152 'rc_deleted' => $bits,
1156 'rc_this_oldid' => $this->revision
->getId(), // condition
1157 // non-unique timestamp index
1158 'rc_timestamp' => $dbw->timestamp( $this->revision
->getTimestamp() ),
1165 public function isDeleted() {
1166 return $this->revision
->isDeleted( Revision
::DELETED_TEXT
);
1169 public function isHideCurrentOp( $newBits ) {
1170 return ( $newBits & Revision
::DELETED_TEXT
)
1171 && $this->list->getCurrent() == $this->getId();
1175 * Get the HTML link to the revision text.
1176 * Overridden by RevDel_ArchiveItem.
1178 protected function getRevisionLink() {
1180 $date = $wgLang->timeanddate( $this->revision
->getTimestamp(), true );
1181 if ( $this->isDeleted() && !$this->canView() ) {
1184 return $this->special
->skin
->link(
1189 'oldid' => $this->revision
->getId(),
1196 * Get the HTML link to the diff.
1197 * Overridden by RevDel_ArchiveItem
1199 protected function getDiffLink() {
1200 if ( $this->isDeleted() && !$this->canView() ) {
1201 return wfMsgHtml('diff');
1204 $this->special
->skin
->link(
1209 'diff' => $this->revision
->getId(),
1221 public function getHTML() {
1222 $difflink = $this->getDiffLink();
1223 $revlink = $this->getRevisionLink();
1224 $userlink = $this->special
->skin
->revUserLink( $this->revision
);
1225 $comment = $this->special
->skin
->revComment( $this->revision
);
1226 if ( $this->isDeleted() ) {
1227 $revlink = "<span class=\"history-deleted\">$revlink</span>";
1229 return "<li>($difflink) $revlink $userlink $comment</li>";
1234 * List for archive table items, i.e. revisions deleted via action=delete
1236 class RevDel_ArchiveList
extends RevDel_RevisionList
{
1237 var $type = 'archive';
1238 var $idField = 'ar_timestamp';
1239 var $dateField = 'ar_timestamp';
1240 var $authorIdField = 'ar_user';
1241 var $authorNameField = 'ar_user_text';
1243 public function doQuery( $db ) {
1244 $timestamps = array();
1245 foreach ( $this->ids
as $id ) {
1246 $timestamps[] = $db->timestamp( $id );
1248 return $db->select( 'archive', '*',
1250 'ar_namespace' => $this->title
->getNamespace(),
1251 'ar_title' => $this->title
->getDBkey(),
1252 'ar_timestamp' => $timestamps
1258 public function newItem( $row ) {
1259 return new RevDel_ArchiveItem( $this, $row );
1262 public function doPreCommitUpdates() {
1263 return Status
::newGood();
1266 public function doPostCommitUpdates() {
1267 return Status
::newGood();
1272 * Item class for a archive table row
1274 class RevDel_ArchiveItem
extends RevDel_RevisionItem
{
1275 public function __construct( $list, $row ) {
1276 RevDel_Item
::__construct( $list, $row );
1277 $this->revision
= Revision
::newFromArchiveRow( $row,
1278 array( 'page' => $this->list->title
->getArticleId() ) );
1281 public function getId() {
1282 # Convert DB timestamp to MW timestamp
1283 return $this->revision
->getTimestamp();
1286 public function setBits( $bits ) {
1287 $dbw = wfGetDB( DB_MASTER
);
1288 $dbw->update( 'archive',
1289 array( 'ar_deleted' => $bits ),
1290 array( 'ar_namespace' => $this->list->title
->getNamespace(),
1291 'ar_title' => $this->list->title
->getDBkey(),
1292 // use timestamp for index
1293 'ar_timestamp' => $this->row
->ar_timestamp
,
1294 'ar_rev_id' => $this->row
->ar_rev_id
,
1295 'ar_deleted' => $this->getBits()
1298 return (bool)$dbw->affectedRows();
1301 protected function getRevisionLink() {
1303 $undelete = SpecialPage
::getTitleFor( 'Undelete' );
1304 $date = $wgLang->timeanddate( $this->revision
->getTimestamp(), true );
1305 if ( $this->isDeleted() && !$this->canView() ) {
1308 return $this->special
->skin
->link( $undelete, $date, array(),
1310 'target' => $this->list->title
->getPrefixedText(),
1311 'timestamp' => $this->revision
->getTimestamp()
1315 protected function getDiffLink() {
1316 if ( $this->isDeleted() && !$this->canView() ) {
1317 return wfMsgHtml( 'diff' );
1319 $undelete = SpecialPage
::getTitleFor( 'Undelete' );
1320 return $this->special
->skin
->link( $undelete, wfMsgHtml('diff'), array(),
1322 'target' => $this->list->title
->getPrefixedText(),
1324 'timestamp' => $this->revision
->getTimestamp()
1330 * List for oldimage table items
1332 class RevDel_FileList
extends RevDel_List
{
1333 var $type = 'oldimage';
1334 var $idField = 'oi_archive_name';
1335 var $dateField = 'oi_timestamp';
1336 var $authorIdField = 'oi_user';
1337 var $authorNameField = 'oi_user_text';
1338 var $storeBatch, $deleteBatch, $cleanupBatch;
1340 public function doQuery( $db ) {
1341 $archiveName = array();
1342 foreach( $this->ids
as $timestamp ) {
1343 $archiveNames[] = $timestamp . '!' . $this->title
->getDBkey();
1345 return $db->select( 'oldimage', '*',
1347 'oi_name' => $this->title
->getDBkey(),
1348 'oi_archive_name' => $archiveNames
1354 public function newItem( $row ) {
1355 return new RevDel_FileItem( $this, $row );
1358 public function clearFileOps() {
1359 $this->deleteBatch
= array();
1360 $this->storeBatch
= array();
1361 $this->cleanupBatch
= array();
1364 public function doPreCommitUpdates() {
1365 $status = Status
::newGood();
1366 $repo = RepoGroup
::singleton()->getLocalRepo();
1367 if ( $this->storeBatch
) {
1368 $status->merge( $repo->storeBatch( $this->storeBatch
, FileRepo
::OVERWRITE_SAME
) );
1370 if ( !$status->isOK() ) {
1373 if ( $this->deleteBatch
) {
1374 $status->merge( $repo->deleteBatch( $this->deleteBatch
) );
1376 if ( !$status->isOK() ) {
1377 // Running cleanupDeletedBatch() after a failed storeBatch() with the DB already
1378 // modified (but destined for rollback) causes data loss
1381 if ( $this->cleanupBatch
) {
1382 $status->merge( $repo->cleanupDeletedBatch( $this->cleanupBatch
) );
1387 public function doPostCommitUpdates() {
1388 $file = wfLocalFile( $this->title
);
1389 $file->purgeCache();
1390 $file->purgeDescription();
1391 return Status
::newGood();
1394 public function getSuppressBit() {
1395 return File
::DELETED_RESTRICTED
;
1400 * Item class for an oldimage table row
1402 class RevDel_FileItem
extends RevDel_Item
{
1405 public function __construct( $list, $row ) {
1406 parent
::__construct( $list, $row );
1407 $this->file
= RepoGroup
::singleton()->getLocalRepo()->newFileFromRow( $row );
1410 public function getId() {
1411 $parts = explode( '!', $this->row
->oi_archive_name
);
1415 public function canView() {
1416 return $this->file
->userCan( File
::DELETED_RESTRICTED
);
1419 public function getBits() {
1420 return $this->file
->getVisibility();
1423 public function setBits( $bits ) {
1425 # FIXME: move to LocalFile.php
1426 if ( $this->isDeleted() ) {
1427 if ( $bits & File
::DELETED_FILE
) {
1431 $key = $this->file
->getStorageKey();
1432 $srcRel = $this->file
->repo
->getDeletedHashPath( $key ) . $key;
1433 $this->list->storeBatch
[] = array(
1434 $this->file
->repo
->getVirtualUrl( 'deleted' ) . '/' . $srcRel,
1436 $this->file
->getRel()
1438 $this->list->cleanupBatch
[] = $key;
1440 } elseif ( $bits & File
::DELETED_FILE
) {
1442 $key = $this->file
->getStorageKey();
1443 $dstRel = $this->file
->repo
->getDeletedHashPath( $key ) . $key;
1444 $this->list->deleteBatch
[] = array( $this->file
->getRel(), $dstRel );
1447 # Do the database operations
1448 $dbw = wfGetDB( DB_MASTER
);
1449 $dbw->update( 'oldimage',
1450 array( 'oi_deleted' => $bits ),
1452 'oi_name' => $this->row
->oi_name
,
1453 'oi_timestamp' => $this->row
->oi_timestamp
,
1454 'oi_deleted' => $this->getBits()
1458 return (bool)$dbw->affectedRows();
1461 public function isDeleted() {
1462 return $this->file
->isDeleted( File
::DELETED_FILE
);
1466 * Get the link to the file.
1467 * Overridden by RevDel_ArchivedFileItem.
1469 protected function getLink() {
1471 $date = $wgLang->timeanddate( $this->file
->getTimestamp(), true );
1472 if ( $this->isDeleted() ) {
1474 if ( !$this->canView() ) {
1477 $link = $this->special
->skin
->link(
1478 $this->special
->getTitle(),
1481 'target' => $this->list->title
->getPrefixedText(),
1482 'file' => $this->file
->sha1
. '.' . $this->file
->getExtension()
1486 return '<span class="history-deleted">' . $link . '</span>';
1489 $url = $this->file
->getUrl();
1490 return Xml
::element( 'a', array( 'href' => $this->file
->getUrl() ), $date );
1494 * Generate a user tool link cluster if the current user is allowed to view it
1495 * @return string HTML
1497 protected function getUserTools() {
1498 if( $this->file
->userCan( Revision
::DELETED_USER
) ) {
1499 $link = $this->special
->skin
->userLink( $this->file
->user
, $this->file
->user_text
) .
1500 $this->special
->skin
->userToolLinks( $this->file
->user
, $this->file
->user_text
);
1502 $link = wfMsgHtml( 'rev-deleted-user' );
1504 if( $this->file
->isDeleted( Revision
::DELETED_USER
) ) {
1505 return '<span class="history-deleted">' . $link . '</span>';
1511 * Wrap and format the file's comment block, if the current
1512 * user is allowed to view it.
1514 * @return string HTML
1516 protected function getComment() {
1517 if( $this->file
->userCan( File
::DELETED_COMMENT
) ) {
1518 $block = $this->special
->skin
->commentBlock( $this->file
->description
);
1520 $block = ' ' . wfMsgHtml( 'rev-deleted-comment' );
1522 if( $this->file
->isDeleted( File
::DELETED_COMMENT
) ) {
1523 return "<span class=\"history-deleted\">$block</span>";
1528 public function getHTML() {
1533 $wgLang->formatNum( $this->file
->getWidth() ),
1534 $wgLang->formatNum( $this->file
->getHeight() )
1537 wfMsgExt( 'nbytes', 'parsemag', $wgLang->formatNum( $this->file
->getSize() ) ) .
1539 $pageLink = $this->getLink();
1541 return '<li>' . $this->getLink() . ' ' . $this->getUserTools() . ' ' .
1542 $data . ' ' . $this->getComment(). '</li>';
1547 * List for filearchive table items
1549 class RevDel_ArchivedFileList
extends RevDel_FileList
{
1550 var $type = 'filearchive';
1551 var $idField = 'fa_id';
1552 var $dateField = 'fa_timestamp';
1553 var $authorIdField = 'fa_user';
1554 var $authorNameField = 'fa_user_text';
1556 public function doQuery( $db ) {
1557 $ids = array_map( 'intval', $this->ids
);
1558 return $db->select( 'filearchive', '*',
1560 'fa_name' => $this->title
->getDBkey(),
1567 public function newItem( $row ) {
1568 return new RevDel_ArchivedFileItem( $this, $row );
1573 * Item class for a filearchive table row
1575 class RevDel_ArchivedFileItem
extends RevDel_FileItem
{
1576 public function __construct( $list, $row ) {
1577 RevDel_Item
::__construct( $list, $row );
1578 $this->file
= ArchivedFile
::newFromRow( $row );
1581 public function getId() {
1582 return $this->row
->fa_id
;
1585 public function setBits( $bits ) {
1586 $dbw = wfGetDB( DB_MASTER
);
1587 $dbw->update( 'filearchive',
1588 array( 'fa_deleted' => $bits ),
1590 'fa_id' => $this->row
->fa_id
,
1591 'fa_deleted' => $this->getBits(),
1595 return (bool)$dbw->affectedRows();
1598 protected function getLink() {
1599 global $wgLang, $wgUser;
1600 $date = $wgLang->timeanddate( $this->file
->getTimestamp(), true );
1601 $undelete = SpecialPage
::getTitleFor( 'Undelete' );
1602 $key = $this->file
->getKey();
1603 return $this->special
->skin
->link( $undelete, $date, array(),
1605 'target' => $this->list->title
->getPrefixedText(),
1607 'token' => $wgUser->editToken( $key )
1614 * List for logging table items
1616 class RevDel_LogList
extends RevDel_List
{
1617 var $type = 'logging';
1618 var $idField = 'log_id';
1619 var $dateField = 'log_timestamp';
1620 var $authorIdField = 'log_user';
1621 var $authorNameField = 'log_user_text';
1623 public function doQuery( $db ) {
1624 global $wgMessageCache;
1625 $wgMessageCache->loadAllMessages();
1626 $ids = array_map( 'intval', $this->ids
);
1627 return $db->select( 'logging', '*',
1628 array( 'log_id' => $ids ),
1633 public function newItem( $row ) {
1634 return new RevDel_LogItem( $this, $row );
1637 public function getSuppressBit() {
1638 return Revision
::DELETED_RESTRICTED
;
1641 public function getLogAction() {
1645 public function getLogParams( $params ) {
1647 implode( ',', $params['ids'] ),
1648 "ofield={$params['oldBits']}",
1649 "nfield={$params['newBits']}"
1655 * Item class for a logging table row
1657 class RevDel_LogItem
extends RevDel_Item
{
1658 public function canView() {
1659 return LogEventsList
::userCan( $this->row
, Revision
::DELETED_RESTRICTED
);
1662 public function getBits() {
1663 return $this->row
->log_deleted
;
1666 public function setBits( $bits ) {
1667 $dbw = wfGetDB( DB_MASTER
);
1668 $dbw->update( 'recentchanges',
1670 'rc_deleted' => $bits,
1674 'rc_logid' => $this->row
->log_id
,
1675 'rc_timestamp' => $this->row
->log_timestamp
// index
1679 $dbw->update( 'logging',
1680 array( 'log_deleted' => $bits ),
1682 'log_id' => $this->row
->log_id
,
1683 'log_deleted' => $this->getBits()
1687 return (bool)$dbw->affectedRows();
1690 public function getHTML() {
1693 $date = htmlspecialchars( $wgLang->timeanddate( $this->row
->log_timestamp
) );
1694 $paramArray = LogPage
::extractParams( $this->row
->log_params
);
1695 $title = Title
::makeTitle( $this->row
->log_namespace
, $this->row
->log_title
);
1697 // Log link for this page
1698 $loglink = $this->special
->skin
->link(
1699 SpecialPage
::getTitleFor( 'Log' ),
1702 array( 'page' => $title->getPrefixedText() )
1705 if( !$this->canView() ) {
1706 $action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
1708 $action = LogPage
::actionText( $this->row
->log_type
, $this->row
->log_action
, $title,
1709 $this->special
->skin
, $paramArray, true, true );
1710 if( $this->row
->log_deleted
& LogPage
::DELETED_ACTION
)
1711 $action = '<span class="history-deleted">' . $action . '</span>';
1714 $userLink = $this->special
->skin
->userLink( $this->row
->log_user
,
1715 User
::WhoIs( $this->row
->log_user
) );
1716 if( LogEventsList
::isDeleted($this->row
,LogPage
::DELETED_USER
) ) {
1717 $userLink = '<span class="history-deleted">' . $userLink . '</span>';
1720 $comment = $wgLang->getDirMark() . $this->special
->skin
->commentBlock( $this->row
->log_comment
);
1721 if( LogEventsList
::isDeleted($this->row
,LogPage
::DELETED_COMMENT
) ) {
1722 $comment = '<span class="history-deleted">' . $comment . '</span>';
1724 return "<li>($loglink) $date $userLink $action $comment</li>";