Index: trunk/phase3/includes/SpecialUserrights.php |
— | — | @@ -540,17 +540,7 @@ |
541 | 541 | * @param OutputPage $output OutputPage to use |
542 | 542 | */ |
543 | 543 | protected function showLogFragment( $user, $output ) { |
544 | | - $viewer = new LogViewer( |
545 | | - new LogReader( |
546 | | - new FauxRequest( |
547 | | - array( |
548 | | - 'type' => 'rights', |
549 | | - 'page' => $user->getUserPage()->getPrefixedText(), |
550 | | - ) |
551 | | - ) |
552 | | - ) |
553 | | - ); |
554 | 544 | $output->addHtml( Xml::element( 'h2', null, LogPage::logName( 'rights' ) . "\n" ) ); |
555 | | - $viewer->showList( $output ); |
| 545 | + LogEventsList::showLogExtract( $output, 'rights', $user->getUserPage()->getPrefixedText() ); |
556 | 546 | } |
557 | 547 | } |
Index: trunk/phase3/includes/ProtectionForm.php |
— | — | @@ -374,12 +374,7 @@ |
375 | 375 | function showLogExtract( &$out ) { |
376 | 376 | # Show relevant lines from the protection log: |
377 | 377 | $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'protect' ) ) ); |
378 | | - $logViewer = new LogViewer( |
379 | | - new LogReader( |
380 | | - new FauxRequest( |
381 | | - array( 'page' => $this->mTitle->getPrefixedText(), |
382 | | - 'type' => 'protect' ) ) ) ); |
383 | | - $logViewer->showList( $out ); |
| 378 | + LogEventsList::showLogExtract( $out, 'protect', $this->mTitle->getPrefixedText() ); |
384 | 379 | } |
385 | 380 | |
386 | 381 | } |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -2156,12 +2156,7 @@ |
2157 | 2157 | */ |
2158 | 2158 | function showLogExtract( $out ) { |
2159 | 2159 | $out->addHtml( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) ); |
2160 | | - $logViewer = new LogViewer( |
2161 | | - new LogReader( |
2162 | | - new FauxRequest( |
2163 | | - array( 'page' => $this->mTitle->getPrefixedText(), |
2164 | | - 'type' => 'delete' ) ) ) ); |
2165 | | - $logViewer->showList( $out ); |
| 2160 | + LogEventsList::showLogExtract( $out, 'delete', $this->mTitle->getPrefixedText() ); |
2166 | 2161 | } |
2167 | 2162 | |
2168 | 2163 | |
Index: trunk/phase3/includes/SpecialRevisiondelete.php |
— | — | @@ -45,17 +45,10 @@ |
46 | 46 | # does not exist...might be helpful |
47 | 47 | if( !is_null($page) ) { |
48 | 48 | $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" ); |
49 | | - $logViewer = new LogViewer( |
50 | | - new LogReader( |
51 | | - new FauxRequest( |
52 | | - array( 'page' => $page->getPrefixedText(), 'type' => 'delete' ) ) ) ); |
53 | | - $logViewer->showList( $wgOut ); |
| 49 | + LogEventsList::showLogExtract( $wgOut, 'delete', $page->getPrefixedText() ); |
54 | 50 | if( $wgUser->isAllowed( 'suppress' ) ){ |
55 | 51 | $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "</h2>\n" ); |
56 | | - $logViewer = new LogViewer( |
57 | | - new LogReader( |
58 | | - new FauxRequest( |
59 | | - array( 'page' => $page->getPrefixedText(), 'type' => 'suppress' ) ) ) ); |
| 52 | + LogEventsList::showLogExtract( $wgOut, 'suppress', $page->getPrefixedText() ); |
60 | 53 | $logViewer->showList( $wgOut ); |
61 | 54 | } |
62 | 55 | } |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -2205,20 +2205,17 @@ |
2206 | 2206 | * @param OutputPage $out |
2207 | 2207 | */ |
2208 | 2208 | private function showDeletionLog( $out ) { |
2209 | | - $title = $this->mTitle; |
2210 | | - $reader = new LogReader( |
2211 | | - new FauxRequest( |
2212 | | - array( |
2213 | | - 'page' => $title->getPrefixedText(), |
2214 | | - 'type' => 'delete', |
2215 | | - ) |
2216 | | - ) |
2217 | | - ); |
2218 | | - if( $reader->hasRows() ) { |
| 2209 | + global $wgUser; |
| 2210 | + $loglist = new LogEventsList( $wgUser->getSkin() ); |
| 2211 | + $pager = new LogPager( $loglist, 'delete', false, $this->mTitle->getPrefixedText() ); |
| 2212 | + if( $pager->getNumRows() > 0 ) { |
2219 | 2213 | $out->addHtml( '<div id="mw-recreate-deleted-warn">' ); |
2220 | 2214 | $out->addWikiMsg( 'recreate-deleted-warn' ); |
2221 | | - $viewer = new LogViewer( $reader ); |
2222 | | - $viewer->showList( $out ); |
| 2215 | + $out->addHTML( |
| 2216 | + $loglist->beginLogEventsList() . |
| 2217 | + $pager->getBody() . |
| 2218 | + $loglist->endLogEventsList() |
| 2219 | + ); |
2223 | 2220 | $out->addHtml( '</div>' ); |
2224 | 2221 | } |
2225 | 2222 | } |
Index: trunk/phase3/includes/SpecialBlockip.php |
— | — | @@ -400,9 +400,7 @@ |
401 | 401 | |
402 | 402 | function showLogFragment( $out, $title ) { |
403 | 403 | $out->addHtml( Xml::element( 'h2', NULL, LogPage::logName( 'block' ) ) ); |
404 | | - $request = new FauxRequest( array( 'page' => $title->getPrefixedText(), 'type' => 'block' ) ); |
405 | | - $viewer = new LogViewer( new LogReader( $request ) ); |
406 | | - $viewer->showList( $out ); |
| 404 | + LogEventsList::showLogExtract( $out, 'block', $title->getPrefixedText() ); |
407 | 405 | } |
408 | 406 | |
409 | 407 | /** |
Index: trunk/phase3/includes/SpecialUpload.php |
— | — | @@ -1662,19 +1662,17 @@ |
1663 | 1663 | * @param string filename |
1664 | 1664 | */ |
1665 | 1665 | private function showDeletionLog( $out, $filename ) { |
1666 | | - $reader = new LogReader( |
1667 | | - new FauxRequest( |
1668 | | - array( |
1669 | | - 'page' => $filename, |
1670 | | - 'type' => 'delete', |
1671 | | - ) |
1672 | | - ) |
1673 | | - ); |
1674 | | - if( $reader->hasRows() ) { |
| 1666 | + global $wgUser; |
| 1667 | + $loglist = new LogEventsList( $wgUser->getSkin() ); |
| 1668 | + $pager = new LogPager( $loglist, 'delete', false, $filename ); |
| 1669 | + if( $pager->getNumRows() > 0 ) { |
1675 | 1670 | $out->addHtml( '<div id="mw-upload-deleted-warn">' ); |
1676 | 1671 | $out->addWikiMsg( 'upload-wasdeleted' ); |
1677 | | - $viewer = new LogViewer( $reader ); |
1678 | | - $viewer->showList( $out ); |
| 1672 | + $out->addHTML( |
| 1673 | + $loglist->beginLogEventsList() . |
| 1674 | + $pager->getBody() . |
| 1675 | + $loglist->endLogEventsList() |
| 1676 | + ); |
1679 | 1677 | $out->addHtml( '</div>' ); |
1680 | 1678 | } |
1681 | 1679 | } |
Index: trunk/phase3/includes/LogEventsList.php |
— | — | @@ -318,6 +318,29 @@ |
319 | 319 | } |
320 | 320 | |
321 | 321 | /** |
| 322 | + * Quick function to show a short log extract |
| 323 | + * @param OutputPage $out |
| 324 | + * @param string $type |
| 325 | + * @param string $page |
| 326 | + */ |
| 327 | + public static function showLogExtract( $out, $type='', $page='', $user='' ) { |
| 328 | + global $wgUser; |
| 329 | + # Insert list of top 50 or so items |
| 330 | + $loglist = new LogEventsList( $wgUser->getSkin() ); |
| 331 | + $pager = new LogPager( $loglist, $type, $user, $page, '' ); |
| 332 | + $logBody = $pager->getBody(); |
| 333 | + if( $logBody ) { |
| 334 | + $out->addHTML( |
| 335 | + $loglist->beginLogEventsList() . |
| 336 | + $logBody . |
| 337 | + $loglist->endLogEventsList() |
| 338 | + ); |
| 339 | + } else { |
| 340 | + $out->addWikiMsg( 'logempty' ); |
| 341 | + } |
| 342 | + } |
| 343 | + |
| 344 | + /** |
322 | 345 | * SQL clause to skip forbidden log types for this user |
323 | 346 | * @param Database $db |
324 | 347 | * @returns mixed (string or false) |
— | — | @@ -355,7 +378,7 @@ |
356 | 379 | * @param string $pattern |
357 | 380 | * @param array $conds |
358 | 381 | */ |
359 | | - function __construct( $loglist, $type, $user, $title, $pattern, $conds = array() ) { |
| 382 | + function __construct( $loglist, $type='', $user='', $title='', $pattern='', $conds = array() ) { |
360 | 383 | parent::__construct(); |
361 | 384 | $this->mConds = $conds; |
362 | 385 | |
Index: trunk/phase3/includes/SpecialMovepage.php |
— | — | @@ -345,9 +345,7 @@ |
346 | 346 | |
347 | 347 | function showLogFragment( $title, &$out ) { |
348 | 348 | $out->addHTML( Xml::element( 'h2', NULL, LogPage::logName( 'move' ) ) ); |
349 | | - $request = new FauxRequest( array( 'page' => $title->getPrefixedText(), 'type' => 'move' ) ); |
350 | | - $viewer = new LogViewer( new LogReader( $request ) ); |
351 | | - $viewer->showList( $out ); |
| 349 | + LogEventsList::showLogExtract( $out, 'move', $title->getPrefixedText() ); |
352 | 350 | } |
353 | 351 | |
354 | 352 | } |
Index: trunk/phase3/includes/SpecialUndelete.php |
— | — | @@ -956,17 +956,7 @@ |
957 | 957 | |
958 | 958 | # Show relevant lines from the deletion log: |
959 | 959 | $wgOut->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) . "\n" ); |
960 | | - $logViewer = new LogViewer( |
961 | | - new LogReader( |
962 | | - new FauxRequest( |
963 | | - array( |
964 | | - 'page' => $this->mTargetObj->getPrefixedText(), |
965 | | - 'type' => 'delete' |
966 | | - ) |
967 | | - ) |
968 | | - ), LogViewer::NO_ACTION_LINK |
969 | | - ); |
970 | | - $logViewer->showList( $wgOut ); |
| 960 | + LogEventsList::showLogExtract( $wgOut, 'delete', $this->mTargetObj->getPrefixedText() ); |
971 | 961 | |
972 | 962 | if( $this->mAllowed && ( $haveRevisions || $haveFiles ) ) { |
973 | 963 | # Format the user-visible controls (comment field, submission button) |
Index: trunk/phase3/includes/FileDeleteForm.php |
— | — | @@ -179,17 +179,7 @@ |
180 | 180 | private function showLogEntries() { |
181 | 181 | global $wgOut; |
182 | 182 | $wgOut->addHtml( '<h2>' . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" ); |
183 | | - $reader = new LogViewer( |
184 | | - new LogReader( |
185 | | - new FauxRequest( |
186 | | - array( |
187 | | - 'type' => 'delete', |
188 | | - 'page' => $this->title->getPrefixedText(), |
189 | | - ) |
190 | | - ) |
191 | | - ) |
192 | | - ); |
193 | | - $reader->showList( $wgOut ); |
| 183 | + LogEventsList::showLogExtract( $wgOut, 'delete', $this->title->getPrefixedText() ); |
194 | 184 | } |
195 | 185 | |
196 | 186 | /** |
Index: trunk/phase3/includes/SpecialMergeHistory.php |
— | — | @@ -205,14 +205,8 @@ |
206 | 206 | |
207 | 207 | # Show relevant lines from the deletion log: |
208 | 208 | $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'merge' ) ) . "</h2>\n" ); |
209 | | - $logViewer = new LogViewer( |
210 | | - new LogReader( |
211 | | - new FauxRequest( |
212 | | - array( 'page' => $this->mTargetObj->getPrefixedText(), |
213 | | - 'type' => 'merge' ) ) ) ); |
214 | | - $logViewer->showList( $wgOut ); |
| 209 | + LogEventsList::showLogExtract( $wgOut, 'merge', $this->mTargetObj->getPrefixedText() ); |
215 | 210 | |
216 | | - # Slip in the hidden controls here |
217 | 211 | # When we submit, go by page ID to avoid some nasty but unlikely collisions. |
218 | 212 | # Such would happen if a page was renamed after the form loaded, but before submit |
219 | 213 | $misc = Xml::hidden( 'targetID', $this->mTargetObj->getArticleID() ); |