Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -1987,7 +1987,8 @@ |
1988 | 1988 | 'contribslink', |
1989 | 1989 | 'autoblocker', |
1990 | 1990 | 'blocklogpage', |
1991 | | - 'blocklog-fulllog', |
| 1991 | + 'blocklog-showlog', |
| 1992 | + 'blocklog-showsuppresslog', |
1992 | 1993 | 'blocklogentry', |
1993 | 1994 | 'reblock-logentry', |
1994 | 1995 | 'blocklogtext', |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -1209,19 +1209,14 @@ |
1210 | 1210 | $wgOut->wrapWikiMsg( '<div class="mw-userpage-userdoesnotexist error">$1</div>', |
1211 | 1211 | array( 'userpage-userdoesnotexist-view', $this->mTitle->getBaseText() ) ); |
1212 | 1212 | } |
1213 | | - |
1214 | 1213 | } |
1215 | 1214 | wfRunHooks( 'ShowMissingArticle', array( $this ) ); |
1216 | 1215 | # Show delete and move logs |
1217 | | - LogEventsList::showLogExtract( |
1218 | | - $wgOut, |
1219 | | - array( 'delete', 'move' ), |
1220 | | - $this->mTitle->getPrefixedText(), |
1221 | | - '', |
1222 | | - 10, |
1223 | | - array( "log_action != 'revision'" ), |
1224 | | - false, |
1225 | | - array( 'moveddeleted-notice' ) |
| 1216 | + LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), $this->mTitle->getPrefixedText(), '', |
| 1217 | + array( 'lim' => 10, |
| 1218 | + 'conds' => array( "log_action != 'revision'" ), |
| 1219 | + 'showIfEmpty' => false, |
| 1220 | + 'msgKey' => array( 'moveddeleted-notice' ) ) |
1226 | 1221 | ); |
1227 | 1222 | |
1228 | 1223 | # Show error message |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -730,8 +730,12 @@ |
731 | 731 | } |
732 | 732 | # Give a notice if the user is editing a deleted/moved page... |
733 | 733 | if ( !$this->mTitle->exists() ) { |
734 | | - LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), |
735 | | - $this->mTitle->getPrefixedText(), '', 10, array( "log_action != 'revision'" ), false, 'recreate-moveddeleted-warn'); |
| 734 | + LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), $this->mTitle->getPrefixedText(), |
| 735 | + '', array( 'lim' => 10, |
| 736 | + 'conds' => array( "log_action != 'revision'" ), |
| 737 | + 'showIfEmpty' => false, |
| 738 | + 'msgKey' => array( 'recreate-moveddeleted-warn') ) |
| 739 | + ); |
736 | 740 | } |
737 | 741 | } |
738 | 742 | |
— | — | @@ -1278,10 +1282,8 @@ |
1279 | 1283 | $noticeMsg = 'protectedpagewarning'; |
1280 | 1284 | $classes[] = 'mw-textarea-protected'; |
1281 | 1285 | } |
1282 | | - $wgOut->addHTML( "<div class='mw-warning-with-logexcerpt'>\n" ); |
1283 | | - $wgOut->addWikiMsg( $noticeMsg ); |
1284 | | - LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '', 1 ); |
1285 | | - $wgOut->addHTML( "</div>\n" ); |
| 1286 | + LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '', |
| 1287 | + array( 'lim' => 1, 'msgKey' => array( $noticeMsg ) ) ); |
1286 | 1288 | } |
1287 | 1289 | if ( $this->mTitle->isCascadeProtected() ) { |
1288 | 1290 | # Is this page under cascading protection from some source pages? |
Index: trunk/phase3/includes/HistoryPage.php |
— | — | @@ -105,7 +105,13 @@ |
106 | 106 | */ |
107 | 107 | if( !$this->title->exists() ) { |
108 | 108 | $wgOut->addWikiMsg( 'nohistory' ); |
109 | | - $this->article->showLogs(); // show deletion/move log if there is an entry |
| 109 | + # show deletion/move log if there is an entry |
| 110 | + LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), $this->title->getPrefixedText(), '', |
| 111 | + array( 'lim' => 10, |
| 112 | + 'conds' => array( "log_action != 'revision'" ), |
| 113 | + 'showIfEmpty' => false, |
| 114 | + 'msgKey' => array( 'moveddeleted-notice' ) ) |
| 115 | + ); |
110 | 116 | wfProfileOut( __METHOD__ ); |
111 | 117 | return; |
112 | 118 | } |
Index: trunk/phase3/includes/LogEventsList.php |
— | — | @@ -571,26 +571,36 @@ |
572 | 572 | * @param $types String or Array |
573 | 573 | * @param $page String The page title to show log entries for |
574 | 574 | * @param $user String The user who made the log entries |
575 | | - * @param $lim Integer Limit of items to show, default is 50 |
576 | | - * @param $conds Array Extra conditions for the query |
577 | | - * @param $showIfEmpty boolean Set to false if you don't want any output in case the loglist is empty |
| 575 | + * @param $param Associative Array with the following additional options: |
| 576 | + * lim Integer Limit of items to show, default is 50 |
| 577 | + * conds Array Extra conditions for the query (e.g. "log_action != 'revision'") |
| 578 | + * showIfEmpty boolean Set to false if you don't want any output in case the loglist is empty |
578 | 579 | * if set to true (default), "No matching items in log" is displayed if loglist is empty |
579 | | - * @param $msgKey Array If you want a nice box with a message, set this |
| 580 | + * msgKey Array If you want a nice box with a message, set this |
580 | 581 | * to the key of the message. First element is the message |
581 | 582 | * key, additional optional elements are parameters for the |
582 | 583 | * key that are processed with wgMsgExt and option 'parse' |
583 | 584 | * @return Integer Number of total log items (not limited by $lim) |
584 | 585 | */ |
585 | | - public static function showLogExtract( &$out, $types=array(), $page='', $user='', $lim=0, $conds=array(), $showIfEmpty = true, $msgKey = array() ) { |
| 586 | + public static function showLogExtract( &$out, $types=array(), $page='', $user='', |
| 587 | + $param = array( 'lim' => 0, 'conds' => array(), 'showIfEmpty' => true, 'msgKey' => array('') ) ) { |
| 588 | + |
586 | 589 | global $wgUser, $wgOut; |
587 | | - # Insert list of top 50 or so items |
| 590 | + # Convert $param array to individual variables |
| 591 | + $lim = $param['lim']; |
| 592 | + $conds = $param['conds']; |
| 593 | + $showIfEmpty = $param['showIfEmpty']; |
| 594 | + $msgKey = $param['msgKey']; |
| 595 | + if ( !(is_array($msgKey)) ) |
| 596 | + $msgKey = array( $msgKey ); |
| 597 | + # Insert list of top 50 (or top $lim) items |
588 | 598 | $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 ); |
589 | 599 | $pager = new LogPager( $loglist, $types, $user, $page, '', $conds ); |
590 | 600 | if( $lim > 0 ) $pager->mLimit = $lim; |
591 | 601 | $logBody = $pager->getBody(); |
592 | 602 | $s = ''; |
593 | 603 | if( $logBody ) { |
594 | | - if ( $msgKey ) { |
| 604 | + if ( $msgKey[0] ) { |
595 | 605 | $s = '<div class="mw-warning-with-logexcerpt">'; |
596 | 606 | |
597 | 607 | if ( count( $msgKey ) == 1 ) { |
— | — | @@ -627,7 +637,7 @@ |
628 | 638 | ); |
629 | 639 | |
630 | 640 | } |
631 | | - if ( $logBody && $msgKey ) |
| 641 | + if ( $logBody && $msgKey[0] ) |
632 | 642 | $s .= '</div>'; |
633 | 643 | |
634 | 644 | if( $out instanceof OutputPage ){ |
Index: trunk/phase3/includes/specials/SpecialRevisiondelete.php |
— | — | @@ -184,12 +184,12 @@ |
185 | 185 | # Show relevant lines from the deletion log |
186 | 186 | $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" ); |
187 | 187 | LogEventsList::showLogExtract( $wgOut, 'delete', |
188 | | - $this->targetObj->getPrefixedText(), '', 25, $qc ); |
| 188 | + $this->targetObj->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) ); |
189 | 189 | # Show relevant lines from the suppression log |
190 | 190 | if( $wgUser->isAllowed( 'suppressionlog' ) ) { |
191 | 191 | $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "</h2>\n" ); |
192 | 192 | LogEventsList::showLogExtract( $wgOut, 'suppress', |
193 | | - $this->targetObj->getPrefixedText(), '', 25, $qc ); |
| 193 | + $this->targetObj->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) ); |
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
Index: trunk/phase3/includes/specials/SpecialContributions.php |
— | — | @@ -226,8 +226,8 @@ |
227 | 227 | |
228 | 228 | // Show a note if the user is blocked and display the last block log entry. |
229 | 229 | if ( User::newFromID( $id )->isBlocked() ) |
230 | | - LogEventsList::showLogExtract( $wgOut, 'block', $nt->getPrefixedText(), '', 1, |
231 | | - array(), false, 'sp-contributions-blocked-notice' ); |
| 230 | + LogEventsList::showLogExtract( $wgOut, 'block', $nt->getPrefixedText(), '', |
| 231 | + array( 'lim' => 1, 'showIfEmpty' => false, 'msgKey' => array( 'sp-contributions-blocked-notice' ) ) ); |
232 | 232 | } |
233 | 233 | |
234 | 234 | // Old message 'contribsub' had one parameter, but that doesn't work for |
Index: trunk/phase3/includes/specials/SpecialBlockip.php |
— | — | @@ -585,22 +585,13 @@ |
586 | 586 | |
587 | 587 | private function showLogFragment( $out, $title ) { |
588 | 588 | global $wgUser; |
589 | | - $out->addHTML( Xml::element( 'h2', NULL, LogPage::logName( 'block' ) ) ); |
590 | | - $count = LogEventsList::showLogExtract( $out, 'block', $title->getPrefixedText(), '', 10 ); |
591 | | - if( $count > 10 ) { |
592 | | - $out->addHTML( $wgUser->getSkin()->link( |
593 | | - SpecialPage::getTitleFor( 'Log' ), |
594 | | - wfMsgHtml( 'blocklog-fulllog' ), |
595 | | - array(), |
596 | | - array( |
597 | | - 'type' => 'block', |
598 | | - 'page' => $title->getPrefixedText() ) ) ); |
599 | | - } |
| 589 | + LogEventsList::showLogExtract( $out, 'block', $title->getPrefixedText(), '', |
| 590 | + array( 'lim' => 10, 'msgKey' => array( 'blocklog-showlog' ) ) ); |
600 | 591 | // Add suppression block entries if allowed |
601 | | - if( $wgUser->isAllowed('hideuser') ) { |
602 | | - $out->addHTML( Xml::element( 'h2', NULL, LogPage::logName( 'suppress' ) ) ); |
| 592 | + if( $wgUser->isAllowed( 'hideuser' ) ) { |
603 | 593 | LogEventsList::showLogExtract( $out, 'suppress', $title->getPrefixedText(), '', |
604 | | - 10, array('log_action' => array('block','reblock','unblock')) ); |
| 594 | + array('lim' => 10, 'conds' => array('log_action' => array('block','reblock','unblock')), |
| 595 | + 'msgKey' => array( 'blocklog-showsuppresslog' ) ) ); |
605 | 596 | } |
606 | 597 | } |
607 | 598 | |
Index: trunk/phase3/includes/specials/SpecialMovepage.php |
— | — | @@ -180,7 +180,7 @@ |
181 | 181 | } |
182 | 182 | $wgOut->addHTML( "<div class='mw-warning-with-logexcerpt'>\n" ); |
183 | 183 | $wgOut->addWikiMsg( $noticeMsg ); |
184 | | - LogEventsList::showLogExtract( $wgOut, 'protect', $this->oldTitle->getPrefixedText(), '', 1 ); |
| 184 | + LogEventsList::showLogExtract( $wgOut, 'protect', $this->oldTitle->getPrefixedText(), '', array( 'lim' => 1 ) ); |
185 | 185 | $wgOut->addHTML( "</div>\n" ); |
186 | 186 | } |
187 | 187 | |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -2945,7 +2945,8 @@ |
2946 | 2946 | 'autoblocker' => 'Autoblocked because your IP address has been recently used by "[[User:$1|$1]]". |
2947 | 2947 | The reason given for $1\'s block is: "$2"', |
2948 | 2948 | 'blocklogpage' => 'Block log', |
2949 | | -'blocklog-fulllog' => 'Full block log', |
| 2949 | +'blocklog-showlog' => 'This user has been blocked previously. The block log is provided below for reference:', |
| 2950 | +'blocklog-showsuppresslog' => 'This user has been blocked and hidden previously. The suppress log is provided below for reference:', |
2950 | 2951 | 'blocklogentry' => 'blocked [[$1]] with an expiry time of $2 $3', |
2951 | 2952 | 'reblock-logentry' => 'changed block settings for [[$1]] with an expiry time of $2 $3', |
2952 | 2953 | 'blocklogtext' => 'This is a log of user blocking and unblocking actions. |