From bdc31bb9bc995e28b2cf79cba8e95e44513da635 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Fri, 1 Jul 2011 02:25:19 +0000 Subject: [PATCH] Change usages of $wgUser->getSkin() in special pages to use $this->getSkin() Fix trailing whitespace --- includes/FeedUtils.php | 2 +- includes/ImagePage.php | 2 +- includes/QueryPage.php | 2 +- includes/RawPage.php | 4 +- includes/api/ApiQueryFilearchive.php | 4 +- includes/api/ApiQueryWatchlist.php | 8 ++-- includes/diff/DifferenceEngine.php | 4 +- includes/filerepo/RepoGroup.php | 2 + includes/specials/SpecialBlock.php | 2 +- includes/specials/SpecialBlockList.php | 2 +- includes/specials/SpecialConfirmemail.php | 2 +- includes/specials/SpecialContributions.php | 6 +-- .../specials/SpecialDeletedContributions.php | 2 +- includes/specials/SpecialEditWatchlist.php | 14 +++--- includes/specials/SpecialEmailuser.php | 4 +- includes/specials/SpecialExport.php | 4 +- .../specials/SpecialFileDuplicateSearch.php | 4 +- includes/specials/SpecialImport.php | 4 +- includes/specials/SpecialLog.php | 6 +-- includes/specials/SpecialMergeHistory.php | 2 +- includes/specials/SpecialMovepage.php | 6 +-- includes/specials/SpecialNewimages.php | 4 +- includes/specials/SpecialPrefixindex.php | 4 +- includes/specials/SpecialProtectedtitles.php | 6 +-- .../specials/SpecialRecentchangeslinked.php | 3 +- includes/specials/SpecialSearch.php | 10 ++--- includes/specials/SpecialStatistics.php | 12 ++--- includes/specials/SpecialTags.php | 3 +- includes/specials/SpecialUnblock.php | 4 +- includes/specials/SpecialUndelete.php | 10 ++--- includes/specials/SpecialUpload.php | 4 +- includes/specials/SpecialUserlogin.php | 2 +- includes/specials/SpecialUserrights.php | 2 +- maintenance/deleteArchivedRevisions.inc | 2 +- maintenance/dumpIterator.php | 45 ++++++++++--------- maintenance/preprocessorFuzzTest.php | 3 ++ maintenance/rebuildImages.php | 3 ++ maintenance/rebuildtextindex.php | 4 ++ 38 files changed, 109 insertions(+), 98 deletions(-) diff --git a/includes/FeedUtils.php b/includes/FeedUtils.php index 9daffc12f7..4502c3a861 100644 --- a/includes/FeedUtils.php +++ b/includes/FeedUtils.php @@ -112,7 +112,7 @@ class FeedUtils { # $wgLang->date( $timestamp ), # $wgLang->time( $timestamp ) ), # wfMsg( 'currentrev' ) ); - + // Don't bother generating the diff if we won't be able to show it if ( $wgFeedDiffCutoff > 0 ) { $de = new DifferenceEngine( $title, $oldid, $newid ); diff --git a/includes/ImagePage.php b/includes/ImagePage.php index ebbe36ca6c..e6090f2735 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -879,7 +879,7 @@ class ImageHistoryList { */ public function __construct( $imagePage ) { global $wgUser, $wgShowArchiveThumbnails; - $this->skin = $wgUser->getSkin(); + $this->skin = $this->getSkin(); $this->current = $imagePage->getFile(); $this->img = $imagePage->getDisplayedFile(); $this->title = $imagePage->getTitle(); diff --git a/includes/QueryPage.php b/includes/QueryPage.php index e52669f008..da8faf5b14 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -521,7 +521,7 @@ abstract class QueryPage extends SpecialPage { # with more than a straight list, so we hand them the info, plus # an OutputPage, and let them get on with it $this->outputResults( $wgOut, - $wgUser->getSkin(), + $this->getSkin(), $dbr, # Should use a ResultWrapper for this $res, $this->numRows, diff --git a/includes/RawPage.php b/includes/RawPage.php index ddb91fb504..28ce7ad6d5 100644 --- a/includes/RawPage.php +++ b/includes/RawPage.php @@ -151,9 +151,9 @@ class RawPage { } function getRawText() { - global $wgUser, $wgOut; + global $wgOut; if( $this->mGen ) { - $sk = $wgUser->getSkin(); + $sk = $this->getSkin(); if( !StubObject::isRealObject( $wgOut ) ) { $wgOut->_unstub( 2 ); } diff --git a/includes/api/ApiQueryFilearchive.php b/includes/api/ApiQueryFilearchive.php index 54d5a45cf7..e746a6c499 100644 --- a/includes/api/ApiQueryFilearchive.php +++ b/includes/api/ApiQueryFilearchive.php @@ -181,7 +181,7 @@ class ApiQueryFilearchive extends ApiQueryBase { if ( $fld_mime ) { $file['mime'] = "$row->fa_major_mime/$row->fa_minor_mime"; } - + if ( $row->fa_deleted & File::DELETED_FILE ) { $file['filehidden'] = ''; } @@ -196,7 +196,7 @@ class ApiQueryFilearchive extends ApiQueryBase { $file['suppressed'] = ''; } - + $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $file ); if ( !$fit ) { $this->setContinueEnumParameter( 'from', $this->keyToTitle( $row->fa_name ) ); diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index e5507f622f..a5023ea30d 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -133,11 +133,11 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { $this->addWhere( array( 'rc_deleted' => 0, ) ); - + $db = $this->getDB(); - $this->addWhereRange( 'rc_timestamp', $params['dir'], - $db->timestamp( $params['start'] ), + $this->addWhereRange( 'rc_timestamp', $params['dir'], + $db->timestamp( $params['start'] ), $db->timestamp( $params['end'] ) ); $this->addWhereFld( 'wl_namespace', $params['namespace'] ); $this->addWhereIf( 'rc_this_oldid=page_latest OR rc_type=' . RC_LOG, !$params['allrev'] ); @@ -293,7 +293,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { if ( $this->fld_parsedcomment && isset( $row->rc_comment ) ) { global $wgUser; - $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->rc_comment, $title ); + $vals['parsedcomment'] = $this->getSkin()->formatComment( $row->rc_comment, $title ); } if ( $this->fld_loginfo && $row->rc_type == RC_LOG ) { diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 4e8194aaa3..f0345c4cc9 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -482,7 +482,7 @@ CONTROL; // (a) the user can delete revisions, or // (b) the user can view deleted revision *and* this one is deleted if ( $canHide || ( $rev->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) ) { - $sk = $wgUser->getSkin(); + $sk = $this->getSkin(); if ( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) { $link = $sk->revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops } else { @@ -550,7 +550,7 @@ CONTROL; } # Add redundant patrol link on bottom... if ( $this->mRcidMarkPatrolled && $this->mTitle->quickUserCan( 'patrol' ) ) { - $sk = $wgUser->getSkin(); + $sk = $this->getSkin(); $token = $wgUser->editToken( $this->mRcidMarkPatrolled ); $wgOut->preventClickjacking(); $wgOut->addHTML( diff --git a/includes/filerepo/RepoGroup.php b/includes/filerepo/RepoGroup.php index 59407cf2e8..d487590884 100644 --- a/includes/filerepo/RepoGroup.php +++ b/includes/filerepo/RepoGroup.php @@ -289,6 +289,8 @@ class RepoGroup { /** * Get the local repository, i.e. the one corresponding to the local image * table. Files are typically uploaded to the local repository. + * + * @return LocalRepo */ function getLocalRepo() { return $this->getRepo( 'local' ); diff --git a/includes/specials/SpecialBlock.php b/includes/specials/SpecialBlock.php index 299d758435..f95d61af32 100644 --- a/includes/specials/SpecialBlock.php +++ b/includes/specials/SpecialBlock.php @@ -77,7 +77,7 @@ class SpecialBlock extends SpecialPage { if ( $this->target instanceof User ) { # Set the 'relevant user' in the skin, so it displays links like Contributions, # User logs, UserRights, etc. - $wgUser->getSkin()->setRelevantUser( $this->target ); + $this->getSkin()->setRelevantUser( $this->target ); } list( $this->previousTarget, /*...*/ ) = Block::parseTarget( $wgRequest->getVal( 'wpPreviousTarget' ) ); diff --git a/includes/specials/SpecialBlockList.php b/includes/specials/SpecialBlockList.php index 00b47b45a8..d192fad6a3 100644 --- a/includes/specials/SpecialBlockList.php +++ b/includes/specials/SpecialBlockList.php @@ -225,7 +225,7 @@ class BlockListPager extends TablePager { static $sk, $msg; if ( empty( $sk ) ) { - $sk = $wgUser->getSkin(); + $sk = $this->getSkin(); $msg = array( 'anononlyblock', 'createaccountblock', diff --git a/includes/specials/SpecialConfirmemail.php b/includes/specials/SpecialConfirmemail.php index 2370b6bbce..b8dfaba97d 100644 --- a/includes/specials/SpecialConfirmemail.php +++ b/includes/specials/SpecialConfirmemail.php @@ -61,7 +61,7 @@ class EmailConfirmation extends UnlistedSpecialPage { } } else { $title = SpecialPage::getTitleFor( 'Userlogin' ); - $skin = $wgUser->getSkin(); + $skin = $this->getSkin(); $llink = $skin->linkKnown( $title, wfMsgHtml( 'loginreqlink' ), diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index fe0e10c4f9..1b5360c175 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -83,8 +83,8 @@ class SpecialContributions extends SpecialPage { $wgOut->setSubtitle( $this->contributionsSub( $nt, $id ) ); $wgOut->setHTMLTitle( wfMsg( 'pagetitle', wfMsgExt( 'contributions-title', array( 'parsemag' ),$target ) ) ); $user = User::newFromName( $target, false ); - if ( is_object($user) ) { - $wgUser->getSkin()->setRelevantUser( $user ); + if ( is_object( $user ) ) { + $this->getSkin()->setRelevantUser( $user ); } } else { $wgOut->setSubtitle( wfMsgHtml( 'sp-contributions-newbies-sub') ); @@ -215,7 +215,7 @@ class SpecialContributions extends SpecialPage { protected function contributionsSub( $nt, $id ) { global $wgLang, $wgUser, $wgOut; - $sk = $wgUser->getSkin(); + $sk = $this->getSkin(); if ( $id === null ) { $user = htmlspecialchars( $nt->getText() ); diff --git a/includes/specials/SpecialDeletedContributions.php b/includes/specials/SpecialDeletedContributions.php index 221a0102a8..32ed62b74f 100644 --- a/includes/specials/SpecialDeletedContributions.php +++ b/includes/specials/SpecialDeletedContributions.php @@ -357,7 +357,7 @@ class DeletedContributionsPage extends SpecialPage { function getSubTitle( $nt, $id ) { global $wgLang, $wgUser, $wgOut; - $sk = $wgUser->getSkin(); + $sk = $this->getSkin(); if ( $id === null ) { $user = htmlspecialchars( $nt->getText() ); diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php index 47576e3523..9255bc7581 100644 --- a/includes/specials/SpecialEditWatchlist.php +++ b/includes/specials/SpecialEditWatchlist.php @@ -37,7 +37,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { # Anons don't get a watchlist if( $wgUser->isAnon() ) { $wgOut->setPageTitle( wfMsg( 'watchnologin' ) ); - $llink = $wgUser->getSkin()->linkKnown( + $llink = $this->getSkin()->linkKnown( SpecialPage::getTitleFor( 'Userlogin' ), wfMsgHtml( 'loginreqlink' ), array(), @@ -51,7 +51,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { 'watchlistfor2', array( 'parseinline', 'replaceafter' ), $wgUser->getName(), - SpecialEditWatchlist::buildTools( $wgUser->getSkin() ) + SpecialEditWatchlist::buildTools( $this->getSkin() ) ); $wgOut->setSubtitle( $sub ); @@ -139,7 +139,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { 'watchlistedit-raw-added', $wgLang->formatNum( count( $toWatch ) ) ); - $this->showTitles( $toWatch, $this->successMessage, $wgUser->getSkin() ); + $this->showTitles( $toWatch, $this->successMessage, $this->getSkin() ); } if( count( $toUnwatch ) > 0 ) { @@ -147,7 +147,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { 'watchlistedit-raw-removed', $wgLang->formatNum( count( $toUnwatch ) ) ); - $this->showTitles( $toUnwatch, $this->successMessage, $wgUser->getSkin() ); + $this->showTitles( $toUnwatch, $this->successMessage, $this->getSkin() ); } } else { $this->clearWatchlist( $wgUser ); @@ -156,7 +156,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { 'watchlistedit-raw-removed', $wgLang->formatNum( count( $current ) ) ); - $this->showTitles( $current, $this->successMessage, $wgUser->getSkin() ); + $this->showTitles( $current, $this->successMessage, $this->getSkin() ); } return true; } @@ -416,7 +416,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { 'watchlistedit-normal-done', $wgLang->formatNum( count( $removed ) ) ); - $this->showTitles( $removed, $this->successMessage, $wgUser->getSkin() ); + $this->showTitles( $removed, $this->successMessage, $this->getSkin() ); return true; } else { return false; @@ -597,4 +597,4 @@ class EditWatchlistNormalHTMLForm extends HTMLForm { ? wfMsgHtml( 'blanknamespace' ) : htmlspecialchars( $wgLang->getFormattedNsText( $namespace ) ); } -} \ No newline at end of file +} diff --git a/includes/specials/SpecialEmailuser.php b/includes/specials/SpecialEmailuser.php index b3ba9c5cf5..90cfe10b71 100644 --- a/includes/specials/SpecialEmailuser.php +++ b/includes/specials/SpecialEmailuser.php @@ -39,7 +39,7 @@ class SpecialEmailUser extends UnlistedSpecialPage { 'From' => array( 'type' => 'info', 'raw' => 1, - 'default' => $wgUser->getSkin()->link( + 'default' => $this->getSkin()->link( $wgUser->getUserPage(), htmlspecialchars( $wgUser->getName() ) ), @@ -49,7 +49,7 @@ class SpecialEmailUser extends UnlistedSpecialPage { 'To' => array( 'type' => 'info', 'raw' => 1, - 'default' => $wgUser->getSkin()->link( + 'default' => $this->getSkin()->link( $this->mTargetObj->getUserPage(), htmlspecialchars( $this->mTargetObj->getName() ) ), diff --git a/includes/specials/SpecialExport.php b/includes/specials/SpecialExport.php index 3ecf40e638..8968ec2748 100644 --- a/includes/specials/SpecialExport.php +++ b/includes/specials/SpecialExport.php @@ -40,7 +40,7 @@ class SpecialExport extends SpecialPage { public function execute( $par ) { global $wgOut, $wgRequest, $wgSitename, $wgExportAllowListContributors; global $wgExportAllowHistory, $wgExportMaxHistory, $wgExportMaxLinkDepth; - global $wgExportFromNamespaces, $wgUser; + global $wgExportFromNamespaces; $this->setHeaders(); $this->outputHeader(); @@ -215,7 +215,7 @@ class SpecialExport extends SpecialPage { $wgRequest->wasPosted() ? $wgRequest->getCheck( 'wpDownload' ) : true ) . '
'; - $form .= Xml::submitButton( wfMsg( 'export-submit' ), $wgUser->getSkin()->tooltipAndAccessKeyAttribs( 'export' ) ); + $form .= Xml::submitButton( wfMsg( 'export-submit' ), $this->getSkin()->tooltipAndAccessKeyAttribs( 'export' ) ); $form .= Xml::closeElement( 'form' ); $wgOut->addHTML( $form ); diff --git a/includes/specials/SpecialFileDuplicateSearch.php b/includes/specials/SpecialFileDuplicateSearch.php index 93d2f55922..be655813b0 100644 --- a/includes/specials/SpecialFileDuplicateSearch.php +++ b/includes/specials/SpecialFileDuplicateSearch.php @@ -62,8 +62,8 @@ class FileDuplicateSearchPage extends QueryPage { * @param $dupes Array of File objects */ function showList( $dupes ) { - global $wgUser, $wgOut; - $skin = $wgUser->getSkin(); + global $wgOut; + $skin = $this->getSkin(); $html = array(); $html[] = $this->openList( 0 ); diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index 47ca49725b..e41685db45 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -292,7 +292,7 @@ class SpecialImport extends SpecialPage { " . - Xml::submitButton( wfMsg( 'import-interwiki-submit' ), $wgUser->getSkin()->tooltipAndAccessKeyAttribs( 'import' ) ) . + Xml::submitButton( wfMsg( 'import-interwiki-submit' ), $this->getSkin()->tooltipAndAccessKeyAttribs( 'import' ) ) . " " . Xml::closeElement( 'table' ). @@ -350,7 +350,7 @@ class ImportReporter { $args = func_get_args(); call_user_func_array( $this->mOriginalPageOutCallback, $args ); - $skin = $wgUser->getSkin(); + $skin = $this->getSkin(); $this->mPageCount++; diff --git a/includes/specials/SpecialLog.php b/includes/specials/SpecialLog.php index e34a341ce9..d8f6d8cff0 100644 --- a/includes/specials/SpecialLog.php +++ b/includes/specials/SpecialLog.php @@ -95,10 +95,10 @@ class SpecialLog extends SpecialPage { } private function show( FormOptions $opts, array $extraConds ) { - global $wgOut, $wgUser; + global $wgOut; # Create a LogPager item to get the results and a LogEventsList item to format them... - $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 ); + $loglist = new LogEventsList( $this->getSkin(), $wgOut, 0 ); $pager = new LogPager( $loglist, $opts->getValue( 'type' ), $opts->getValue( 'user' ), $opts->getValue( 'page' ), $opts->getValue( 'pattern' ), $extraConds, $opts->getValue( 'year' ), $opts->getValue( 'month' ), $opts->getValue( 'tagfilter' ) ); @@ -108,7 +108,7 @@ class SpecialLog extends SpecialPage { # Set relevant user if ( $pager->getUser() ) { - $wgUser->getSkin()->setRelevantUser( User::newFromName( $pager->getUser() ) ); + $this->getSkin()->setRelevantUser( User::newFromName( $pager->getUser() ) ); } # Show form options diff --git a/includes/specials/SpecialMergeHistory.php b/includes/specials/SpecialMergeHistory.php index 916230ca98..f9c4a2c2a7 100644 --- a/includes/specials/SpecialMergeHistory.php +++ b/includes/specials/SpecialMergeHistory.php @@ -173,7 +173,7 @@ class SpecialMergeHistory extends SpecialPage { private function showHistory() { global $wgUser, $wgOut; - $this->sk = $wgUser->getSkin(); + $this->sk = $this->getSkin(); $wgOut->setPageTitle( wfMsg( 'mergehistory' ) ); diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index 61ae7085c0..11095fba58 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -107,7 +107,7 @@ class MovePageForm extends UnlistedSpecialPage { function showForm( $err ) { global $wgOut, $wgUser, $wgContLang, $wgFixDoubleRedirects; - $skin = $wgUser->getSkin(); + $skin = $this->getSkin(); $oldTitleLink = $skin->link( $this->oldTitle ); @@ -492,7 +492,7 @@ class MovePageForm extends UnlistedSpecialPage { } $extraOutput = array(); - $skin = $wgUser->getSkin(); + $skin = $this->getSkin(); $count = 1; foreach( $extraPages as $oldSubpage ) { if( $ot->equals( $oldSubpage ) ) { @@ -596,7 +596,7 @@ class MovePageForm extends UnlistedSpecialPage { } $out->addWikiMsg( 'movesubpagetext', $wgLang->formatNum( $count ) ); - $skin = $wgUser->getSkin(); + $skin = $this->getSkin(); $out->addHTML( "