Allow LogEventsList::showLogExtract() to get a Title object instead of having to...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 24 Sep 2011 17:52:53 +0000 (17:52 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 24 Sep 2011 17:52:53 +0000 (17:52 +0000)
14 files changed:
includes/EditPage.php
includes/FileDeleteForm.php
includes/HistoryPage.php
includes/LogEventsList.php
includes/ProtectionForm.php
includes/specials/SpecialBlock.php
includes/specials/SpecialContributions.php
includes/specials/SpecialDeletedContributions.php
includes/specials/SpecialMergeHistory.php
includes/specials/SpecialMovepage.php
includes/specials/SpecialRevisiondelete.php
includes/specials/SpecialUndelete.php
includes/specials/SpecialUpload.php
includes/specials/SpecialUserrights.php

index 77b1bbf..98039bc 100644 (file)
@@ -807,7 +807,7 @@ class EditPage {
                                LogEventsList::showLogExtract(
                                        $wgOut,
                                        'block',
-                                       $user->getUserPage()->getPrefixedText(),
+                                       $user->getUserPage(),
                                        '',
                                        array(
                                                'lim' => 1,
@@ -830,7 +830,7 @@ class EditPage {
                }
                # 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(),
+                       LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), $this->mTitle,
                                '', array( 'lim' => 10,
                                           'conds' => array( "log_action != 'revision'" ),
                                           'showIfEmpty' => false,
@@ -1649,7 +1649,7 @@ HTML
                                # Then it must be protected based on static groups (regular)
                                $noticeMsg = 'protectedpagewarning';
                        }
-                       LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '',
+                       LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle, '',
                                array( 'lim' => 1, 'msgKey' => array( $noticeMsg ) ) );
                }
                if ( $this->mTitle->isCascadeProtected() ) {
@@ -1667,7 +1667,7 @@ HTML
                        $wgOut->wrapWikiMsg( $notice, array( 'cascadeprotectedwarning', $cascadeSourcesCount ) );
                }
                if ( !$this->mTitle->exists() && $this->mTitle->getRestrictions( 'create' ) ) {
-                       LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle->getPrefixedText(), '',
+                       LogEventsList::showLogExtract( $wgOut, 'protect', $this->mTitle, '',
                                array(  'lim' => 1,
                                        'showIfEmpty' => false,
                                        'msgKey' => array( 'titleprotectedwarning' ),
index e2745e2..ca195d8 100644 (file)
@@ -236,7 +236,7 @@ class FileDeleteForm {
        private function showLogEntries() {
                global $wgOut;
                $wgOut->addHTML( '<h2>' . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" );
-               LogEventsList::showLogExtract( $wgOut, 'delete', $this->title->getPrefixedText() );
+               LogEventsList::showLogExtract( $wgOut, 'delete', $this->title );
        }
 
        /**
index 670fe3e..c40fec4 100644 (file)
@@ -117,7 +117,7 @@ class HistoryPage {
                        LogEventsList::showLogExtract(
                                $wgOut,
                                array( 'delete', 'move' ),
-                               $this->title->getPrefixedText(),
+                               $this->title,
                                '',
                                array(  'lim' => 10,
                                        'conds' => array( "log_action != 'revision'" ),
index b1ede05..08949d8 100644 (file)
@@ -789,7 +789,7 @@ class LogPager extends ReverseChronologicalPager {
         * @param $list LogEventsList
         * @param $types String or Array: log types to show
         * @param $performer String: the user who made the log entries
-        * @param $title String: the page title the log entries are for
+        * @param $title String or Title: the page title the log entries are for
         * @param $pattern String: do a prefix search rather than an exact title match
         * @param $conds Array: extra conditions for the query
         * @param $year Integer: the year to start from
@@ -909,15 +909,19 @@ class LogPager extends ReverseChronologicalPager {
         * Set the log reader to return only entries affecting the given page.
         * (For the block and rights logs, this is a user page.)
         *
-        * @param $page String: Title name as text
+        * @param $page String or Title object: Title name
         * @param $pattern String
         */
        private function limitTitle( $page, $pattern ) {
                global $wgMiserMode;
 
-               $title = Title::newFromText( $page );
-               if( strlen( $page ) == 0 || !$title instanceof Title ) {
-                       return false;
+               if ( $page instanceof Title ) {
+                       $title = $page;
+               } else {
+                       $title = Title::newFromText( $page );
+                       if( strlen( $page ) == 0 || !$title instanceof Title ) {
+                               return false;
+                       }
                }
 
                $this->title = $title->getPrefixedText();
index caee18f..b73558b 100644 (file)
@@ -606,7 +606,7 @@ class ProtectionForm {
        function showLogExtract( &$out ) {
                # Show relevant lines from the protection log:
                $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'protect' ) ) );
-               LogEventsList::showLogExtract( $out, 'protect', $this->mTitle->getPrefixedText() );
+               LogEventsList::showLogExtract( $out, 'protect', $this->mTitle );
                # Let extensions add other relevant log extracts
                wfRunHooks( 'ProtectionForm::showLogExtract', array($this->mArticle,$out) );
        }
index 34c3884..d0b806a 100644 (file)
@@ -404,7 +404,7 @@ class SpecialBlock extends SpecialPage {
                        LogEventsList::showLogExtract(
                                $out,
                                'block',
-                               $userpage->getPrefixedText(),
+                               $userpage,
                                '',
                                array(
                                        'lim' => 10,
@@ -419,7 +419,7 @@ class SpecialBlock extends SpecialPage {
                                LogEventsList::showLogExtract(
                                        $out,
                                        'suppress',
-                                       $userpage->getPrefixedText(),
+                                       $userpage,
                                        '',
                                        array(
                                                'lim' => 10,
index 7e513bf..3de70fa 100644 (file)
@@ -228,7 +228,7 @@ class SpecialContributions extends SpecialPage {
                                LogEventsList::showLogExtract(
                                        $out,
                                        'block',
-                                       $nt->getPrefixedText(),
+                                       $nt,
                                        '',
                                        array(
                                                'lim' => 1,
index 99f1654..b3fbeb6 100644 (file)
@@ -422,7 +422,7 @@ class DeletedContributionsPage extends SpecialPage {
                                LogEventsList::showLogExtract(
                                        $out,
                                        'block',
-                                       $nt->getPrefixedText(),
+                                       $nt,
                                        '',
                                        array(
                                                'lim' => 1,
index e6580ea..0f046ab 100644 (file)
@@ -236,7 +236,7 @@ class SpecialMergeHistory extends SpecialPage {
 
                # Show relevant lines from the deletion log:
                $out->addHTML( '<h2>' . htmlspecialchars( LogPage::logName( 'merge' ) ) . "</h2>\n" );
-               LogEventsList::showLogExtract( $out, 'merge', $this->mTargetObj->getPrefixedText() );
+               LogEventsList::showLogExtract( $out, 'merge', $this->mTargetObj );
 
                # When we submit, go by page ID to avoid some nasty but unlikely collisions.
                # Such would happen if a page was renamed after the form loaded, but before submit
index 8fa44a0..f4cc150 100644 (file)
@@ -216,7 +216,7 @@ class MovePageForm extends UnlistedSpecialPage {
                        }
                        $out->addHTML( "<div class='mw-warning-with-logexcerpt'>\n" );
                        $out->addWikiMsg( $noticeMsg );
-                       LogEventsList::showLogExtract( $out, 'protect', $this->oldTitle->getPrefixedText(), '', array( 'lim' => 1 ) );
+                       LogEventsList::showLogExtract( $out, 'protect', $this->oldTitle, '', array( 'lim' => 1 ) );
                        $out->addHTML( "</div>\n" );
                }
 
@@ -580,7 +580,7 @@ class MovePageForm extends UnlistedSpecialPage {
        function showLogFragment( $title ) {
                $out = $this->getOutput();
                $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'move' ) ) );
-               LogEventsList::showLogExtract( $out, 'move', $title->getPrefixedText() );
+               LogEventsList::showLogExtract( $out, 'move', $title );
        }
 
        function showSubpages( $title ) {
index 9518e19..c5915fb 100644 (file)
@@ -208,12 +208,12 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
                # Show relevant lines from the deletion log
                $output->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" );
                LogEventsList::showLogExtract( $output, 'delete',
-                       $this->targetObj->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) );
+                       $this->targetObj, '', array( 'lim' => 25, 'conds' => $qc ) );
                # Show relevant lines from the suppression log
                if( $user->isAllowed( 'suppressionlog' ) ) {
                        $output->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "</h2>\n" );
                        LogEventsList::showLogExtract( $output, 'suppress',
-                               $this->targetObj->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) );
+                               $this->targetObj, '', array( 'lim' => 25, 'conds' => $qc ) );
                }
        }
 
index 246a666..6581a1c 100644 (file)
@@ -1076,11 +1076,11 @@ class SpecialUndelete extends SpecialPage {
 
                # Show relevant lines from the deletion log:
                $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) . "\n" );
-               LogEventsList::showLogExtract( $out, 'delete', $this->mTargetObj->getPrefixedText() );
+               LogEventsList::showLogExtract( $out, 'delete', $this->mTargetObj );
                # Show relevant lines from the suppression log:
                if( $this->getUser()->isAllowed( 'suppressionlog' ) ) {
                        $out->addHTML( Xml::element( 'h2', null, LogPage::logName( 'suppress' ) ) . "\n" );
-                       LogEventsList::showLogExtract( $out, 'suppress', $this->mTargetObj->getPrefixedText() );
+                       LogEventsList::showLogExtract( $out, 'suppress', $this->mTargetObj );
                }
 
                if( $this->mAllowed && ( $haveRevisions || $haveFiles ) ) {
index 7fd6e1e..d6b8d0a 100644 (file)
@@ -266,7 +266,7 @@ class SpecialUpload extends SpecialPage {
                $delNotice = ''; // empty by default
                if ( $desiredTitleObj instanceof Title && !$desiredTitleObj->exists() ) {
                        LogEventsList::showLogExtract( $delNotice, array( 'delete', 'move' ),
-                               $desiredTitleObj->getPrefixedText(),
+                               $desiredTitleObj,
                                '', array( 'lim' => 10,
                                           'conds' => array( "log_action != 'revision'" ),
                                           'showIfEmpty' => false,
index 5de67fb..8a2fb02 100644 (file)
@@ -606,6 +606,6 @@ class UserrightsPage extends SpecialPage {
         */
        protected function showLogFragment( $user, $output ) {
                $output->addHTML( Xml::element( 'h2', null, LogPage::logName( 'rights' ) . "\n" ) );
-               LogEventsList::showLogExtract( $output, 'rights', $user->getUserPage()->getPrefixedText() );
+               LogEventsList::showLogExtract( $output, 'rights', $user->getUserPage() );
        }
 }