$wgOut->wrapWikiMsg( '<div class="mw-userpage-userdoesnotexist error">$1</div>',
array( 'userpage-userdoesnotexist-view', $this->mTitle->getBaseText() ) );
}
-
}
wfRunHooks( 'ShowMissingArticle', array( $this ) );
# Show delete and move logs
- LogEventsList::showLogExtract(
- $wgOut,
- array( 'delete', 'move' ),
- $this->mTitle->getPrefixedText(),
- '',
- 10,
- array( "log_action != 'revision'" ),
- false,
- array( 'moveddeleted-notice' )
+ LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), $this->mTitle->getPrefixedText(), '',
+ array( 'lim' => 10,
+ 'conds' => array( "log_action != 'revision'" ),
+ 'showIfEmpty' => false,
+ 'msgKey' => array( 'moveddeleted-notice' ) )
);
# Show error message
}
# Give a notice if the user is editing a deleted/moved page...
if ( !$this->mTitle->exists() ) {
- LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ),
- $this->mTitle->getPrefixedText(), '', 10, array( "log_action != 'revision'" ), false, 'recreate-moveddeleted-warn');
+ LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), $this->mTitle->getPrefixedText(),
+ '', array( 'lim' => 10,
+ 'conds' => array( "log_action != 'revision'" ),
+ 'showIfEmpty' => false,
+ 'msgKey' => array( 'recreate-moveddeleted-warn') )
+ );
}
}
$noticeMsg = 'protectedpagewarning';
$classes[] = 'mw-textarea-protected';
}
- $wgOut->addHTML( "<div class='mw-warning-with-logexcerpt'>\n" );
- $wgOut->addWikiMsg( $noticeMsg );
- LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '', 1 );
- $wgOut->addHTML( "</div>\n" );
+ LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '',
+ array( 'lim' => 1, 'msgKey' => array( $noticeMsg ) ) );
}
if ( $this->mTitle->isCascadeProtected() ) {
# Is this page under cascading protection from some source pages?
*/
if( !$this->title->exists() ) {
$wgOut->addWikiMsg( 'nohistory' );
- $this->article->showLogs(); // show deletion/move log if there is an entry
+ # show deletion/move log if there is an entry
+ LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), $this->title->getPrefixedText(), '',
+ array( 'lim' => 10,
+ 'conds' => array( "log_action != 'revision'" ),
+ 'showIfEmpty' => false,
+ 'msgKey' => array( 'moveddeleted-notice' ) )
+ );
wfProfileOut( __METHOD__ );
return;
}
* @param $types String or Array
* @param $page String The page title to show log entries for
* @param $user String The user who made the log entries
- * @param $lim Integer Limit of items to show, default is 50
- * @param $conds Array Extra conditions for the query
- * @param $showIfEmpty boolean Set to false if you don't want any output in case the loglist is empty
+ * @param $param Associative Array with the following additional options:
+ * lim Integer Limit of items to show, default is 50
+ * conds Array Extra conditions for the query (e.g. "log_action != 'revision'")
+ * showIfEmpty boolean Set to false if you don't want any output in case the loglist is empty
* if set to true (default), "No matching items in log" is displayed if loglist is empty
- * @param $msgKey Array If you want a nice box with a message, set this
+ * msgKey Array If you want a nice box with a message, set this
* to the key of the message. First element is the message
* key, additional optional elements are parameters for the
* key that are processed with wgMsgExt and option 'parse'
* @return Integer Number of total log items (not limited by $lim)
*/
- public static function showLogExtract( &$out, $types=array(), $page='', $user='', $lim=0, $conds=array(), $showIfEmpty = true, $msgKey = array() ) {
+ public static function showLogExtract( &$out, $types=array(), $page='', $user='',
+ $param = array( 'lim' => 0, 'conds' => array(), 'showIfEmpty' => true, 'msgKey' => array('') ) ) {
+
global $wgUser, $wgOut;
- # Insert list of top 50 or so items
+ # Convert $param array to individual variables
+ $lim = $param['lim'];
+ $conds = $param['conds'];
+ $showIfEmpty = $param['showIfEmpty'];
+ $msgKey = $param['msgKey'];
+ if ( !(is_array($msgKey)) )
+ $msgKey = array( $msgKey );
+ # Insert list of top 50 (or top $lim) items
$loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 );
$pager = new LogPager( $loglist, $types, $user, $page, '', $conds );
if( $lim > 0 ) $pager->mLimit = $lim;
$logBody = $pager->getBody();
$s = '';
if( $logBody ) {
- if ( $msgKey ) {
+ if ( $msgKey[0] ) {
$s = '<div class="mw-warning-with-logexcerpt">';
if ( count( $msgKey ) == 1 ) {
);
}
- if ( $logBody && $msgKey )
+ if ( $logBody && $msgKey[0] )
$s .= '</div>';
if( $out instanceof OutputPage ){
private function showLogFragment( $out, $title ) {
global $wgUser;
- $out->addHTML( Xml::element( 'h2', NULL, LogPage::logName( 'block' ) ) );
- $count = LogEventsList::showLogExtract( $out, 'block', $title->getPrefixedText(), '', 10 );
- if( $count > 10 ) {
- $out->addHTML( $wgUser->getSkin()->link(
- SpecialPage::getTitleFor( 'Log' ),
- wfMsgHtml( 'blocklog-fulllog' ),
- array(),
- array(
- 'type' => 'block',
- 'page' => $title->getPrefixedText() ) ) );
- }
+ LogEventsList::showLogExtract( $out, 'block', $title->getPrefixedText(), '',
+ array( 'lim' => 10, 'msgKey' => array( 'blocklog-showlog' ) ) );
// Add suppression block entries if allowed
- if( $wgUser->isAllowed('hideuser') ) {
- $out->addHTML( Xml::element( 'h2', NULL, LogPage::logName( 'suppress' ) ) );
+ if( $wgUser->isAllowed( 'hideuser' ) ) {
LogEventsList::showLogExtract( $out, 'suppress', $title->getPrefixedText(), '',
- 10, array('log_action' => array('block','reblock','unblock')) );
+ array('lim' => 10, 'conds' => array('log_action' => array('block','reblock','unblock')),
+ 'msgKey' => array( 'blocklog-showsuppresslog' ) ) );
}
}
// Show a note if the user is blocked and display the last block log entry.
if ( User::newFromID( $id )->isBlocked() )
- LogEventsList::showLogExtract( $wgOut, 'block', $nt->getPrefixedText(), '', 1,
- array(), false, 'sp-contributions-blocked-notice' );
+ LogEventsList::showLogExtract( $wgOut, 'block', $nt->getPrefixedText(), '',
+ array( 'lim' => 1, 'showIfEmpty' => false, 'msgKey' => array( 'sp-contributions-blocked-notice' ) ) );
}
// Old message 'contribsub' had one parameter, but that doesn't work for
}
$wgOut->addHTML( "<div class='mw-warning-with-logexcerpt'>\n" );
$wgOut->addWikiMsg( $noticeMsg );
- LogEventsList::showLogExtract( $wgOut, 'protect', $this->oldTitle->getPrefixedText(), '', 1 );
+ LogEventsList::showLogExtract( $wgOut, 'protect', $this->oldTitle->getPrefixedText(), '', array( 'lim' => 1 ) );
$wgOut->addHTML( "</div>\n" );
}
# Show relevant lines from the deletion log
$wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" );
LogEventsList::showLogExtract( $wgOut, 'delete',
- $this->targetObj->getPrefixedText(), '', 25, $qc );
+ $this->targetObj->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) );
# Show relevant lines from the suppression log
if( $wgUser->isAllowed( 'suppressionlog' ) ) {
$wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "</h2>\n" );
LogEventsList::showLogExtract( $wgOut, 'suppress',
- $this->targetObj->getPrefixedText(), '', 25, $qc );
+ $this->targetObj->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) );
}
}
'autoblocker' => 'Autoblocked because your IP address has been recently used by "[[User:$1|$1]]".
The reason given for $1\'s block is: "$2"',
'blocklogpage' => 'Block log',
-'blocklog-fulllog' => 'Full block log',
+'blocklog-showlog' => 'This user has been blocked previously. The block log is provided below for reference:',
+'blocklog-showsuppresslog' => 'This user has been blocked and hidden previously. The suppress log is provided below for reference:',
'blocklogentry' => 'blocked [[$1]] with an expiry time of $2 $3',
'reblock-logentry' => 'changed block settings for [[$1]] with an expiry time of $2 $3',
'blocklogtext' => 'This is a log of user blocking and unblocking actions.
'contribslink',
'autoblocker',
'blocklogpage',
- 'blocklog-fulllog',
+ 'blocklog-showlog',
+ 'blocklog-showsuppresslog',
'blocklogentry',
'reblock-logentry',
'blocklogtext',