2 # Copyright (C) 2004 Brion Vibber <brion@pobox.com>, 2008 Aaron Schulz
3 # http://www.mediawiki.org/
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc.,
17 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 # http://www.gnu.org/copyleft/gpl.html
21 const NO_ACTION_LINK
= 1;
27 public function __construct( $skin, $out, $flags = 0 ) {
30 $this->flags
= $flags;
31 $this->preCacheMessages();
35 * As we use the same small set of messages in various methods and that
36 * they are called often, we call them once and save them in $this->message
38 private function preCacheMessages() {
39 // Precache various messages
40 if( !isset( $this->message
) ) {
41 $messages = array( 'revertmerge', 'protect_change', 'unblocklink', 'change-blocklink',
42 'revertmove', 'undeletelink', 'revdel-restore', 'rev-delundel', 'hist', 'pipe-separator' );
43 foreach( $messages as $msg ) {
44 $this->message
[$msg] = wfMsgExt( $msg, array( 'escape' ) );
50 * Set page title and show header for this log type
53 public function showHeader( $type ) {
54 if( LogPage
::isLogType( $type ) ) {
55 $this->out
->setPageTitle( LogPage
::logName( $type ) );
56 $this->out
->addHTML( LogPage
::logHeader( $type ) );
61 * Show options for the log list
65 * @param $pattern String
66 * @param $year Integer: year
67 * @param $month Integer: month
68 * @param $filter Boolean
70 public function showOptions( $type = '', $user = '', $page = '', $pattern = '', $year = '',
71 $month = '', $filter = null, $tagFilter='' )
73 global $wgScript, $wgMiserMode;
74 $action = htmlspecialchars( $wgScript );
75 $title = SpecialPage
::getTitleFor( 'Log' );
76 $special = htmlspecialchars( $title->getPrefixedDBkey() );
78 $this->out
->addHTML( "<form action=\"$action\" method=\"get\"><fieldset>" .
79 Xml
::element( 'legend', array(), wfMsg( 'log' ) ) .
80 Xml
::hidden( 'title', $special ) . "\n" .
81 $this->getTypeMenu( $type ) . "\n" .
82 $this->getUserInput( $user ) . "\n" .
83 $this->getTitleInput( $page ) . "\n" .
84 ( !$wgMiserMode ?
($this->getTitlePattern( $pattern )."\n") : "" ) .
85 "<p>" . $this->getDateMenu( $year, $month ) . "\n" .
86 Xml
::tags( 'p', null, implode( ' ', ChangeTags
::buildTagFilterSelector( $tagFilter ) ) ) . "\n" .
87 ( $filter ?
"</p><p>".$this->getFilterLinks( $type, $filter )."\n" : "" ) . "\n" .
88 Xml
::submitButton( wfMsg( 'allpagessubmit' ) ) . "</p>\n" .
93 private function getFilterLinks( $logType, $filter ) {
96 $messages = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) );
97 // Option value -> message mapping
99 foreach( $filter as $type => $val ) {
100 $hideVal = 1 - intval($val);
101 $link = $this->skin
->makeKnownLinkObj( $wgTitle, $messages[$hideVal],
102 wfArrayToCGI( array( "hide_{$type}_log" => $hideVal ), $this->getDefaultQuery() )
104 $links[$type] = wfMsgHtml( "log-show-hide-{$type}", $link );
107 return implode( ' | ', $links );
110 private function getDefaultQuery() {
111 if ( !isset( $this->mDefaultQuery
) ) {
112 $this->mDefaultQuery
= $_GET;
113 unset( $this->mDefaultQuery
['title'] );
114 unset( $this->mDefaultQuery
['dir'] );
115 unset( $this->mDefaultQuery
['offset'] );
116 unset( $this->mDefaultQuery
['limit'] );
117 unset( $this->mDefaultQuery
['order'] );
118 unset( $this->mDefaultQuery
['month'] );
119 unset( $this->mDefaultQuery
['year'] );
121 return $this->mDefaultQuery
;
125 * @param $queryType String
126 * @return String: Formatted HTML
128 private function getTypeMenu( $queryType ) {
129 global $wgLogRestrictions, $wgUser;
131 $html = "<select name='type'>\n";
133 $validTypes = LogPage
::validTypes();
134 $typesByName = array(); // Temporary array
136 // First pass to load the log names
137 foreach( $validTypes as $type ) {
138 $text = LogPage
::logName( $type );
139 $typesByName[$text] = $type;
142 // Second pass to sort by name
145 // Third pass generates sorted XHTML content
146 foreach( $typesByName as $text => $type ) {
147 $selected = ($type == $queryType);
149 if ( isset($wgLogRestrictions[$type]) ) {
150 if ( $wgUser->isAllowed( $wgLogRestrictions[$type] ) ) {
151 $html .= Xml
::option( $text, $type, $selected ) . "\n";
154 $html .= Xml
::option( $text, $type, $selected ) . "\n";
158 $html .= '</select>';
163 * @param $user String
164 * @return String: Formatted HTML
166 private function getUserInput( $user ) {
167 return Xml
::inputLabel( wfMsg( 'specialloguserlabel' ), 'user', 'user', 15, $user );
171 * @param $title String
172 * @return String: Formatted HTML
174 private function getTitleInput( $title ) {
175 return Xml
::inputLabel( wfMsg( 'speciallogtitlelabel' ), 'page', 'page', 20, $title );
179 * @param $year Integer
180 * @param $month Integer
181 * @return string Formatted HTML
183 private function getDateMenu( $year, $month ) {
184 # Offset overrides year/month selection
185 if( $month && $month !== -1 ) {
186 $encMonth = intval( $month );
191 $encYear = intval( $year );
192 } else if( $encMonth ) {
193 $thisMonth = intval( gmdate( 'n' ) );
194 $thisYear = intval( gmdate( 'Y' ) );
195 if( intval($encMonth) > $thisMonth ) {
198 $encYear = $thisYear;
202 return Xml
::label( wfMsg( 'year' ), 'year' ) . ' '.
203 Xml
::input( 'year', 4, $encYear, array('id' => 'year', 'maxlength' => 4) ) .
205 Xml
::label( wfMsg( 'month' ), 'month' ) . ' '.
206 Xml
::monthSelector( $encMonth, -1 );
210 * @return boolean Checkbox
212 private function getTitlePattern( $pattern ) {
213 return '<span style="white-space: nowrap">' .
214 Xml
::checkLabel( wfMsg( 'log-title-wildcard' ), 'pattern', 'pattern', $pattern ) .
218 public function beginLogEventsList() {
222 public function endLogEventsList() {
227 * @param $row Row: a single row from the result set
228 * @return String: Formatted HTML list item
230 public function logLine( $row ) {
231 global $wgLang, $wgUser, $wgContLang;
233 $title = Title
::makeTitle( $row->log_namespace
, $row->log_title
);
234 $classes = array( "mw-logline-{$row->log_type}" );
235 $time = $wgLang->timeanddate( wfTimestamp(TS_MW
, $row->log_timestamp
), true );
237 if( self
::isDeleted($row,LogPage
::DELETED_USER
) ) {
238 $userLink = '<span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>';
240 $userLink = $this->skin
->userLink( $row->log_user
, $row->user_name
) .
241 $this->skin
->userToolLinks( $row->log_user
, $row->user_name
, true, 0, $row->user_editcount
);
244 if( self
::isDeleted($row,LogPage
::DELETED_COMMENT
) ) {
245 $comment = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-comment') . '</span>';
247 $comment = $wgContLang->getDirMark() . $this->skin
->commentBlock( $row->log_comment
);
249 // Extract extra parameters
250 $paramArray = LogPage
::extractParams( $row->log_params
);
252 // Some user can hide log items and have review links
253 if( $wgUser->isAllowed( 'deleterevision' ) ) {
254 $del = $this->getShowHideLinks( $row ) . ' ';
256 // Add review links and such...
257 if( ($this->flags
& self
::NO_ACTION_LINK
) ||
($row->log_deleted
& LogPage
::DELETED_ACTION
) ) {
258 // Action text is suppressed...
259 } else if( self
::typeAction($row,'move','move','move') && !empty($paramArray[0]) ) {
260 $destTitle = Title
::newFromText( $paramArray[0] );
262 $revert = '(' . $this->skin
->makeKnownLinkObj( SpecialPage
::getTitleFor( 'Movepage' ),
263 $this->message
['revertmove'],
264 'wpOldTitle=' . urlencode( $destTitle->getPrefixedDBkey() ) .
265 '&wpNewTitle=' . urlencode( $title->getPrefixedDBkey() ) .
266 '&wpReason=' . urlencode( wfMsgForContent( 'revertmove' ) ) .
267 '&wpMovetalk=0' ) . ')';
269 // Show undelete link
270 } else if( self
::typeAction($row,array('delete','suppress'),'delete','delete') ) {
271 $revert = '(' . $this->skin
->makeKnownLinkObj( SpecialPage
::getTitleFor( 'Undelete' ),
272 $this->message
['undeletelink'], 'target='. urlencode( $title->getPrefixedDBkey() ) ) . ')';
273 // Show unblock/change block link
274 } else if( self
::typeAction($row,array('block','suppress'),array('block','reblock'),'block') ) {
276 $this->skin
->link( SpecialPage
::getTitleFor( 'Ipblocklist' ),
277 $this->message
['unblocklink'],
279 array( 'action' => 'unblock', 'ip' => $row->log_title
),
281 . ' ' . $this->message
['pipe-separator'] . ' ' .
282 $this->skin
->link( SpecialPage
::getTitleFor( 'Blockip', $row->log_title
),
283 $this->message
['change-blocklink'],
284 array(), array(), 'known' ) .
286 // Show change protection link
287 } else if( self
::typeAction( $row, 'protect', array( 'modify', 'protect', 'unprotect' ) ) ) {
289 $this->skin
->link( $title,
290 $this->message
['hist'],
292 array( 'action' => 'history', 'offset' => $row->log_timestamp
) );
293 if( $wgUser->isAllowed( 'protect' ) ) {
294 $revert .= ' ' . $this->message
['pipe-separator'] . ' ' .
295 $this->skin
->link( $title,
296 $this->message
['protect_change'],
298 array( 'action' => 'protect' ),
303 } else if( self
::typeAction($row,'merge','merge','mergehistory') ) {
304 $merge = SpecialPage
::getTitleFor( 'Mergehistory' );
305 $revert = '(' . $this->skin
->makeKnownLinkObj( $merge, $this->message
['revertmerge'],
306 wfArrayToCGI( array('target' => $paramArray[0], 'dest' => $title->getPrefixedDBkey(),
307 'mergepoint' => $paramArray[1] ) ) ) . ')';
308 // If an edit was hidden from a page give a review link to the history
309 } else if( self
::typeAction($row,array('delete','suppress'),'revision','deleterevision') ) {
310 if( count($paramArray) == 2 ) {
311 $revdel = SpecialPage
::getTitleFor( 'Revisiondelete' );
312 // Different revision types use different URL params...
313 $key = $paramArray[0];
314 // Link to each hidden object ID, $paramArray[1] is the url param
315 $Ids = explode( ',', $paramArray[1] );
317 foreach( $Ids as $n => $id ) {
318 $revParams .= '&' . urlencode($key) . '[]=' . urlencode($id);
320 $revert = '(' . $this->skin
->makeKnownLinkObj( $revdel, $this->message
['revdel-restore'],
321 'target=' . $title->getPrefixedUrl() . $revParams ) . ')';
323 // Hidden log items, give review link
324 } else if( self
::typeAction($row,array('delete','suppress'),'event','deleterevision') ) {
325 if( count($paramArray) == 1 ) {
326 $revdel = SpecialPage
::getTitleFor( 'Revisiondelete' );
327 $Ids = explode( ',', $paramArray[0] );
328 // Link to each hidden object ID, $paramArray[1] is the url param
330 foreach( $Ids as $n => $id ) {
331 $logParams .= '&logid[]=' . intval($id);
333 $revert = '(' . $this->skin
->makeKnownLinkObj( $revdel, $this->message
['revdel-restore'],
334 'target=' . $title->getPrefixedUrl() . $logParams ) . ')';
336 // Self-created users
337 } else if( self
::typeAction($row,'newusers','create2') ) {
338 if( isset( $paramArray[0] ) ) {
339 $revert = $this->skin
->userToolLinks( $paramArray[0], $title->getDBkey(), true );
341 # Fall back to a blue contributions link
342 $revert = $this->skin
->userToolLinks( 1, $title->getDBkey() );
344 if( $time < '20080129000000' ) {
345 # Suppress $comment from old entries (before 2008-01-29),
346 # not needed and can contain incorrect links
349 // Do nothing. The implementation is handled by the hook modifiying the passed-by-ref parameters.
351 wfRunHooks( 'LogLine', array( $row->log_type
, $row->log_action
, $title, $paramArray,
352 &$comment, &$revert, $row->log_timestamp
) );
355 if( self
::isDeleted($row,LogPage
::DELETED_ACTION
) ) {
356 $action = '<span class="history-deleted">' . wfMsgHtml('rev-deleted-event') . '</span>';
358 $action = LogPage
::actionText( $row->log_type
, $row->log_action
, $title,
359 $this->skin
, $paramArray, true );
363 list($tagDisplay, $newClasses) = ChangeTags
::formatSummaryRow( $row->ts_tags
, 'logevent' );
364 $classes = array_merge( $classes, $newClasses );
366 if( $revert != '' ) {
367 $revert = '<span class="mw-logevent-actionlink">' . $revert . '</span>';
370 return Xml
::tags( 'li', array( "class" => implode( ' ', $classes ) ),
371 $del . $time . ' ' . $userLink . ' ' . $action . ' ' . $comment . ' ' . $revert . " $tagDisplay" ) . "\n";
378 private function getShowHideLinks( $row ) {
379 $revdel = SpecialPage
::getTitleFor( 'Revisiondelete' );
380 // If event was hidden from sysops
381 if( !self
::userCan( $row, LogPage
::DELETED_RESTRICTED
) ) {
382 $del = Xml
::tags( 'span', array( 'class'=>'mw-revdelundel-link' ), '('.$this->message
['rev-delundel'].')' );
383 } else if( $row->log_type
== 'suppress' ) {
384 // No one should be hiding from the oversight log
385 $del = Xml
::tags( 'span', array( 'class'=>'mw-revdelundel-link' ), '('.$this->message
['rev-delundel'].')' );
387 $target = SpecialPage
::getTitleFor( 'Log', $row->log_type
);
388 $query = array( 'target' => $target->getPrefixedUrl(),
389 'logid' => $row->log_id
391 $del = $this->skin
->revDeleteLink( $query, self
::isDeleted( $row, LogPage
::DELETED_RESTRICTED
) );
398 * @param $type Mixed: string/array
399 * @param $action Mixed: string/array
400 * @param $right string
403 public static function typeAction( $row, $type, $action, $right='' ) {
404 $match = is_array($type) ?
in_array($row->log_type
,$type) : $row->log_type
== $type;
406 $match = is_array($action) ?
407 in_array($row->log_action
,$action) : $row->log_action
== $action;
408 if( $match && $right ) {
410 $match = $wgUser->isAllowed( $right );
417 * Determine if the current user is allowed to view a particular
418 * field of this log row, if it's marked as deleted.
420 * @param $field Integer
423 public static function userCan( $row, $field ) {
424 if( ( $row->log_deleted
& $field ) == $field ) {
426 $permission = ( $row->log_deleted
& LogPage
::DELETED_RESTRICTED
) == LogPage
::DELETED_RESTRICTED
429 wfDebug( "Checking for $permission due to $field match on $row->log_deleted\n" );
430 return $wgUser->isAllowed( $permission );
438 * @param $field Integer: one of DELETED_* bitfield constants
441 public static function isDeleted( $row, $field ) {
442 return ($row->log_deleted
& $field) == $field;
446 * Quick function to show a short log extract
447 * @param $out OutputPage
448 * @param $type String
449 * @param $page String
450 * @param $user String
451 * @param $lim Integer
452 * @param $conds Array
454 public static function showLogExtract( $out, $type='', $page='', $user='', $lim=0, $conds=array() ) {
456 # Insert list of top 50 or so items
457 $loglist = new LogEventsList( $wgUser->getSkin(), $out, 0 );
458 $pager = new LogPager( $loglist, $type, $user, $page, '', $conds );
459 if( $lim > 0 ) $pager->mLimit
= $lim;
460 $logBody = $pager->getBody();
463 $loglist->beginLogEventsList() .
465 $loglist->endLogEventsList()
468 $out->addWikiMsg( 'logempty' );
470 return $pager->getNumRows();
474 * SQL clause to skip forbidden log types for this user
475 * @param $db Database
476 * @return mixed (string or false)
478 public static function getExcludeClause( $db ) {
479 global $wgLogRestrictions, $wgUser;
480 // Reset the array, clears extra "where" clauses when $par is used
481 $hiddenLogs = array();
482 // Don't show private logs to unprivileged users
483 foreach( $wgLogRestrictions as $logType => $right ) {
484 if( !$wgUser->isAllowed($right) ) {
485 $safeType = $db->strencode( $logType );
486 $hiddenLogs[] = $safeType;
489 if( count($hiddenLogs) == 1 ) {
490 return 'log_type != ' . $db->addQuotes( $hiddenLogs[0] );
491 } elseif( $hiddenLogs ) {
492 return 'log_type NOT IN (' . $db->makeList($hiddenLogs) . ')';
501 class LogPager
extends ReverseChronologicalPager
{
502 private $type = '', $user = '', $title = '', $pattern = '';
503 public $mLogEventsList;
507 * @param $list LogEventsList
508 * @param $type String
509 * @param $user String
510 * @param $title String
511 * @param $pattern String
512 * @param $conds Array
513 * @param $year Integer
514 * @param $month Integer
516 public function __construct( $list, $type = '', $user = '', $title = '', $pattern = '',
517 $conds = array(), $year = false, $month = false, $tagFilter = '' )
519 parent
::__construct();
520 $this->mConds
= $conds;
522 $this->mLogEventsList
= $list;
524 $this->limitType( $type );
525 $this->limitUser( $user );
526 $this->limitTitle( $title, $pattern );
527 $this->getDateCond( $year, $month );
528 $this->mTagFilter
= $tagFilter;
531 public function getDefaultQuery() {
532 $query = parent
::getDefaultQuery();
533 $query['type'] = $this->type
;
534 $query['user'] = $this->user
;
535 $query['month'] = $this->mMonth
;
536 $query['year'] = $this->mYear
;
540 public function getFilterParams() {
541 global $wgFilterLogTypes, $wgUser, $wgRequest;
546 foreach( $wgFilterLogTypes as $type => $default ) {
547 // Avoid silly filtering
548 if( $type !== 'patrol' ||
$wgUser->useNPPatrol() ) {
549 $hide = $wgRequest->getInt( "hide_{$type}_log", $default );
550 $filters[$type] = $hide;
552 $this->mConds
[] = 'log_type != ' . $this->mDb
->addQuotes( $type );
559 * Set the log reader to return only entries of the given type.
560 * Type restrictions enforced here
561 * @param $type String: A log type ('upload', 'delete', etc)
563 private function limitType( $type ) {
564 global $wgLogRestrictions, $wgUser;
565 // Don't even show header for private logs; don't recognize it...
566 if( isset($wgLogRestrictions[$type]) && !$wgUser->isAllowed($wgLogRestrictions[$type]) ) {
569 // Don't show private logs to unpriviledged users
570 $hideLogs = LogEventsList
::getExcludeClause( $this->mDb
);
571 if( $hideLogs !== false ) {
572 $this->mConds
[] = $hideLogs;
578 $this->mConds
['log_type'] = $type;
582 * Set the log reader to return only entries by the given user.
583 * @param $name String: (In)valid user name
585 private function limitUser( $name ) {
589 $usertitle = Title
::makeTitleSafe( NS_USER
, $name );
590 if( is_null($usertitle) ) {
593 /* Fetch userid at first, if known, provides awesome query plan afterwards */
594 $userid = User
::idFromName( $name );
596 /* It should be nicer to abort query at all,
597 but for now it won't pass anywhere behind the optimizer */
598 $this->mConds
[] = "NULL";
600 $this->mConds
['log_user'] = $userid;
601 $this->user
= $usertitle->getText();
606 * Set the log reader to return only entries affecting the given page.
607 * (For the block and rights logs, this is a user page.)
608 * @param $page String: Title name as text
609 * @param $pattern String
611 private function limitTitle( $page, $pattern ) {
614 $title = Title
::newFromText( $page );
615 if( strlen($page) == 0 ||
!$title instanceof Title
)
618 $this->title
= $title->getPrefixedText();
619 $ns = $title->getNamespace();
620 # Using the (log_namespace, log_title, log_timestamp) index with a
621 # range scan (LIKE) on the first two parts, instead of simple equality,
622 # makes it unusable for sorting. Sorted retrieval using another index
623 # would be possible, but then we might have to scan arbitrarily many
624 # nodes of that index. Therefore, we need to avoid this if $wgMiserMode
627 # This is not a problem with simple title matches, because then we can
628 # use the page_time index. That should have no more than a few hundred
629 # log entries for even the busiest pages, so it can be safely scanned
630 # in full to satisfy an impossible condition on user or similar.
631 if( $pattern && !$wgMiserMode ) {
632 # use escapeLike to avoid expensive search patterns like 't%st%'
633 $safetitle = $this->mDb
->escapeLike( $title->getDBkey() );
634 $this->mConds
['log_namespace'] = $ns;
635 $this->mConds
[] = "log_title LIKE '$safetitle%'";
636 $this->pattern
= $pattern;
638 $this->mConds
['log_namespace'] = $ns;
639 $this->mConds
['log_title'] = $title->getDBkey();
643 public function getQueryInfo() {
644 $this->mConds
[] = 'user_id = log_user';
645 # Don't use the wrong logging index
646 if( $this->title ||
$this->pattern ||
$this->user
) {
647 $index = array( 'USE INDEX' => array( 'logging' => array('page_time','user_time') ) );
648 } else if( $this->type
) {
649 $index = array( 'USE INDEX' => array( 'logging' => 'type_time' ) );
651 $index = array( 'USE INDEX' => array( 'logging' => 'times' ) );
654 'tables' => array( 'logging', 'user' ),
655 'fields' => array( 'log_type', 'log_action', 'log_user', 'log_namespace', 'log_title', 'log_params',
656 'log_comment', 'log_id', 'log_deleted', 'log_timestamp', 'user_name', 'user_editcount' ),
657 'conds' => $this->mConds
,
659 'join_conds' => array( 'user' => array( 'INNER JOIN', 'user_id=log_user' ) ),
662 ChangeTags
::modifyDisplayQuery( $info['tables'], $info['fields'], $info['conds'], $info['join_conds'], $this->mTagFilter
);
667 function getIndexField() {
668 return 'log_timestamp';
671 public function getStartBody() {
672 wfProfileIn( __METHOD__
);
673 # Do a link batch query
674 if( $this->getNumRows() > 0 ) {
676 while( $row = $this->mResult
->fetchObject() ) {
677 $lb->add( $row->log_namespace
, $row->log_title
);
678 $lb->addObj( Title
::makeTitleSafe( NS_USER
, $row->user_name
) );
679 $lb->addObj( Title
::makeTitleSafe( NS_USER_TALK
, $row->user_name
) );
682 $this->mResult
->seek( 0 );
684 wfProfileOut( __METHOD__
);
688 public function formatRow( $row ) {
689 return $this->mLogEventsList
->logLine( $row );
692 public function getType() {
696 public function getUser() {
700 public function getPage() {
704 public function getPattern() {
705 return $this->pattern
;
708 public function getYear() {
712 public function getMonth() {
713 return $this->mMonth
;
716 public function getTagFilter() {
717 return $this->mTagFilter
;
723 * @ingroup SpecialPage
728 * @param $request WebRequest: for internal use use a FauxRequest object to pass arbitrary parameters.
730 function __construct( $request ) {
731 global $wgUser, $wgOut;
732 wfDeprecated(__METHOD__
);
734 $type = $request->getVal( 'type' );
735 $user = $request->getText( 'user' );
736 $title = $request->getText( 'page' );
737 $pattern = $request->getBool( 'pattern' );
738 $year = $request->getIntOrNull( 'year' );
739 $month = $request->getIntOrNull( 'month' );
740 $tagFilter = $request->getVal( 'tagfilter' );
741 # Don't let the user get stuck with a certain date
742 $skip = $request->getText( 'offset' ) ||
$request->getText( 'dir' ) == 'prev';
747 # Use new list class to output results
748 $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 );
749 $this->pager
= new LogPager( $loglist, $type, $user, $title, $pattern, $year, $month, $tagFilter );
753 * Is there at least one row?
756 public function hasRows() {
757 return isset($this->pager
) ?
($this->pager
->getNumRows() > 0) : false;
763 * @ingroup SpecialPage
766 const NO_ACTION_LINK
= 1;
774 * @param &$reader LogReader: where to get our data from
775 * @param $flags Integer: Bitwise combination of flags:
776 * LogEventsList::NO_ACTION_LINK Don't show restore/unblock/block links
778 function __construct( &$reader, $flags = 0 ) {
780 wfDeprecated(__METHOD__
);
781 $this->reader
=& $reader;
782 $this->reader
->pager
->mLogEventsList
->flags
= $flags;
783 # Aliases for shorter code...
784 $this->pager
=& $this->reader
->pager
;
785 $this->list =& $this->reader
->pager
->mLogEventsList
;
789 * Take over the whole output page in $wgOut with the log display.
791 public function show() {
792 # Set title and add header
793 $this->list->showHeader( $pager->getType() );
795 $this->list->showOptions( $this->pager
->getType(), $this->pager
->getUser(), $this->pager
->getPage(),
796 $this->pager
->getPattern(), $this->pager
->getYear(), $this->pager
->getMonth() );
798 $logBody = $this->pager
->getBody();
801 $this->pager
->getNavigationBar() .
802 $this->list->beginLogEventsList() .
804 $this->list->endLogEventsList() .
805 $this->pager
->getNavigationBar()
808 $wgOut->addWikiMsg( 'logempty' );
813 * Output just the list of entries given by the linked LogReader,
814 * with extraneous UI elements. Use for displaying log fragments in
815 * another page (eg at Special:Undelete)
816 * @param $out OutputPage: where to send output
818 public function showList( &$out ) {
819 $logBody = $this->pager
->getBody();
822 $this->list->beginLogEventsList() .
824 $this->list->endLogEventsList()
827 $out->addWikiMsg( 'logempty' );