Merge "Fix typo references in comments to ResourceLoaderStartUpModule"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 8 Jan 2015 19:47:40 +0000 (19:47 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 8 Jan 2015 19:47:40 +0000 (19:47 +0000)
94 files changed:
api.php
autoload.php
img_auth.php
includes/Category.php
includes/DefaultSettings.php
includes/EditPage.php
includes/FeedUtils.php
includes/HtmlFormatter.php
includes/HttpFunctions.php
includes/Linker.php
includes/MediaWiki.php
includes/OutputPage.php
includes/Revision.php
includes/Sanitizer.php
includes/StreamFile.php
includes/StubObject.php
includes/Title.php
includes/User.php
includes/WebStart.php
includes/Xml.php
includes/actions/CreditsAction.php
includes/actions/HistoryAction.php
includes/actions/InfoAction.php
includes/api/ApiBase.php
includes/api/ApiParse.php
includes/cache/BacklinkCache.php
includes/cache/LinkCache.php
includes/cache/LocalisationCache.php
includes/cache/MessageCache.php
includes/changes/EnhancedChangesList.php
includes/changes/OldChangesList.php
includes/content/WikitextContent.php
includes/context/RequestContext.php
includes/db/DatabaseMysqlBase.php
includes/db/LoadBalancer.php
includes/db/LoadMonitor.php
includes/deferred/DeferredUpdates.php
includes/deferred/SearchUpdate.php
includes/deferred/SquidUpdate.php
includes/diff/DifferenceEngine.php
includes/filebackend/FSFile.php
includes/filebackend/FileBackendStore.php
includes/filebackend/SwiftFileBackend.php
includes/filerepo/file/File.php
includes/filerepo/file/LocalFile.php
includes/jobqueue/JobRunner.php
includes/libs/MapCacheLRU.php
includes/libs/Xhprof.php
includes/libs/composer/ComposerJson.php
includes/mail/EmailNotification.php
includes/media/Bitmap.php
includes/media/DjVu.php
includes/media/DjVuImage.php
includes/media/FormatMetadata.php
includes/media/Jpeg.php
includes/media/SVG.php
includes/objectcache/ObjectCache.php
includes/page/Article.php
includes/page/WikiPage.php
includes/parser/LinkHolderArray.php
includes/parser/Parser.php
includes/parser/ParserOptions.php
includes/parser/Preprocessor_DOM.php
includes/parser/Preprocessor_Hash.php
includes/profiler/ProfileSection.php
includes/profiler/Profiler.php
includes/profiler/ProfilerFunctions.php
includes/profiler/ProfilerSectionOnly.php [new file with mode: 0755]
includes/profiler/ProfilerStub.php
includes/profiler/ProfilerXhprof.php
includes/registration/ExtensionProcessor.php
includes/resourceloader/ResourceLoader.php
includes/resourceloader/ResourceLoaderFileModule.php
includes/search/SearchEngine.php
includes/search/SearchHighlighter.php
includes/search/SearchMySQL.php
includes/skins/Skin.php
includes/skins/SkinTemplate.php
includes/specials/SpecialAllMessages.php
includes/specials/SpecialContributions.php
includes/specials/SpecialDeletedContributions.php
includes/specials/SpecialListusers.php
includes/specials/SpecialMergeHistory.php
includes/specials/SpecialProtectedtitles.php
includes/specials/SpecialVersion.php
includes/upload/UploadBase.php
includes/utils/MWCryptRand.php
includes/utils/StringUtils.php
languages/classes/LanguageZh.php
load.php
maintenance/eval.php
resources/src/mediawiki.ui/components/icons.less
tests/phpunit/includes/site/SiteListFileCacheBuilderTest.php
tests/phpunit/includes/site/SiteListFileCacheTest.php

diff --git a/api.php b/api.php
index 92e6704..d63f254 100644 (file)
--- a/api.php
+++ b/api.php
@@ -42,7 +42,6 @@ if ( !function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '5.3
 
 require __DIR__ . '/includes/WebStart.php';
 
-wfProfileIn( 'api.php' );
 $starttime = microtime( true );
 
 // URL safety checks
@@ -94,7 +93,6 @@ DeferredUpdates::doUpdates();
 
 // Log what the user did, for book-keeping purposes.
 $endtime = microtime( true );
-wfProfileOut( 'api.php' );
 
 wfLogProfilingData();
 
index f4935b8..e23464e 100644 (file)
@@ -898,6 +898,7 @@ $wgAutoloadLocalClasses = array(
        'ProfilerOutputDb' => __DIR__ . '/includes/profiler/output/ProfilerOutputDb.php',
        'ProfilerOutputText' => __DIR__ . '/includes/profiler/output/ProfilerOutputText.php',
        'ProfilerOutputUdp' => __DIR__ . '/includes/profiler/output/ProfilerOutputUdp.php',
+       'ProfilerSectionOnly' => __DIR__ . '/includes/profiler/ProfilerSectionOnly.php',
        'ProfilerStub' => __DIR__ . '/includes/profiler/ProfilerStub.php',
        'ProfilerXhprof' => __DIR__ . '/includes/profiler/ProfilerXhprof.php',
        'Protect' => __DIR__ . '/maintenance/protect.php',
index dcd171f..51470b6 100644 (file)
@@ -39,7 +39,6 @@
 
 define( 'MW_NO_OUTPUT_COMPRESSION', 1 );
 require __DIR__ . '/includes/WebStart.php';
-wfProfileIn( 'img_auth.php' );
 
 # Set action base paths so that WebRequest::getPathInfo()
 # recognizes the "X" as the 'title' in ../img_auth.php/X urls.
@@ -47,7 +46,6 @@ $wgArticlePath = false; # Don't let a "/*" article path clober our action path
 $wgActionPaths = array( "$wgUploadPath/" );
 
 wfImageAuthMain();
-wfProfileOut( 'img_auth.php' );
 wfLogProfilingData();
 // Commit and close up!
 $factory = wfGetLBFactory();
index 2521a65..3a21e25 100644 (file)
@@ -60,7 +60,6 @@ class Category {
                        return true;
                }
 
-
                $dbr = wfGetDB( DB_SLAVE );
                $row = $dbr->selectRow(
                        'category',
@@ -69,7 +68,6 @@ class Category {
                        __METHOD__
                );
 
-
                if ( !$row ) {
                        # Okay, there were no contents.  Nothing to initialize.
                        if ( $this->mTitle ) {
@@ -281,7 +279,6 @@ class Category {
                        )
                );
 
-
                return $result;
        }
 
@@ -314,7 +311,6 @@ class Category {
                        }
                }
 
-
                $dbw = wfGetDB( DB_MASTER );
                $dbw->startAtomic( __METHOD__ );
 
@@ -358,7 +354,6 @@ class Category {
                );
                $dbw->endAtomic( __METHOD__ );
 
-
                # Now we should update our local counts.
                $this->mPages = $result->pages;
                $this->mSubcats = $result->subcats;
index 7e5c857..ee462d8 100644 (file)
@@ -5433,11 +5433,6 @@ $wgUDPProfilerPort = null;
  */
 $wgUDPProfilerFormatString = null;
 
-/**
- * Output debug message on every wfProfileIn/wfProfileOut
- */
-$wgDebugFunctionEntry = false;
-
 /**
  * Destination for wfIncrStats() data...
  * 'cache' to go into the system cache, if enabled (memcached)
index 6497c40..cb79fd1 100644 (file)
@@ -515,8 +515,6 @@ class EditPage {
                        return;
                }
 
-               wfProfileIn( __METHOD__ . "-business-end" );
-
                $this->isConflict = false;
                // css / js subpages of user pages get a special treatment
                $this->isCssJsSubpage = $this->mTitle->isCssJsSubpage();
@@ -537,7 +535,6 @@ class EditPage {
 
                if ( 'save' == $this->formtype ) {
                        if ( !$this->attemptSave() ) {
-                               wfProfileOut( __METHOD__ . "-business-end" );
                                return;
                        }
                }
@@ -547,7 +544,6 @@ class EditPage {
                if ( 'initial' == $this->formtype || $this->firsttime ) {
                        if ( $this->initialiseForm() === false ) {
                                $this->noSuchSectionPage();
-                               wfProfileOut( __METHOD__ . "-business-end" );
                                return;
                        }
 
@@ -560,7 +556,6 @@ class EditPage {
                }
 
                $this->showEditForm();
-               wfProfileOut( __METHOD__ . "-business-end" );
        }
 
        /**
@@ -725,7 +720,6 @@ class EditPage {
        function importFormData( &$request ) {
                global $wgContLang, $wgUser;
 
-
                # Section edit can come from either the form or a link
                $this->section = $request->getVal( 'wpSection', $request->getVal( 'section' ) );
 
@@ -744,13 +738,10 @@ class EditPage {
                                // Skip this if wpTextbox2 has input, it indicates that we came
                                // from a conflict page with raw page text, not a custom form
                                // modified by subclasses
-                               wfProfileIn( get_class( $this ) . "::importContentFormData" );
                                $textbox1 = $this->importContentFormData( $request );
                                if ( $textbox1 !== null ) {
                                        $this->textbox1 = $textbox1;
                                }
-
-                               wfProfileOut( get_class( $this ) . "::importContentFormData" );
                        }
 
                        # Truncate for whole multibyte characters
@@ -982,7 +973,6 @@ class EditPage {
        protected function getContentObject( $def_content = null ) {
                global $wgOut, $wgRequest, $wgUser, $wgContLang;
 
-
                $content = false;
 
                // For message page not locally set, use the i18n message.
@@ -1526,13 +1516,10 @@ class EditPage {
 
                $status = Status::newGood();
 
-               wfProfileIn( __METHOD__ . '-checks' );
-
                if ( !Hooks::run( 'EditPage::attemptSave', array( $this ) ) ) {
                        wfDebug( "Hook 'EditPage::attemptSave' aborted article saving\n" );
                        $status->fatal( 'hookaborted' );
                        $status->value = self::AS_HOOK_ERROR;
-                       wfProfileOut( __METHOD__ . '-checks' );
                        return $status;
                }
 
@@ -1549,7 +1536,6 @@ class EditPage {
                        );
                        $status->fatal( 'spamprotectionmatch', false );
                        $status->value = self::AS_SPAM_ERROR;
-                       wfProfileOut( __METHOD__ . '-checks' );
                        return $status;
                }
 
@@ -1564,7 +1550,6 @@ class EditPage {
                                $ex->getMessage()
                        );
                        $status->value = self::AS_PARSE_ERROR;
-                       wfProfileOut( __METHOD__ . '-checks' );
                        return $status;
                }
 
@@ -1576,8 +1561,6 @@ class EditPage {
                                $code = $wgUser->isAnon() ? self::AS_IMAGE_REDIRECT_ANON : self::AS_IMAGE_REDIRECT_LOGGED;
                                $status->setResult( false, $code );
 
-                               wfProfileOut( __METHOD__ . '-checks' );
-
                                return $status;
                }
 
@@ -1606,7 +1589,6 @@ class EditPage {
                        wfDebugLog( 'SpamRegex', "$ip spam regex hit [[$pdbk]]: \"$match\"" );
                        $status->fatal( 'spamprotectionmatch', $match );
                        $status->value = self::AS_SPAM_ERROR;
-                       wfProfileOut( __METHOD__ . '-checks' );
                        return $status;
                }
                if ( !Hooks::run(
@@ -1616,13 +1598,11 @@ class EditPage {
                        # Error messages etc. could be handled within the hook...
                        $status->fatal( 'hookaborted' );
                        $status->value = self::AS_HOOK_ERROR;
-                       wfProfileOut( __METHOD__ . '-checks' );
                        return $status;
                } elseif ( $this->hookError != '' ) {
                        # ...or the hook could be expecting us to produce an error
                        $status->fatal( 'hookaborted' );
                        $status->value = self::AS_HOOK_ERROR_EXPECTED;
-                       wfProfileOut( __METHOD__ . '-checks' );
                        return $status;
                }
 
@@ -1631,7 +1611,6 @@ class EditPage {
                        $wgUser->spreadAnyEditBlock();
                        # Check block state against master, thus 'false'.
                        $status->setResult( false, self::AS_BLOCKED_PAGE_FOR_USER );
-                       wfProfileOut( __METHOD__ . '-checks' );
                        return $status;
                }
 
@@ -1640,19 +1619,16 @@ class EditPage {
                        // Error will be displayed by showEditForm()
                        $this->tooBig = true;
                        $status->setResult( false, self::AS_CONTENT_TOO_BIG );
-                       wfProfileOut( __METHOD__ . '-checks' );
                        return $status;
                }
 
                if ( !$wgUser->isAllowed( 'edit' ) ) {
                        if ( $wgUser->isAnon() ) {
                                $status->setResult( false, self::AS_READ_ONLY_PAGE_ANON );
-                               wfProfileOut( __METHOD__ . '-checks' );
                                return $status;
                        } else {
                                $status->fatal( 'readonlytext' );
                                $status->value = self::AS_READ_ONLY_PAGE_LOGGED;
-                               wfProfileOut( __METHOD__ . '-checks' );
                                return $status;
                        }
                }
@@ -1661,20 +1637,17 @@ class EditPage {
                        && !$wgUser->isAllowed( 'editcontentmodel' )
                ) {
                        $status->setResult( false, self::AS_NO_CHANGE_CONTENT_MODEL );
-                       wfProfileOut( __METHOD__ . '-checks' );
                        return $status;
                }
 
                if ( wfReadOnly() ) {
                        $status->fatal( 'readonlytext' );
                        $status->value = self::AS_READ_ONLY_PAGE;
-                       wfProfileOut( __METHOD__ . '-checks' );
                        return $status;
                }
                if ( $wgUser->pingLimiter() || $wgUser->pingLimiter( 'linkpurge', 0 ) ) {
                        $status->fatal( 'actionthrottledtext' );
                        $status->value = self::AS_RATE_LIMITED;
-                       wfProfileOut( __METHOD__ . '-checks' );
                        return $status;
                }
 
@@ -1682,12 +1655,9 @@ class EditPage {
                # confirmation
                if ( $this->wasDeletedSinceLastEdit() && !$this->recreate ) {
                        $status->setResult( false, self::AS_ARTICLE_WAS_DELETED );
-                       wfProfileOut( __METHOD__ . '-checks' );
                        return $status;
                }
 
-               wfProfileOut( __METHOD__ . '-checks' );
-
                # Load the page data from the master. If anything changes in the meantime,
                # we detect it by using page_latest like a token in a 1 try compare-and-swap.
                $this->mArticle->loadPageData( 'fromdbmaster' );
@@ -1859,7 +1829,6 @@ class EditPage {
                        }
 
                        # All's well
-                       wfProfileIn( __METHOD__ . '-sectionanchor' );
                        $sectionanchor = '';
                        if ( $this->section == 'new' ) {
                                $this->summary = $this->newSectionSummary( $sectionanchor );
@@ -1876,7 +1845,6 @@ class EditPage {
                                }
                        }
                        $result['sectionanchor'] = $sectionanchor;
-                       wfProfileOut( __METHOD__ . '-sectionanchor' );
 
                        // Save errors may fall down to the edit form, but we've now
                        // merged the section into full text. Clear the section field
@@ -2328,7 +2296,6 @@ class EditPage {
        function showEditForm( $formCallback = null ) {
                global $wgOut, $wgUser;
 
-
                # need to parse the preview early so that we know which templates are used,
                # otherwise users with "show preview after edit box" will get a blank list
                # we parse this near the beginning so that setHeaders can do the title
@@ -3202,7 +3169,6 @@ HTML
                        return '';
                }
 
-
                $limitReport = Html::rawElement( 'div', array( 'class' => 'mw-limitReportExplanation' ),
                        wfMessage( 'limitreport-title' )->parseAsBlock()
                );
@@ -3237,7 +3203,6 @@ HTML
                        Html::closeElement( 'table' ) .
                        Html::closeElement( 'div' );
 
-
                return $limitReport;
        }
 
@@ -3423,7 +3388,6 @@ HTML
                global $wgOut, $wgUser, $wgRawHtml, $wgLang;
                global $wgAllowUserCss, $wgAllowUserJs;
 
-
                if ( $wgRawHtml && !$this->mTokenOk ) {
                        // Could be an offsite preview attempt. This is very unsafe if
                        // HTML is enabled, as it could be an attack.
index 7936b37..15fdbc5 100644 (file)
@@ -127,7 +127,6 @@ class FeedUtils {
                }
 
                if ( $oldid ) {
-                       wfProfileIn( __METHOD__ . "-dodiff" );
 
                        #$diffText = $de->getDiff( wfMessage( 'revisionasof',
                        #       $wgLang->timeanddate( $timestamp ),
@@ -168,7 +167,6 @@ class FeedUtils {
                                $diffText = UtfNormal::cleanUp( $diffText );
                                $diffText = self::applyDiffStyle( $diffText );
                        }
-                       wfProfileOut( __METHOD__ . "-dodiff" );
                } else {
                        $rev = Revision::newFromId( $newid );
                        if ( $wgFeedDiffCutoff <= 0 || is_null( $rev ) ) {
index 77b8d35..b2926d1 100644 (file)
@@ -261,7 +261,6 @@ class HtmlFormatter {
        public function getText( $element = null ) {
 
                if ( $this->doc ) {
-                       wfProfileIn( __METHOD__ . '-dom' );
                        if ( $element !== null && !( $element instanceof DOMElement ) ) {
                                $element = $this->doc->getElementById( $element );
                        }
@@ -277,9 +276,7 @@ class HtmlFormatter {
                                $body->appendChild( $element );
                        }
                        $html = $this->doc->saveHTML();
-                       wfProfileOut( __METHOD__ . '-dom' );
 
-                       wfProfileIn( __METHOD__ . '-fixes' );
                        $html = $this->fixLibXml( $html );
                        if ( wfIsWindows() ) {
                                // Cleanup for CRLF misprocessing of unknown origin on Windows.
@@ -288,7 +285,6 @@ class HtmlFormatter {
                                // XML code paths if possible and fix there.
                                $html = str_replace( '&#13;', '', $html );
                        }
-                       wfProfileOut( __METHOD__ . '-fixes' );
                } else {
                        $html = $this->html;
                }
@@ -296,12 +292,10 @@ class HtmlFormatter {
                $html = preg_replace( '/<!--.*?-->|^.*?<body>|<\/body>.*$/s', '', $html );
                $html = $this->onHtmlReady( $html );
 
-               wfProfileIn( __METHOD__ . '-flatten' );
                if ( $this->elementsToFlatten ) {
                        $elements = implode( '|', $this->elementsToFlatten );
                        $html = preg_replace( "#</?($elements)\\b[^>]*>#is", '', $html );
                }
-               wfProfileOut( __METHOD__ . '-flatten' );
 
                return $html;
        }
index 3749b1c..d066df8 100644 (file)
@@ -59,7 +59,6 @@ class Http {
         */
        public static function request( $method, $url, $options = array() ) {
                wfDebug( "HTTP: $method: $url\n" );
-               wfProfileIn( __METHOD__ . "-$method" );
 
                $options['method'] = strtoupper( $method );
 
@@ -77,7 +76,6 @@ class Http {
                if ( $status->isOK() ) {
                        $content = $req->getContent();
                }
-               wfProfileOut( __METHOD__ . "-$method" );
                return $content;
        }
 
@@ -788,7 +786,6 @@ class CurlHttpRequest extends MWHttpRequest {
                $this->parseHeader();
                $this->setStatus();
 
-
                return $this->status;
        }
 
@@ -955,7 +952,6 @@ class PhpHttpRequest extends MWHttpRequest {
                }
                fclose( $fh );
 
-
                return $this->status;
        }
 }
index b806619..10c6804 100644 (file)
@@ -218,7 +218,6 @@ class Linker {
                $target = self::normaliseSpecialPage( $target );
 
                # If we don't know whether the page exists, let's find out.
-               wfProfileIn( __METHOD__ . '-checkPageExistence' );
                if ( !in_array( 'known', $options ) && !in_array( 'broken', $options ) ) {
                        if ( $target->isKnown() ) {
                                $options[] = 'known';
@@ -226,7 +225,6 @@ class Linker {
                                $options[] = 'broken';
                        }
                }
-               wfProfileOut( __METHOD__ . '-checkPageExistence' );
 
                $oldquery = array();
                if ( in_array( "forcearticlepath", $options ) && $query ) {
@@ -319,7 +317,6 @@ class Linker {
                $defaults = array();
 
                if ( !in_array( 'noclasses', $options ) ) {
-                       wfProfileIn( __METHOD__ . '-getClasses' );
                        # Now build the classes.
                        $classes = array();
 
@@ -340,7 +337,6 @@ class Linker {
                        if ( $classes != array() ) {
                                $defaults['class'] = implode( ' ', $classes );
                        }
-                       wfProfileOut( __METHOD__ . '-getClasses' );
                }
 
                # Get a default title attribute.
@@ -2317,7 +2313,6 @@ class Linker {
        ) {
                wfDeprecated( __METHOD__, '1.21' );
 
-
                if ( $text == '' ) {
                        $text = self::linkText( $title );
                }
index 7adaca0..d94443b 100644 (file)
@@ -157,7 +157,6 @@ class MediaWiki {
        private function performRequest() {
                global $wgTitle;
 
-
                $request = $this->context->getRequest();
                $requestTitle = $title = $this->context->getTitle();
                $output = $this->context->getOutput();
@@ -457,7 +456,6 @@ class MediaWiki {
                                        echo "Waiting for a database server: $lag seconds lagged\n";
                                }
 
-
                                exit;
                        }
                }
@@ -467,7 +465,6 @@ class MediaWiki {
        private function main() {
                global $wgTitle;
 
-
                $request = $this->context->getRequest();
 
                // Send Ajax requests to the Ajax dispatcher.
@@ -536,7 +533,6 @@ class MediaWiki {
                }
 
                if ( $this->config->get( 'UseFileCache' ) && $title->getNamespace() >= 0 ) {
-                       wfProfileIn( 'main-try-filecache' );
                        if ( HTMLFileCache::useFileCache( $this->context ) ) {
                                // Try low-level file cache hit
                                $cache = new HTMLFileCache( $title, $action );
@@ -551,11 +547,9 @@ class MediaWiki {
                                        $this->context->getWikiPage()->doViewUpdates( $this->context->getUser() );
                                        // Tell OutputPage that output is taken care of
                                        $this->context->getOutput()->disable();
-                                       wfProfileOut( 'main-try-filecache' );
                                        return;
                                }
                        }
-                       wfProfileOut( 'main-try-filecache' );
                }
 
                // Actually do the work of the request and build up any output
@@ -604,7 +598,6 @@ class MediaWiki {
                        return; // recursion guard
                }
 
-
                if ( $jobRunRate < 1 ) {
                        $max = mt_getrandmax();
                        if ( mt_rand( 0, $max ) > $max * $jobRunRate ) {
index 7b79506..4e14b7b 100644 (file)
@@ -1685,7 +1685,6 @@ class OutputPage extends ContextSource {
        ) {
                global $wgParser;
 
-
                $popts = $this->parserOptions();
                $oldTidy = $popts->setTidy( $tidy );
                $popts->setInterfaceMessage( (bool)$interface );
@@ -2171,7 +2170,6 @@ class OutputPage extends ContextSource {
                        return;
                }
 
-
                $response = $this->getRequest()->response();
                $config = $this->getConfig();
 
@@ -2619,7 +2617,6 @@ class OutputPage extends ContextSource {
        public function headElement( Skin $sk, $includeStyle = true ) {
                global $wgContLang;
 
-
                $userdir = $this->getLanguage()->getDir();
                $sitedir = $wgContLang->getDir();
 
index 6ec7eaf..c8015e6 100644 (file)
@@ -1325,7 +1325,6 @@ class Revision implements IDBAccessObject {
        public function insertOn( $dbw ) {
                global $wgDefaultExternalStore, $wgContentHandlerUseDB;
 
-
                $this->checkContentModel();
 
                $data = $this->mText;
@@ -1536,7 +1535,6 @@ class Revision implements IDBAccessObject {
                        $wgMemc->set( $key, $text, $wgRevisionCacheExpiry );
                }
 
-
                return $text;
        }
 
@@ -1558,7 +1556,6 @@ class Revision implements IDBAccessObject {
        public static function newNullRevision( $dbw, $pageId, $summary, $minor, $user = null ) {
                global $wgContentHandlerUseDB;
 
-
                $fields = array( 'page_latest', 'page_namespace', 'page_title',
                                                'rev_text_id', 'rev_len', 'rev_sha1' );
 
index e173e6a..6942ac0 100644 (file)
@@ -372,7 +372,6 @@ class Sanitizer {
                static $htmlpairsStatic, $htmlsingle, $htmlsingleonly, $htmlnest, $tabletags,
                        $htmllist, $listtags, $htmlsingleallowed, $htmlelementsStatic, $staticInitialised;
 
-
                // Base our staticInitialised variable off of the global config state so that if the globals
                // are changed (like in the screwed up test system) we will re-initialise the settings.
                $globalContext = implode( '-', compact( 'wgAllowMicrodataAttributes', 'wgAllowImageTag' ) );
index d69006e..a52b25b 100644 (file)
@@ -52,9 +52,7 @@ class StreamFile {
                if ( $res == self::NOT_MODIFIED ) {
                        $ok = true; // use client cache
                } elseif ( $res == self::READY_STREAM ) {
-                       wfProfileIn( __METHOD__ . '-send' );
                        $ok = readfile( $fname );
-                       wfProfileOut( __METHOD__ . '-send' );
                } else {
                        $ok = false; // failed
                }
index adca862..2dfcdc2 100644 (file)
@@ -150,10 +150,8 @@ class StubObject {
 
                if ( get_class( $GLOBALS[$this->global] ) != $this->class ) {
                        $fname = __METHOD__ . '-' . $this->global;
-                       wfProfileIn( $fname );
                        $caller = wfGetCaller( $level );
                        if ( ++$recursionLevel > 2 ) {
-                               wfProfileOut( $fname );
                                throw new MWException( "Unstub loop detected on call of "
                                        . "\${$this->global}->$name from $caller\n" );
                        }
@@ -161,7 +159,6 @@ class StubObject {
                                . "\${$this->global}::$name from $caller\n" );
                        $GLOBALS[$this->global] = $this->_newObject();
                        --$recursionLevel;
-                       wfProfileOut( $fname );
                        return $GLOBALS[$this->global];
                }
        }
index 2adda65..0cac64a 100644 (file)
@@ -2717,7 +2717,6 @@ class Title {
                        return array( $this->mHasCascadingRestrictions, $pagerestrictions );
                }
 
-
                $dbr = wfGetDB( DB_SLAVE );
 
                if ( $this->getNamespace() == NS_FILE ) {
index 62f7ec0..7ca7d80 100644 (file)
@@ -1706,7 +1706,6 @@ class User implements IDBAccessObject {
                }
 
                global $wgMemc;
-               wfProfileIn( __METHOD__ . '-' . $action );
 
                $limits = $wgRateLimits[$action];
                $keys = array();
@@ -1787,7 +1786,6 @@ class User implements IDBAccessObject {
                        }
                }
 
-               wfProfileOut( __METHOD__ . '-' . $action );
                return $triggered;
        }
 
@@ -3794,7 +3792,6 @@ class User implements IDBAccessObject {
        public function checkPassword( $password ) {
                global $wgAuth, $wgLegacyEncoding;
 
-
                $this->loadPasswords();
 
                // Certain authentication plugins do NOT want to save
index bc1ca50..125e544 100644 (file)
@@ -74,7 +74,6 @@ if ( file_exists( "$IP/StartProfiler.php" ) ) {
        require "$IP/StartProfiler.php";
 }
 
-wfProfileIn( 'WebStart.php-conf' );
 
 # Load default settings
 require_once "$IP/includes/DefaultSettings.php";
@@ -107,9 +106,7 @@ if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
        require_once MW_CONFIG_FILE;
 }
 
-wfProfileOut( 'WebStart.php-conf' );
 
-wfProfileIn( 'WebStart.php-ob_start' );
 # Initialise output buffering
 # Check that there is no previous output or previously set up buffers, because
 # that would cause us to potentially mix gzip and non-gzip output, creating a
@@ -118,7 +115,6 @@ if ( ob_get_level() == 0 ) {
        require_once "$IP/includes/OutputHandler.php";
        ob_start( 'wfOutputHandler' );
 }
-wfProfileOut( 'WebStart.php-ob_start' );
 
 if ( !defined( 'MW_NO_SETUP' ) ) {
        require_once "$IP/includes/Setup.php";
index c07ac73..78b8715 100644 (file)
@@ -94,9 +94,7 @@ class Xml {
                        $attribs = array_map( array( 'UtfNormal', 'cleanUp' ), $attribs );
                }
                if ( $contents ) {
-                       wfProfileIn( __METHOD__ . '-norm' );
                        $contents = $wgContLang->normalize( $contents );
-                       wfProfileOut( __METHOD__ . '-norm' );
                }
                return self::element( $element, $attribs, $contents );
        }
index 69c856d..c19e8fa 100644 (file)
@@ -49,7 +49,6 @@ class CreditsAction extends FormlessAction {
                        $s = $this->getCredits( -1 );
                }
 
-
                return Html::rawElement( 'div', array( 'id' => 'mw-credits' ), $s );
        }
 
@@ -70,7 +69,6 @@ class CreditsAction extends FormlessAction {
                        }
                }
 
-
                return $s;
        }
 
index 06f3bae..1e2f889 100644 (file)
@@ -102,7 +102,6 @@ class HistoryAction extends FormlessAction {
                        return; // Client cache fresh and headers sent, nothing more to do.
                }
 
-
                $this->preCacheMessages();
                $config = $this->context->getConfig();
 
index 948d289..9e4a150 100644 (file)
@@ -746,7 +746,6 @@ class InfoAction extends FormlessAction {
                        __METHOD__
                );
 
-
                return $result;
        }
 
index 87c88fb..3a31b2a 100644 (file)
@@ -2181,6 +2181,10 @@ abstract class ApiBase extends ContextSource {
         * Profiling: total module execution time
         */
        private $mTimeIn = 0, $mModuleTime = 0;
+       /** @var ScopedCallback */
+       private $profile;
+       /** @var ScopedCallback */
+       private $dbProfile;
 
        /**
         * Get the name of the module as shown in the profiler log
@@ -2205,7 +2209,7 @@ abstract class ApiBase extends ContextSource {
                        ApiBase::dieDebug( __METHOD__, 'Called twice without calling profileOut()' );
                }
                $this->mTimeIn = microtime( true );
-               wfProfileIn( $this->getModuleProfileName() );
+               $this->profile = Profiler::instance()->scopedProfileIn( $this->getModuleProfileName() );
        }
 
        /**
@@ -2224,7 +2228,7 @@ abstract class ApiBase extends ContextSource {
 
                $this->mModuleTime += microtime( true ) - $this->mTimeIn;
                $this->mTimeIn = 0;
-               wfProfileOut( $this->getModuleProfileName() );
+               Profiler::instance()->scopedProfileOut( $this->profile );
        }
 
        /**
@@ -2271,7 +2275,8 @@ abstract class ApiBase extends ContextSource {
                        ApiBase::dieDebug( __METHOD__, 'Called twice without calling profileDBOut()' );
                }
                $this->mDBTimeIn = microtime( true );
-               wfProfileIn( $this->getModuleProfileName( true ) );
+
+               $this->dbProfile = Profiler::instance()->scopedProfileIn( $this->getModuleProfileName( true ) );
        }
 
        /**
@@ -2291,7 +2296,7 @@ abstract class ApiBase extends ContextSource {
 
                $this->mDBTime += $time;
                $this->getMain()->mDBTime += $time;
-               wfProfileOut( $this->getModuleProfileName( true ) );
+               Profiler::instance()->scopedProfileOut( $this->dbProfile );
        }
 
        /**
index 74d1d9a..83d2cbc 100644 (file)
@@ -426,7 +426,6 @@ class ApiParse extends ApiBase {
                $popts->setIsSectionPreview( $params['sectionpreview'] );
                $popts->setEditSection( !$params['disableeditsection'] );
 
-
                return $popts;
        }
 
index 4f35c90..c6d9a18 100644 (file)
@@ -230,7 +230,6 @@ class BacklinkCache {
                        }
                }
 
-
                return $res;
        }
 
index 492905a..eace1ee 100644 (file)
@@ -218,7 +218,6 @@ class LinkCache {
        public function addLinkObj( $nt ) {
                global $wgContentHandlerUseDB;
 
-
                $key = $nt->getPrefixedDBkey();
                if ( $this->isBadLink( $key ) || $nt->isExternal() ) {
 
@@ -259,7 +258,6 @@ class LinkCache {
                        $id = 0;
                }
 
-
                return $id;
        }
 
index 16aedb2..e270f5f 100644 (file)
@@ -257,9 +257,7 @@ class LocalisationCache {
         */
        public function getItem( $code, $key ) {
                if ( !isset( $this->loadedItems[$code][$key] ) ) {
-                       wfProfileIn( __METHOD__ . '-load' );
                        $this->loadItem( $code, $key );
-                       wfProfileOut( __METHOD__ . '-load' );
                }
 
                if ( $key === 'fallback' && isset( $this->shallowFallbacks[$code] ) ) {
@@ -280,9 +278,7 @@ class LocalisationCache {
                if ( !isset( $this->loadedSubitems[$code][$key][$subkey] ) &&
                        !isset( $this->loadedItems[$code][$key] )
                ) {
-                       wfProfileIn( __METHOD__ . '-load' );
                        $this->loadSubitem( $code, $key, $subkey );
-                       wfProfileOut( __METHOD__ . '-load' );
                }
 
                if ( isset( $this->data[$code][$key][$subkey] ) ) {
@@ -563,7 +559,6 @@ class LocalisationCache {
                        }
                }
 
-
                // The JSON format only supports messages, none of the other variables, so wrap the data
                return array( 'messages' => $data );
        }
@@ -709,7 +704,6 @@ class LocalisationCache {
                $deps['plurals'] = new FileDependency( "$IP/languages/data/plurals.xml" );
                $deps['plurals-mw'] = new FileDependency( "$IP/languages/data/plurals-mediawiki.xml" );
 
-
                return $data;
        }
 
@@ -859,8 +853,6 @@ class LocalisationCache {
                $codeSequence = array_merge( array( $code ), $coreData['fallbackSequence'] );
                $messageDirs = $this->getMessagesDirs();
 
-               wfProfileIn( __METHOD__ . '-fallbacks' );
-
                # Load non-JSON localisation data for extensions
                $extensionData = array_combine(
                        $codeSequence,
@@ -957,8 +949,6 @@ class LocalisationCache {
                        }
                }
 
-               wfProfileOut( __METHOD__ . '-fallbacks' );
-
                # Add cache dependencies for any referenced globals
                $deps['wgExtensionMessagesFiles'] = new GlobalDependency( 'wgExtensionMessagesFiles' );
                // $wgMessagesDirs is used in LocalisationCache::getMessagesDirs()
@@ -1014,7 +1004,6 @@ class LocalisationCache {
                }
 
                # Save to the persistent cache
-               wfProfileIn( __METHOD__ . '-write' );
                $this->store->startWrite( $code );
                foreach ( $allData as $key => $value ) {
                        if ( in_array( $key, self::$splitKeys ) ) {
@@ -1026,7 +1015,6 @@ class LocalisationCache {
                        }
                }
                $this->store->finishWrite();
-               wfProfileOut( __METHOD__ . '-write' );
 
                # Clear out the MessageBlobStore
                # HACK: If using a null (i.e. disabled) storage backend, we
index 31f410e..04f5887 100644 (file)
@@ -275,7 +275,6 @@ class MessageCache {
                # Hash of the contents is stored in memcache, to detect if local cache goes
                # out of date (e.g. due to replace() on some other server)
                if ( $wgUseLocalMessageCache ) {
-                       wfProfileIn( __METHOD__ . '-fromlocal' );
 
                        $hash = $this->mMemc->get( wfMemcKey( 'messages', $code, 'hash' ) );
                        if ( $hash ) {
@@ -291,7 +290,6 @@ class MessageCache {
                                        $this->mCache[$code] = $cache;
                                }
                        }
-                       wfProfileOut( __METHOD__ . '-fromlocal' );
                }
 
                if ( !$success ) {
@@ -299,7 +297,6 @@ class MessageCache {
                        # the lock can't be acquired, wait for the other thread to finish
                        # and then try the global cache a second time.
                        for ( $failedAttempts = 0; $failedAttempts < 2; $failedAttempts++ ) {
-                               wfProfileIn( __METHOD__ . '-fromcache' );
                                $cache = $this->mMemc->get( $cacheKey );
                                if ( !$cache ) {
                                        $where[] = 'global cache is empty';
@@ -313,8 +310,6 @@ class MessageCache {
                                        $success = true;
                                }
 
-                               wfProfileOut( __METHOD__ . '-fromcache' );
-
                                if ( $success ) {
                                        # Done, no need to retry
                                        break;
@@ -621,7 +616,6 @@ class MessageCache {
                        $this->saveToLocal( $serialized, $hash, $code );
                }
 
-
                return $success;
        }
 
@@ -699,7 +693,6 @@ class MessageCache {
        function get( $key, $useDB = true, $langcode = true, $isFullKey = false ) {
                global $wgContLang;
 
-
                if ( is_int( $key ) ) {
                        // Fix numerical strings that somehow become ints
                        // on their way here
@@ -1062,7 +1055,6 @@ class MessageCache {
                $res = $parser->parse( $text, $title, $popts, $linestart );
                $this->mInParser = false;
 
-
                return $res;
        }
 
index b39bca3..2cee726 100644 (file)
@@ -109,7 +109,6 @@ class EnhancedChangesList extends ChangesList {
                $cacheEntry = $this->cacheEntryFactory->newFromRecentChange( $baseRC, $watched );
                $this->addCacheEntry( $cacheEntry );
 
-
                return $ret;
        }
 
@@ -466,7 +465,6 @@ class EnhancedChangesList extends ChangesList {
 
                $this->rcCacheIndex++;
 
-
                return $r;
        }
 
@@ -548,7 +546,6 @@ class EnhancedChangesList extends ChangesList {
 
                $r .= "</td></tr></table>\n";
 
-
                return $r;
        }
 
@@ -563,7 +560,6 @@ class EnhancedChangesList extends ChangesList {
                        return '';
                }
 
-
                $blockOut = '';
                foreach ( $this->rc_cache as $block ) {
                        if ( count( $block ) < 2 ) {
@@ -573,7 +569,6 @@ class EnhancedChangesList extends ChangesList {
                        }
                }
 
-
                return '<div>' . $blockOut . '</div>';
        }
 
index 2797d81..4ce564d 100644 (file)
@@ -59,7 +59,6 @@ class OldChangesList extends ChangesList {
                        return false;
                }
 
-
                $dateheader = ''; // $html now contains only <li>...</li>, for hooks' convenience.
                $this->insertDateHeader( $dateheader, $rc->mAttribs['rc_timestamp'] );
 
index e774735..dbe09f9 100644 (file)
@@ -104,7 +104,6 @@ class WikitextContent extends TextContent {
 
                $newContent = new static( $text );
 
-
                return $newContent;
        }
 
index a0e7f99..89ccd0b 100644 (file)
@@ -361,7 +361,6 @@ class RequestContext implements IContextSource {
         */
        public function getSkin() {
                if ( $this->skin === null ) {
-                       wfProfileIn( __METHOD__ . '-createskin' );
 
                        $skin = null;
                        Hooks::run( 'RequestContextCreateSkin', array( $this, &$skin ) );
@@ -399,7 +398,6 @@ class RequestContext implements IContextSource {
 
                        // After all that set a context on whatever skin got created
                        $this->skin->setContext( $this );
-                       wfProfileOut( __METHOD__ . '-createskin' );
                }
 
                return $this->skin;
index 7cd5525..f02aa93 100644 (file)
@@ -71,8 +71,6 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                $this->mPassword = $password;
                $this->mDBname = $dbName;
 
-               wfProfileIn( "dbconnect-$server" );
-
                # The kernel's default SYN retransmission period is far too slow for us,
                # so we use a short timeout plus a manual retry. Retrying means that a small
                # but finite rate of SYN packet loss won't cause user-visible errors.
@@ -81,14 +79,11 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                try {
                        $this->mConn = $this->mysqlConnect( $realServer );
                } catch ( Exception $ex ) {
-                       wfProfileOut( "dbconnect-$server" );
                        $this->restoreErrorHandler();
                        throw $ex;
                }
                $error = $this->restoreErrorHandler();
 
-               wfProfileOut( "dbconnect-$server" );
-
                # Always log connection errors
                if ( !$this->mConn ) {
                        if ( !$error ) {
@@ -105,7 +100,6 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                                "Server: $server, User: $user, Password: " .
                                substr( $password, 0, 3 ) . "..., error: " . $error . "\n" );
 
-
                        $this->reportConnectionError( $error );
                }
 
@@ -123,7 +117,6 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                                wfDebug( "Error selecting database $dbName on server {$this->mServer} " .
                                        "from client host " . wfHostname() . "\n" );
 
-
                                $this->reportConnectionError( "Error selecting database $dbName" );
                        }
                }
@@ -701,7 +694,6 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                        }
                }
 
-
                return $status;
        }
 
index f789d56..8618ae6 100644 (file)
@@ -501,7 +501,6 @@ class LoadBalancer {
                        return $this->reportConnectionError();
                }
 
-
                return $conn;
        }
 
index 39b9531..91840dd 100644 (file)
@@ -93,7 +93,6 @@ class LoadMonitorMySQL implements LoadMonitor {
                        return array( 0 => 0 );
                }
 
-
                $expiry = 5;
                $requestRate = 10;
 
index f0930d7..93c53ad 100644 (file)
@@ -82,7 +82,6 @@ class DeferredUpdates {
        public static function doUpdates( $commit = '' ) {
                global $wgDeferredUpdateList;
 
-
                $updates = array_merge( $wgDeferredUpdateList, self::$updates );
 
                // No need to get master connections in case of empty updates array
index 8de6974..ba14f09 100644 (file)
@@ -78,7 +78,6 @@ class SearchUpdate implements DeferrableUpdate {
                        return;
                }
 
-
                $page = WikiPage::newFromID( $this->id, WikiPage::READ_LATEST );
 
                foreach ( SearchEngine::getSearchTypes() as $type ) {
@@ -123,7 +122,6 @@ class SearchUpdate implements DeferrableUpdate {
                $text = $wgContLang->normalizeForSearch( $text );
                $lc = SearchEngine::legalSearchChars() . '&#;';
 
-               wfProfileIn( __METHOD__ . '-regexps' );
                $text = preg_replace( "/<\\/?\\s*[A-Za-z][^>]*?>/",
                        ' ', $wgContLang->lc( " " . $text . " " ) ); # Strip HTML markup
                $text = preg_replace( "/(^|\\n)==\\s*([^\\n]+)\\s*==(\\s)/sD",
@@ -170,7 +168,6 @@ class SearchUpdate implements DeferrableUpdate {
 
                # Strip wiki '' and '''
                $text = preg_replace( "/''[']*/", " ", $text );
-               wfProfileOut( __METHOD__ . '-regexps' );
 
                return $text;
        }
index 78fbee1..950a264 100644 (file)
@@ -110,7 +110,6 @@ class SquidUpdate {
                        self::HTCPPurge( $urlArr );
                }
 
-
                // Remove duplicate URLs
                $urlArr = array_unique( $urlArr );
                // Maximum number of parallel connections per squid
index 3229719..90a2785 100644 (file)
@@ -842,10 +842,8 @@ class DifferenceEngine extends ContextSource {
                if ( $wgExternalDiffEngine == 'wikidiff2' && function_exists( 'wikidiff2_do_diff' ) ) {
                        # Better external diff engine, the 2 may some day be dropped
                        # This one does the escaping and segmenting itself
-                       wfProfileIn( 'wikidiff2_do_diff' );
                        $text = wikidiff2_do_diff( $otext, $ntext, 2 );
                        $text .= $this->debug( 'wikidiff2' );
-                       wfProfileOut( 'wikidiff2_do_diff' );
 
                        return $text;
                }
@@ -870,10 +868,8 @@ class DifferenceEngine extends ContextSource {
                        fclose( $tempFile1 );
                        fclose( $tempFile2 );
                        $cmd = wfEscapeShellArg( $wgExternalDiffEngine, $tempName1, $tempName2 );
-                       wfProfileIn( __METHOD__ . "-shellexec" );
                        $difftext = wfShellExec( $cmd );
                        $difftext .= $this->debug( "external $wgExternalDiffEngine" );
-                       wfProfileOut( __METHOD__ . "-shellexec" );
                        unlink( $tempName1 );
                        unlink( $tempName2 );
 
index 06c43ec..6ee9b2e 100644 (file)
@@ -145,7 +145,6 @@ class FSFile {
                        wfDebug( __METHOD__ . ": $this->path NOT FOUND!\n" );
                }
 
-
                return $info;
        }
 
@@ -213,7 +212,6 @@ class FSFile {
                        $this->sha1Base36 = wfBaseConvert( $this->sha1Base36, 16, 36, 31 );
                }
 
-
                return $this->sha1Base36;
        }
 
index 23d9f73..a3b0009 100644 (file)
@@ -644,9 +644,7 @@ abstract class FileBackendStore extends FileBackend {
                                }
                        }
                }
-               wfProfileIn( __METHOD__ . '-miss-' . $this->name );
                $stat = $this->doGetFileStat( $params );
-               wfProfileOut( __METHOD__ . '-miss-' . $this->name );
                if ( is_array( $stat ) ) { // file exists
                        // Strongly consistent backends can automatically set "latest"
                        $stat['latest'] = isset( $stat['latest'] ) ? $stat['latest'] : $latest;
@@ -718,12 +716,8 @@ abstract class FileBackendStore extends FileBackend {
                                return $stat['map'];
                        }
                }
-               wfProfileIn( __METHOD__ . '-miss' );
-               wfProfileIn( __METHOD__ . '-miss-' . $this->name );
                $fields = $this->doGetFileXAttributes( $params );
                $fields = is_array( $fields ) ? self::normalizeXAttributes( $fields ) : false;
-               wfProfileOut( __METHOD__ . '-miss-' . $this->name );
-               wfProfileOut( __METHOD__ . '-miss' );
                $this->cheapCache->set( $path, 'xattr', array( 'map' => $fields, 'latest' => $latest ) );
 
                return $fields;
@@ -752,9 +746,7 @@ abstract class FileBackendStore extends FileBackend {
                                return $stat['hash'];
                        }
                }
-               wfProfileIn( __METHOD__ . '-miss-' . $this->name );
                $hash = $this->doGetFileSha1Base36( $params );
-               wfProfileOut( __METHOD__ . '-miss-' . $this->name );
                $this->cheapCache->set( $path, 'sha1', array( 'hash' => $hash, 'latest' => $latest ) );
 
                return $hash;
@@ -865,9 +857,7 @@ abstract class FileBackendStore extends FileBackend {
                if ( $res == StreamFile::NOT_MODIFIED ) {
                        // do nothing; client cache is up to date
                } elseif ( $res == StreamFile::READY_STREAM ) {
-                       wfProfileIn( __METHOD__ . '-send-' . $this->name );
                        $status = $this->doStreamFile( $params );
-                       wfProfileOut( __METHOD__ . '-send-' . $this->name );
                        if ( !$status->isOK() ) {
                                // Per bug 41113, nasty things can happen if bad cache entries get
                                // stuck in cache. It's also possible that this error can come up
index 1f7ebc9..4fde124 100644 (file)
@@ -1285,13 +1285,11 @@ class SwiftFileBackend extends FileBackendStore {
                                return null;
                        }
 
-                       wfProfileIn( __METHOD__ . "-{$this->name}-miss" );
                        list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $this->http->run( array(
                                'method' => 'HEAD',
                                'url' => $this->storageUrl( $auth, $container ),
                                'headers' => $this->authTokenHeaders( $auth )
                        ) );
-                       wfProfileOut( __METHOD__ . "-{$this->name}-miss" );
 
                        if ( $rcode === 204 ) {
                                $stat = array(
index cfb3e3d..6d60012 100644 (file)
@@ -1070,7 +1070,6 @@ abstract class File {
                        }
                } while ( false );
 
-
                return is_object( $thumb ) ? $thumb : false;
        }
 
@@ -1100,9 +1099,7 @@ abstract class File {
                }
 
                // Actually render the thumbnail...
-               wfProfileIn( __METHOD__ . '-doTransform' );
                $thumb = $handler->doTransform( $this, $tmpThumbPath, $thumbUrl, $transformParams );
-               wfProfileOut( __METHOD__ . '-doTransform' );
                $tmpFile->bind( $thumb ); // keep alive with $thumb
 
                if ( !$thumb ) { // bad params?
index 30e31c3..b2e5b00 100644 (file)
@@ -278,7 +278,6 @@ class LocalFile extends File {
                        wfIncrStats( 'image_cache_miss' );
                }
 
-
                return $this->dataLoaded;
        }
 
@@ -1124,7 +1123,6 @@ class LocalFile extends File {
                }
 
                if ( !$props ) {
-                       wfProfileIn( __METHOD__ . '-getProps' );
                        if ( $this->repo->isVirtualUrl( $srcPath )
                                || FileBackend::isStoragePath( $srcPath )
                        ) {
@@ -1132,7 +1130,6 @@ class LocalFile extends File {
                        } else {
                                $props = FSFile::getPropsFromPath( $srcPath );
                        }
-                       wfProfileOut( __METHOD__ . '-getProps' );
                }
 
                $options = array();
@@ -1224,9 +1221,7 @@ class LocalFile extends File {
                $dbw->begin( __METHOD__ );
 
                if ( !$props ) {
-                       wfProfileIn( __METHOD__ . '-getProps' );
                        $props = $this->repo->getFileProps( $this->getVirtualUrl() );
-                       wfProfileOut( __METHOD__ . '-getProps' );
                }
 
                # Imports or such might force a certain timestamp; otherwise we generate
@@ -1382,7 +1377,6 @@ class LocalFile extends File {
                        // Page exists, do RC entry now (otherwise we wait for later).
                        $logEntry->publish( $logId );
                }
-               wfProfileIn( __METHOD__ . '-edit' );
 
                if ( $exists ) {
                        # Create a null revision
@@ -1449,22 +1443,16 @@ class LocalFile extends File {
                        $dbw->commit( __METHOD__ ); // commit before anything bad can happen
                }
 
-               wfProfileOut( __METHOD__ . '-edit' );
-
                if ( $reupload ) {
                        # Delete old thumbnails
-                       wfProfileIn( __METHOD__ . '-purge' );
                        $this->purgeThumbnails();
-                       wfProfileOut( __METHOD__ . '-purge' );
 
                        # Remove the old file from the squid cache
                        SquidUpdate::purge( array( $this->getURL() ) );
                }
 
                # Hooks, hooks, the magic of hooks...
-               wfProfileIn( __METHOD__ . '-hooks' );
                Hooks::run( 'FileUpload', array( $this, $reupload, $descTitle->exists() ) );
-               wfProfileOut( __METHOD__ . '-hooks' );
 
                # Invalidate cache for all pages using this file
                $update = new HTMLCacheUpdate( $this->getTitle(), 'imagelinks' );
@@ -1473,7 +1461,6 @@ class LocalFile extends File {
                        LinksUpdate::queueRecursiveJobsForTable( $this->getTitle(), 'imagelinks' );
                }
 
-
                return true;
        }
 
index 8e8d693..ce3b3ff 100644 (file)
@@ -129,7 +129,6 @@ class JobRunner {
                                $this->runJobsLog( $job->toString() . " STARTING" );
 
                                // Run the job...
-                               wfProfileIn( __METHOD__ . '-' . get_class( $job ) );
                                $jobStartTime = microtime( true );
                                try {
                                        ++$jobsRun;
@@ -143,7 +142,6 @@ class JobRunner {
                                        MWExceptionHandler::logException( $e );
                                }
                                $timeMs = intval( ( microtime( true ) - $jobStartTime ) * 1000 );
-                               wfProfileOut( __METHOD__ . '-' . get_class( $job ) );
                                $timeMsTotal += $timeMs;
 
                                // Mark the job as done on success or when the job cannot be retried
index 2a7ee2a..0b6db32 100644 (file)
@@ -94,6 +94,14 @@ class MapCacheLRU {
                }
        }
 
+       /**
+        * @return array
+        * @since 1.25
+        */
+       public function getAllKeys() {
+               return array_keys( $this->cache );
+       }
+
        /**
         * Clear one or several cache entries, or all cache entries
         *
index 98ff675..5ed67c7 100644 (file)
@@ -321,7 +321,7 @@ class Xhprof {
                                $this->complete[$func]['subcalls'] = array();
                        }
 
-                       foreach( $this->hieraData as $key => $stats ) {
+                       foreach ( $this->hieraData as $key => $stats ) {
                                list( $parent, $child ) = self::splitKey( $key );
                                if ( $parent !== null ) {
                                        // Track call tree information
index 4786165..49c9f23 100644 (file)
@@ -51,4 +51,4 @@ class ComposerJson {
                return $version;
        }
 
-}
\ No newline at end of file
+}
index 6baa180..81c4e38 100644 (file)
@@ -205,7 +205,6 @@ class EmailNotification {
                global $wgEnotifWatchlist;
                global $wgEnotifMinorEdits, $wgEnotifUserTalk;
 
-
                # The following code is only run, if several conditions are met:
                # 1. EmailNotification for pages (other than user_talk pages) must be enabled
                # 2. minor edits (changes) are only regarded if the global flag indicates so
index cd77f3e..eadcf94 100644 (file)
@@ -169,10 +169,8 @@ class BitmapHandler extends TransformationalImageHandler {
                        array( $this->escapeMagickOutput( $params['dstPath'] ) ) ) );
 
                wfDebug( __METHOD__ . ": running ImageMagick: $cmd\n" );
-               wfProfileIn( 'convert' );
                $retval = 0;
                $err = wfShellExecWithStderr( $cmd, $retval, $env );
-               wfProfileOut( 'convert' );
 
                if ( $retval !== 0 ) {
                        $this->logErrorForExternalProcess( $retval, $err, $cmd );
@@ -280,10 +278,8 @@ class BitmapHandler extends TransformationalImageHandler {
                $cmd = str_replace( '%h', wfEscapeShellArg( $params['physicalHeight'] ),
                        str_replace( '%w', wfEscapeShellArg( $params['physicalWidth'] ), $cmd ) ); # Size
                wfDebug( __METHOD__ . ": Running custom convert command $cmd\n" );
-               wfProfileIn( 'convert' );
                $retval = 0;
                $err = wfShellExecWithStderr( $cmd, $retval );
-               wfProfileOut( 'convert' );
 
                if ( $retval !== 0 ) {
                        $this->logErrorForExternalProcess( $retval, $err, $cmd );
@@ -457,10 +453,8 @@ class BitmapHandler extends TransformationalImageHandler {
                                        " -rotate " . wfEscapeShellArg( "-$rotation" ) . " " .
                                        wfEscapeShellArg( $this->escapeMagickOutput( $params['dstPath'] ) );
                                wfDebug( __METHOD__ . ": running ImageMagick: $cmd\n" );
-                               wfProfileIn( 'convert' );
                                $retval = 0;
                                $err = wfShellExecWithStderr( $cmd, $retval );
-                               wfProfileOut( 'convert' );
                                if ( $retval !== 0 ) {
                                        $this->logErrorForExternalProcess( $retval, $err, $cmd );
 
index 3072a62..1b0eb49 100644 (file)
@@ -221,11 +221,9 @@ class DjVuHandler extends ImageHandler {
                        $cmd .= " | {$wgDjvuPostProcessor}";
                }
                $cmd .= ' > ' . wfEscapeShellArg( $dstPath ) . ') 2>&1';
-               wfProfileIn( 'ddjvu' );
                wfDebug( __METHOD__ . ": $cmd\n" );
                $retval = '';
                $err = wfShellExec( $cmd, $retval );
-               wfProfileOut( 'ddjvu' );
 
                $removed = $this->removeBadFile( $dstPath, $retval );
                if ( $retval != 0 || $removed ) {
index 8ae60cc..016728d 100644 (file)
@@ -277,28 +277,22 @@ class DjVuImage {
                if ( isset( $wgDjvuDump ) ) {
                        # djvudump is faster as of version 3.5
                        # http://sourceforge.net/tracker/index.php?func=detail&aid=1704049&group_id=32953&atid=406583
-                       wfProfileIn( 'djvudump' );
                        $cmd = wfEscapeShellArg( $wgDjvuDump ) . ' ' . wfEscapeShellArg( $this->mFilename );
                        $dump = wfShellExec( $cmd );
                        $xml = $this->convertDumpToXML( $dump );
-                       wfProfileOut( 'djvudump' );
                } elseif ( isset( $wgDjvuToXML ) ) {
-                       wfProfileIn( 'djvutoxml' );
                        $cmd = wfEscapeShellArg( $wgDjvuToXML ) . ' --without-anno --without-text ' .
                                wfEscapeShellArg( $this->mFilename );
                        $xml = wfShellExec( $cmd );
-                       wfProfileOut( 'djvutoxml' );
                } else {
                        $xml = null;
                }
                # Text layer
                if ( isset( $wgDjvuTxt ) ) {
-                       wfProfileIn( 'djvutxt' );
                        $cmd = wfEscapeShellArg( $wgDjvuTxt ) . ' --detail=page ' . wfEscapeShellArg( $this->mFilename );
                        wfDebug( __METHOD__ . ": $cmd\n" );
                        $retval = '';
                        $txt = wfShellExec( $cmd, $retval, array(), array( 'memory' => self::DJVUTXT_MEMORY_LIMIT ) );
-                       wfProfileOut( 'djvutxt' );
                        if ( $retval == 0 ) {
                                # Strip some control characters
                                $txt = preg_replace( "/[\013\035\037]/", "", $txt );
index b755c5a..e8e73af 100644 (file)
@@ -1595,7 +1595,6 @@ class FormatMetadata extends ContextSource {
        public function fetchExtendedMetadata( File $file ) {
                global $wgMemc;
 
-
                // If revision deleted, exit immediately
                if ( $file->isDeleted( File::DELETED_FILE ) ) {
 
@@ -1632,7 +1631,6 @@ class FormatMetadata extends ContextSource {
                        $wgMemc->set( $cacheKey, $valueToCache, $maxCacheTime );
                }
 
-
                return $extendedMetadata;
        }
 
@@ -1654,7 +1652,6 @@ class FormatMetadata extends ContextSource {
                        return $file->getExtendedMetadata() ?: array();
                }
 
-
                $uploadDate = wfTimestamp( TS_ISO_8601, $file->getTimestamp() );
 
                $fileMetadata = array(
@@ -1693,7 +1690,6 @@ class FormatMetadata extends ContextSource {
                        }
                }
 
-
                return $fileMetadata;
        }
 
@@ -1726,7 +1722,6 @@ class FormatMetadata extends ContextSource {
                        }
                }
 
-
                return $extendedMetadata;
        }
 
index fbdbdfe..810b9af 100644 (file)
@@ -143,10 +143,8 @@ class JpegHandler extends ExifBitmapHandler {
                                " -outfile " . wfEscapeShellArg( $params['dstPath'] ) .
                                " " . wfEscapeShellArg( $params['srcPath'] );
                        wfDebug( __METHOD__ . ": running jpgtran: $cmd\n" );
-                       wfProfileIn( 'jpegtran' );
                        $retval = 0;
                        $err = wfShellExecWithStderr( $cmd, $retval );
-                       wfProfileOut( 'jpegtran' );
                        if ( $retval !== 0 ) {
                                $this->logErrorForExternalProcess( $retval, $err, $cmd );
 
index 74e5e04..3e8d9e5 100644 (file)
@@ -272,10 +272,8 @@ class SvgHandler extends ImageHandler {
                                        $env['LANG'] = $lang;
                                }
 
-                               wfProfileIn( 'rsvg' );
                                wfDebug( __METHOD__ . ": $cmd\n" );
                                $err = wfShellExecWithStderr( $cmd, $retval, $env );
-                               wfProfileOut( 'rsvg' );
                        }
                }
                $removed = $this->removeBadFile( $dstPath, $retval );
index 633b34a..62856f9 100644 (file)
@@ -135,7 +135,7 @@ class ObjectCache {
                } elseif ( function_exists( 'wincache_ucache_get' ) ) {
                        $id = 'wincache';
                } else {
-                       if ( $fallback ) {
+                       if ( $fallback !== null ) {
                                return self::newFromId( $fallback );
                        }
                        throw new MWException( "CACHE_ACCEL requested but no suitable object " .
index a8633e8..5a09e65 100644 (file)
@@ -342,7 +342,6 @@ class Article implements Page {
                        return $this->mContent;
                }
 
-
                $content = $this->fetchContentObject();
 
                if ( !$content ) {
@@ -353,7 +352,6 @@ class Article implements Page {
                $this->mContent = ContentHandler::getContentText( $content );
                ContentHandler::runLegacyHooks( 'ArticleAfterFetchContent', array( &$this, &$this->mContent ) );
 
-
                return $this->mContent;
        }
 
@@ -374,7 +372,6 @@ class Article implements Page {
                        return $this->mContentObject;
                }
 
-
                $this->mContentLoaded = true;
                $this->mContent = null;
 
@@ -421,7 +418,6 @@ class Article implements Page {
 
                Hooks::run( 'ArticleAfterFetchContentObject', array( &$this, &$this->mContentObject ) );
 
-
                return $this->mContentObject;
        }
 
@@ -472,7 +468,6 @@ class Article implements Page {
        public function view() {
                global $wgUseFileCache, $wgUseETag, $wgDebugToolbar, $wgMaxRedirects;
 
-
                # Get variables from query string
                # As side effect this will load the revision and update the title
                # in a revision ID is passed in the request, so this should remain
@@ -1080,7 +1075,6 @@ class Article implements Page {
                        return false;
                }
 
-
                // New page patrol: Get the timestamp of the oldest revison which
                // the revision table holds for the given page. Then we look
                // whether it's within the RC lifespan and if it is, we try
index a822945..fa54f7c 100644 (file)
@@ -1145,7 +1145,6 @@ class WikiPage implements Page, IDBAccessObject {
                $pool = new PoolWorkArticleView( $this, $parserOptions, $oldid, $useParserCache );
                $pool->execute();
 
-
                return $pool->getParserOutput();
        }
 
@@ -1264,7 +1263,6 @@ class WikiPage implements Page, IDBAccessObject {
        ) {
                global $wgContentHandlerUseDB;
 
-
                $content = $revision->getContent();
                $len = $content ? $content->getSize() : 0;
                $rt = $content ? $content->getUltimateRedirectTarget() : null;
@@ -1702,7 +1700,6 @@ class WikiPage implements Page, IDBAccessObject {
                        throw new MWException( 'Something is trying to edit an article with an empty title' );
                }
 
-
                if ( !$content->getContentHandler()->canBeUsedOn( $this->getTitle() ) ) {
                        return Status::newFatal( 'content-not-allowed-here',
                                ContentHandler::getLocalizedName( $content->getModel() ),
@@ -2132,7 +2129,6 @@ class WikiPage implements Page, IDBAccessObject {
        public function doEditUpdates( Revision $revision, User $user, array $options = array() ) {
                global $wgEnableParserCache;
 
-
                $options += array(
                        'changed' => true,
                        'created' => false,
index 5b6209e..7026c5c 100644 (file)
@@ -271,7 +271,6 @@ class LinkHolderArray {
                $this->replaceInternal( $text );
                $this->replaceInterwiki( $text );
 
-
        }
 
        /**
@@ -289,7 +288,6 @@ class LinkHolderArray {
                $linkCache = LinkCache::singleton();
                $output = $this->parent->getOutput();
 
-               wfProfileIn( __METHOD__ . '-check' );
                $dbr = wfGetDB( DB_SLAVE );
                $threshold = $this->parent->getOptions()->getStubThreshold();
 
@@ -375,7 +373,6 @@ class LinkHolderArray {
                        //pass an array of page_ids to an extension
                        Hooks::run( 'GetLinkColours', array( $linkcolour_ids, &$colours ) );
                }
-               wfProfileOut( __METHOD__ . '-check' );
 
                # Do a second query for different language variants of links and categories
                if ( $wgContLang->hasVariants() ) {
@@ -383,7 +380,6 @@ class LinkHolderArray {
                }
 
                # Construct search and replace arrays
-               wfProfileIn( __METHOD__ . '-construct' );
                $replacePairs = array();
                foreach ( $this->internals as $ns => $entries ) {
                        foreach ( $entries as $index => $entry ) {
@@ -419,17 +415,14 @@ class LinkHolderArray {
                        }
                }
                $replacer = new HashtableReplacer( $replacePairs, 1 );
-               wfProfileOut( __METHOD__ . '-construct' );
 
                # Do the thing
-               wfProfileIn( __METHOD__ . '-replace' );
                $text = preg_replace_callback(
                        '/(<!--LINK .*?-->)/',
                        $replacer->cb(),
                        $text
                );
 
-               wfProfileOut( __METHOD__ . '-replace' );
        }
 
        /**
index 3027ab6..7703c4b 100644 (file)
@@ -299,7 +299,6 @@ class Parser {
                }
                $this->mFirstCall = false;
 
-
                CoreParserFunctions::register( $this );
                CoreTagHooks::register( $this );
                $this->initialiseVariables();
@@ -395,7 +394,6 @@ class Parser {
 
                global $wgShowHostnames;
                $fname = __METHOD__ . '-' . wfGetCaller();
-               wfProfileIn( $fname );
 
                if ( $clearState ) {
                        $magicScopeVariable = $this->lock();
@@ -556,7 +554,6 @@ class Parser {
                $this->mRevisionSize = $oldRevisionSize;
                $this->mInputSize = false;
                $this->currentRevisionCache = null;
-               wfProfileOut( $fname );
 
                return $this->mOutput;
        }
@@ -1191,7 +1188,6 @@ class Parser {
                        $out = '';
                }
 
-
                return $out;
        }
 
@@ -2008,7 +2004,6 @@ class Parser {
        public function replaceInternalLinks2( &$s ) {
                global $wgExtraInterlanguageLinkPrefixes;
 
-               wfProfileIn( __METHOD__ . '-setup' );
                static $tc = false, $e1, $e1_img;
                # the % is needed to support urlencoded titles as well
                if ( !$tc ) {
@@ -2040,7 +2035,6 @@ class Parser {
                }
 
                if ( is_null( $this->mTitle ) ) {
-                       wfProfileOut( __METHOD__ . '-setup' );
                        throw new MWException( __METHOD__ . ": \$this->mTitle is null\n" );
                }
                $nottalk = !$this->mTitle->isTalkPage();
@@ -2057,7 +2051,6 @@ class Parser {
                }
 
                $useSubpages = $this->areSubpagesAllowed();
-               wfProfileOut( __METHOD__ . '-setup' );
 
                // @codingStandardsIgnoreStart Squiz.WhiteSpace.SemicolonSpacing.Incorrect
                # Loop for each link
@@ -2073,7 +2066,6 @@ class Parser {
                        }
 
                        if ( $useLinkPrefixExtension ) {
-                               wfProfileIn( __METHOD__ . '-prefixhandling' );
                                if ( preg_match( $e2, $s, $m ) ) {
                                        $prefix = $m[2];
                                        $s = $m[1];
@@ -2085,12 +2077,10 @@ class Parser {
                                        $prefix = $first_prefix;
                                        $first_prefix = false;
                                }
-                               wfProfileOut( __METHOD__ . '-prefixhandling' );
                        }
 
                        $might_be_img = false;
 
-                       wfProfileIn( __METHOD__ . "-e1" );
                        if ( preg_match( $e1, $line, $m ) ) { # page with normal text or alt
                                $text = $m[2];
                                # If we get a ] at the beginning of $m[3] that means we have a link that's something like:
@@ -2124,11 +2114,8 @@ class Parser {
                                $trail = "";
                        } else { # Invalid form; output directly
                                $s .= $prefix . '[[' . $line;
-                               wfProfileOut( __METHOD__ . "-e1" );
                                continue;
                        }
-                       wfProfileOut( __METHOD__ . "-e1" );
-                       wfProfileIn( __METHOD__ . "-misc" );
 
                        $origLink = $m[1];
 
@@ -2137,7 +2124,6 @@ class Parser {
                        # should be external links.
                        if ( preg_match( '/^(?i:' . $this->mUrlProtocols . ')/', $origLink ) ) {
                                $s .= $prefix . '[[' . $line;
-                               wfProfileOut( __METHOD__ . "-misc" );
                                continue;
                        }
 
@@ -2154,21 +2140,16 @@ class Parser {
                                $link = substr( $link, 1 );
                        }
 
-                       wfProfileOut( __METHOD__ . "-misc" );
-                       wfProfileIn( __METHOD__ . "-title" );
                        $nt = Title::newFromText( $this->mStripState->unstripNoWiki( $link ) );
                        if ( $nt === null ) {
                                $s .= $prefix . '[[' . $line;
-                               wfProfileOut( __METHOD__ . "-title" );
                                continue;
                        }
 
                        $ns = $nt->getNamespace();
                        $iw = $nt->getInterwiki();
-                       wfProfileOut( __METHOD__ . "-title" );
 
                        if ( $might_be_img ) { # if this is actually an invalid link
-                               wfProfileIn( __METHOD__ . "-might_be_img" );
                                if ( $ns == NS_FILE && $noforce ) { # but might be an image
                                        $found = false;
                                        while ( true ) {
@@ -2200,16 +2181,13 @@ class Parser {
                                                $holders->merge( $this->replaceInternalLinks2( $text ) );
                                                $s .= "{$prefix}[[$link|$text";
                                                # note: no $trail, because without an end, there *is* no trail
-                                               wfProfileOut( __METHOD__ . "-might_be_img" );
                                                continue;
                                        }
                                } else { # it's not an image, so output it raw
                                        $s .= "{$prefix}[[$link|$text";
                                        # note: no $trail, because without an end, there *is* no trail
-                                       wfProfileOut( __METHOD__ . "-might_be_img" );
                                        continue;
                                }
-                               wfProfileOut( __METHOD__ . "-might_be_img" );
                        }
 
                        $wasblank = ( $text == '' );
@@ -2226,7 +2204,6 @@ class Parser {
                        # Link not escaped by : , create the various objects
                        if ( $noforce && !$nt->wasLocalInterwiki() ) {
                                # Interwikis
-                               wfProfileIn( __METHOD__ . "-interwiki" );
                                if (
                                        $iw && $this->mOptions->getInterwikiMagic() && $nottalk && (
                                                Language::fetchLanguageName( $iw, null, 'mw' ) ||
@@ -2241,13 +2218,10 @@ class Parser {
 
                                        $s = rtrim( $s . $prefix );
                                        $s .= trim( $trail, "\n" ) == '' ? '': $prefix . $trail;
-                                       wfProfileOut( __METHOD__ . "-interwiki" );
                                        continue;
                                }
-                               wfProfileOut( __METHOD__ . "-interwiki" );
 
                                if ( $ns == NS_FILE ) {
-                                       wfProfileIn( __METHOD__ . "-image" );
                                        if ( !wfIsBadImage( $nt->getDBkey(), $this->mTitle ) ) {
                                                if ( $wasblank ) {
                                                        # if no parameters were passed, $text
@@ -2268,12 +2242,10 @@ class Parser {
                                        } else {
                                                $s .= $prefix . $trail;
                                        }
-                                       wfProfileOut( __METHOD__ . "-image" );
                                        continue;
                                }
 
                                if ( $ns == NS_CATEGORY ) {
-                                       wfProfileIn( __METHOD__ . "-category" );
                                        $s = rtrim( $s . "\n" ); # bug 87
 
                                        if ( $wasblank ) {
@@ -2291,7 +2263,6 @@ class Parser {
                                         */
                                        $s .= trim( $prefix . $trail, "\n" ) == '' ? '' : $prefix . $trail;
 
-                                       wfProfileOut( __METHOD__ . "-category" );
                                        continue;
                                }
                        }
@@ -2307,7 +2278,6 @@ class Parser {
                        # NS_MEDIA is a pseudo-namespace for linking directly to a file
                        # @todo FIXME: Should do batch file existence checks, see comment below
                        if ( $ns == NS_MEDIA ) {
-                               wfProfileIn( __METHOD__ . "-media" );
                                # Give extensions a chance to select the file revision for us
                                $options = array();
                                $descQuery = false;
@@ -2318,11 +2288,9 @@ class Parser {
                                # Cloak with NOPARSE to avoid replacement in replaceExternalLinks
                                $s .= $prefix . $this->armorLinks(
                                        Linker::makeMediaLinkFile( $nt, $file, $text ) ) . $trail;
-                               wfProfileOut( __METHOD__ . "-media" );
                                continue;
                        }
 
-                       wfProfileIn( __METHOD__ . "-always_known" );
                        # Some titles, such as valid special pages or files in foreign repos, should
                        # be shown as bluelinks even though they're not included in the page table
                        #
@@ -2335,7 +2303,6 @@ class Parser {
                                # Links will be added to the output link list after checking
                                $s .= $holders->makeHolder( $nt, $text, array(), $trail, $prefix );
                        }
-                       wfProfileOut( __METHOD__ . "-always_known" );
                }
                return $holders;
        }
@@ -2643,7 +2610,6 @@ class Parser {
 
                        # If we have no prefixes, go to paragraph mode.
                        if ( 0 == $prefixLength ) {
-                               wfProfileIn( __METHOD__ . "-paragraph" );
                                # No prefix (not in list)--go to paragraph mode
                                # XXX: use a stack for nestable elements like span, table and div
                                $openmatch = preg_match(
@@ -2712,7 +2678,6 @@ class Parser {
                                                }
                                        }
                                }
-                               wfProfileOut( __METHOD__ . "-paragraph" );
                        }
                        # somewhere above we forget to get out of pre block (bug 785)
                        if ( $preCloseMatch && $this->mInPre ) {
@@ -3430,7 +3395,6 @@ class Parser {
         * @return string The text of the template
         */
        public function braceSubstitution( $piece, $frame ) {
-               wfProfileIn( __METHOD__ . '-setup' );
 
                // Flags
 
@@ -3463,12 +3427,10 @@ class Parser {
                # @todo FIXME: If piece['parts'] is null then the call to getLength()
                # below won't work b/c this $args isn't an object
                $args = ( null == $piece['parts'] ) ? array() : $piece['parts'];
-               wfProfileOut( __METHOD__ . '-setup' );
 
                $profileSection = null; // profile templates
 
                # SUBST
-               wfProfileIn( __METHOD__ . '-modifiers' );
                if ( !$found ) {
 
                        $substMatch = $this->mSubstWords->matchStartAndRemove( $part1 );
@@ -3525,11 +3487,9 @@ class Parser {
                                $forceRawInterwiki = true;
                        }
                }
-               wfProfileOut( __METHOD__ . '-modifiers' );
 
                # Parser functions
                if ( !$found ) {
-                       wfProfileIn( __METHOD__ . '-pfunc' );
 
                        $colonPos = strpos( $part1, ':' );
                        if ( $colonPos !== false ) {
@@ -3541,7 +3501,6 @@ class Parser {
                                try {
                                        $result = $this->callParserFunction( $frame, $func, $funcArgs );
                                } catch ( Exception $ex ) {
-                                       wfProfileOut( __METHOD__ . '-pfunc' );
                                        throw $ex;
                                }
 
@@ -3550,7 +3509,6 @@ class Parser {
                                # here.
                                extract( $result );
                        }
-                       wfProfileOut( __METHOD__ . '-pfunc' );
                }
 
                # Finish mangling title and then check for loops.
@@ -3586,7 +3544,6 @@ class Parser {
                # Load from database
                if ( !$found && $title ) {
                        $profileSection = $this->mProfiler->scopedProfileIn( $title->getPrefixedDBkey() );
-                       wfProfileIn( __METHOD__ . '-loadtpl' );
                        if ( !$title->isExternal() ) {
                                if ( $title->isSpecialPage()
                                        && $this->mOptions->getAllowSpecialInclusion()
@@ -3660,7 +3617,6 @@ class Parser {
                                        . '</span>';
                                wfDebug( __METHOD__ . ": template loop broken at '$titleText'\n" );
                        }
-                       wfProfileOut( __METHOD__ . '-loadtpl' );
                }
 
                # If we haven't found text to substitute by now, we're done
@@ -3774,12 +3730,10 @@ class Parser {
                        }
                }
 
-               wfProfileIn( __METHOD__ . '-pfunc-' . $function );
                list( $callback, $flags ) = $this->mFunctionHooks[$function];
 
                # Workaround for PHP bug 35229 and similar
                if ( !is_callable( $callback ) ) {
-                       wfProfileOut( __METHOD__ . '-pfunc-' . $function );
                        throw new MWException( "Tag hook for $function is not callable\n" );
                }
 
@@ -3844,7 +3798,6 @@ class Parser {
                        $result['text'] = $this->preprocessToDom( $result['text'], $preprocessFlags );
                        $result['isChildObj'] = true;
                }
-               wfProfileOut( __METHOD__ . '-pfunc-' . $function );
 
                return $result;
        }
@@ -5399,7 +5352,6 @@ class Parser {
                        $file = $this->fetchFileNoRegister( $title, $options );
                        $handler = $file ? $file->getHandler() : false;
 
-                       wfProfileIn( __METHOD__ . '-getMagicWord' );
                        $paramMap = array(
                                'img_alt' => 'gallery-internal-alt',
                                'img_link' => 'gallery-internal-link',
@@ -5412,7 +5364,6 @@ class Parser {
                        }
 
                        $mwArray = new MagicWordArray( array_keys( $paramMap ) );
-                       wfProfileOut( __METHOD__ . '-getMagicWord' );
 
                        $label = '';
                        $alt = '';
index ffcde30..b09fe76 100644 (file)
@@ -639,7 +639,6 @@ class ParserOptions {
                        $wgCleanSignatures, $wgExternalLinkTarget, $wgExpensiveParserFunctionLimit,
                        $wgMaxGeneratedPPNodeCount, $wgDisableLangConversion, $wgDisableTitleConversion;
 
-
                // *UPDATE* ParserOptions::matches() if any of this changes as needed
                $this->mInterwikiMagic = $wgInterwikiMagic;
                $this->mAllowExternalImages = $wgAllowExternalImages;
index e642c96..3435881 100644 (file)
@@ -86,7 +86,6 @@ class Preprocessor_DOM implements Preprocessor {
 
                $xml .= "</list>";
 
-               wfProfileIn( __METHOD__ . '-loadXML' );
                $dom = new DOMDocument();
                wfSuppressWarnings();
                $result = $dom->loadXML( $xml );
@@ -98,7 +97,6 @@ class Preprocessor_DOM implements Preprocessor {
                        // don't barf when the XML is >256 levels deep
                        $result = $dom->loadXML( $xml, 1 << 19 );
                }
-               wfProfileOut( __METHOD__ . '-loadXML' );
 
                if ( !$result ) {
                        throw new MWException( 'Parameters passed to ' . __METHOD__ . ' result in invalid XML' );
@@ -156,7 +154,6 @@ class Preprocessor_DOM implements Preprocessor {
                $cacheable = ( $wgPreprocessorCacheThreshold !== false
                        && strlen( $text ) > $wgPreprocessorCacheThreshold );
                if ( $cacheable ) {
-                       wfProfileIn( __METHOD__ . '-cacheable' );
 
                        $cacheKey = wfMemcKey( 'preprocess-xml', md5( $text ), $flags );
                        $cacheValue = $wgMemc->get( $cacheKey );
@@ -169,11 +166,9 @@ class Preprocessor_DOM implements Preprocessor {
                                }
                        }
                        if ( $xml === false ) {
-                               wfProfileIn( __METHOD__ . '-cache-miss' );
                                $xml = $this->preprocessToXml( $text, $flags );
                                $cacheValue = sprintf( "%08d", self::CACHE_VERSION ) . $xml;
                                $wgMemc->set( $cacheKey, $cacheValue, 86400 );
-                               wfProfileOut( __METHOD__ . '-cache-miss' );
                                wfDebugLog( "Preprocessor", "Saved preprocessor XML to memcached (key $cacheKey)" );
                        }
                } else {
@@ -186,12 +181,10 @@ class Preprocessor_DOM implements Preprocessor {
                $max = $this->parser->mOptions->getMaxGeneratedPPNodeCount();
                if ( $this->parser->mGeneratedPPNodeCount > $max ) {
                        if ( $cacheable ) {
-                               wfProfileOut( __METHOD__ . '-cacheable' );
                        }
                        throw new MWException( __METHOD__ . ': generated node count limit exceeded' );
                }
 
-               wfProfileIn( __METHOD__ . '-loadXML' );
                $dom = new DOMDocument;
                wfSuppressWarnings();
                $result = $dom->loadXML( $xml );
@@ -206,13 +199,10 @@ class Preprocessor_DOM implements Preprocessor {
                if ( $result ) {
                        $obj = new PPNode_DOM( $dom->documentElement );
                }
-               wfProfileOut( __METHOD__ . '-loadXML' );
 
                if ( $cacheable ) {
-                       wfProfileOut( __METHOD__ . '-cacheable' );
                }
 
-
                if ( !$result ) {
                        throw new MWException( __METHOD__ . ' generated invalid XML' );
                }
@@ -761,7 +751,6 @@ class Preprocessor_DOM implements Preprocessor {
                $stack->rootAccum .= '</root>';
                $xml = $stack->rootAccum;
 
-
                return $xml;
        }
 }
index 4de2fed..af91ad4 100644 (file)
@@ -120,7 +120,6 @@ class Preprocessor_Hash implements Preprocessor {
                        && strlen( $text ) > $wgPreprocessorCacheThreshold;
 
                if ( $cacheable ) {
-                       wfProfileIn( __METHOD__ . '-cacheable' );
 
                        $cacheKey = wfMemcKey( 'preprocess-hash', md5( $text ), $flags );
                        $cacheValue = $wgMemc->get( $cacheKey );
@@ -131,11 +130,9 @@ class Preprocessor_Hash implements Preprocessor {
                                        // From the cache
                                        wfDebugLog( "Preprocessor",
                                                "Loaded preprocessor hash from memcached (key $cacheKey)" );
-                                       wfProfileOut( __METHOD__ . '-cacheable' );
                                        return $hash;
                                }
                        }
-                       wfProfileIn( __METHOD__ . '-cache-miss' );
                }
 
                $rules = array(
@@ -635,15 +632,11 @@ class Preprocessor_Hash implements Preprocessor {
                                                        }
                                                        if ( !$node ) {
                                                                if ( $cacheable ) {
-                                                                       wfProfileOut( __METHOD__ . '-cache-miss' );
-                                                                       wfProfileOut( __METHOD__ . '-cacheable' );
                                                                }
                                                                throw new MWException( __METHOD__ . ': eqpos not found' );
                                                        }
                                                        if ( $node->name !== 'equals' ) {
                                                                if ( $cacheable ) {
-                                                                       wfProfileOut( __METHOD__ . '-cache-miss' );
-                                                                       wfProfileOut( __METHOD__ . '-cacheable' );
                                                                }
                                                                throw new MWException( __METHOD__ . ': eqpos is not equals' );
                                                        }
@@ -744,8 +737,6 @@ class Preprocessor_Hash implements Preprocessor {
                if ( $cacheable ) {
                        $cacheValue = sprintf( "%08d", self::CACHE_VERSION ) . serialize( $rootNode );
                        $wgMemc->set( $cacheKey, $cacheValue, 86400 );
-                       wfProfileOut( __METHOD__ . '-cache-miss' );
-                       wfProfileOut( __METHOD__ . '-cacheable' );
                        wfDebugLog( "Preprocessor", "Saved preprocessor Hash to memcached (key $cacheKey)" );
                }
 
index ca80ebc..68ef668 100644 (file)
  * Class for handling function-scope profiling
  *
  * @since 1.22
+ * @deprecated 1.25 No-op now
  */
 class ProfileSection {
-       /** @var string $name Method name */
-       protected $name;
-       /** @var boolean $enabled Is profiling enabled? */
-       protected $enabled = false;
-
        /**
         * Begin profiling of a function and return an object that ends profiling
         * of the function when that object leaves scope. As long as the object is
@@ -43,21 +39,5 @@ class ProfileSection {
         *
         * @param string $name Name of the function to profile
         */
-       public function __construct( $name ) {
-               $this->name = $name;
-               // Use Profiler member variable directly to reduce overhead
-               if ( Profiler::$__instance === null ) {
-                       Profiler::instance();
-               }
-               if ( !( Profiler::$__instance instanceof ProfilerStub ) ) {
-                       $this->enabled = true;
-                       Profiler::$__instance->profileIn( $this->name );
-               }
-       }
-
-       function __destruct() {
-               if ( $this->enabled ) {
-                       Profiler::$__instance->profileOut( $this->name );
-               }
-       }
+       public function __construct( $name ) {}
 }
index 667a9e2..6e1278f 100644 (file)
@@ -118,20 +118,6 @@ abstract class Profiler {
                }
        }
 
-       /**
-        * Called by wfProfieIn()
-        *
-        * @param string $functionname
-        */
-       abstract public function profileIn( $functionname );
-
-       /**
-        * Called by wfProfieOut()
-        *
-        * @param string $functionname
-        */
-       abstract public function profileOut( $functionname );
-
        /**
         * Mark the start of a custom profiling frame (e.g. DB queries).
         * The frame ends when the result of this method falls out of scope.
index a0d5943..4984e77 100644 (file)
@@ -42,27 +42,15 @@ function wfGetRusage() {
 /**
  * Begin profiling of a function
  * @param string $functionname Name of the function we will profile
+ * @deprecated 1.25
  */
 function wfProfileIn( $functionname ) {
-       // Use Profiler member variable directly to reduce overhead
-       if ( Profiler::$__instance === null ) {
-               Profiler::instance();
-       }
-       if ( !( Profiler::$__instance instanceof ProfilerStub ) ) {
-               Profiler::$__instance->profileIn( $functionname );
-       }
 }
 
 /**
  * Stop profiling of a function
  * @param string $functionname Name of the function we have profiled
+ * @deprecated 1.25
  */
 function wfProfileOut( $functionname = 'missing' ) {
-       // Use Profiler member variable directly to reduce overhead
-       if ( Profiler::$__instance === null ) {
-               Profiler::instance();
-       }
-       if ( !( Profiler::$__instance instanceof ProfilerStub ) ) {
-               Profiler::$__instance->profileOut( $functionname );
-       }
 }
diff --git a/includes/profiler/ProfilerSectionOnly.php b/includes/profiler/ProfilerSectionOnly.php
new file mode 100755 (executable)
index 0000000..1f8d33b
--- /dev/null
@@ -0,0 +1,104 @@
+<?php
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * Profiler that only tracks explicit profiling sections
+ *
+ * @code
+ * $wgProfiler['class'] = 'ProfilerSectionOnly';
+ * $wgProfiler['output'] = 'text';
+ * $wgProfiler['visible'] = true;
+ * @endcode
+ *
+ * @author Aaron Schulz
+ * @ingroup Profiler
+ * @since 1.25
+ */
+class ProfilerSectionOnly extends Profiler {
+       /** @var SectionProfiler */
+       protected $sprofiler;
+
+       public function __construct( array $params = array() ) {
+               parent::__construct( $params );
+               $this->sprofiler = new SectionProfiler();
+       }
+
+       public function scopedProfileIn( $section ) {
+               return $this->sprofiler->scopedProfileIn( $section );
+       }
+
+       public function close() {
+       }
+
+       public function getFunctionStats() {
+               return $this->sprofiler->getFunctionStats();
+       }
+
+       public function getOutput() {
+               return $this->getFunctionReport();
+       }
+
+       /**
+        * Get a report of profiled functions sorted by inclusive wall clock time
+        * in descending order.
+        *
+        * Each line of the report includes this data:
+        * - Function name
+        * - Number of times function was called
+        * - Total wall clock time spent in function in microseconds
+        * - Minimum wall clock time spent in function in microseconds
+        * - Average wall clock time spent in function in microseconds
+        * - Maximum wall clock time spent in function in microseconds
+        * - Percentage of total wall clock time spent in function
+        * - Total delta of memory usage from start to end of function in bytes
+        *
+        * @return string
+        */
+       protected function getFunctionReport() {
+               $data = $this->getFunctionStats();
+               usort( $data, function( $a, $b ) {
+                       if ( $a['real'] === $b['real'] ) {
+                               return 0;
+                       }
+                       return ( $a['real'] > $b['real'] ) ? -1 : 1; // descending
+               } );
+
+               $width = 140;
+               $nameWidth = $width - 65;
+               $format = "%-{$nameWidth}s %6d %9d %9d %9d %9d %7.3f%% %9d";
+               $out = array();
+               $out[] = sprintf( "%-{$nameWidth}s %6s %9s %9s %9s %9s %7s %9s",
+                       'Name', 'Calls', 'Total', 'Min', 'Each', 'Max', '%', 'Mem'
+               );
+               foreach ( $data as $stats ) {
+                       $out[] = sprintf( $format,
+                               $stats['name'],
+                               $stats['calls'],
+                               $stats['real'] * 1000,
+                               $stats['min_real'] * 1000,
+                               $stats['real'] / $stats['calls'] * 1000,
+                               $stats['max_real'] * 1000,
+                               $stats['%real'],
+                               $stats['memory']
+                       );
+               }
+               return implode( "\n", $out );
+       }
+}
index 1d77cc0..5580f94 100644 (file)
  * @ingroup Profiler
  */
 class ProfilerStub extends Profiler {
-       public function profileIn( $fn ) {
-       }
-
-       public function profileOut( $fn ) {
-       }
-
        public function scopedProfileIn( $section ) {
                return new ScopedCallback( null ); // no-op
        }
index 64d2de7..7a50497 100644 (file)
  * $wgProfiler['output'] = 'udp';
  * @endcode
  *
- * Rather than obeying wfProfileIn() and wfProfileOut() calls placed in the
- * application code, ProfilerXhprof profiles all functions using the XHProf
- * PHP extenstion. For PHP5 users, this extension can be installed via PECL or
- * your operating system's package manager. XHProf support is built into HHVM.
+ * ProfilerXhprof profiles all functions using the XHProf PHP extenstion.
+ * For PHP5 users, this extension can be installed via PECL or your operating
+ * system's package manager. XHProf support is built into HHVM.
  *
  * To restrict the functions for which profiling data is collected, you can
  * use either a whitelist ($wgProfiler['include']) or a blacklist
@@ -77,28 +76,6 @@ class ProfilerXhprof extends Profiler {
                $this->sprofiler = new SectionProfiler();
        }
 
-       /**
-        * No-op for xhprof profiling.
-        *
-        * Use the 'include' configuration key instead if you need to constrain
-        * the functions that are profiled.
-        *
-        * @param string $functionname
-        */
-       public function profileIn( $functionname ) {
-       }
-
-       /**
-        * No-op for xhprof profiling.
-        *
-        * Use the 'include' configuration key instead if you need to constrain
-        * the functions that are profiled.
-        *
-        * @param string $functionname
-        */
-       public function profileOut( $functionname ) {
-       }
-
        public function scopedProfileIn( $section ) {
                return $this->sprofiler->scopedProfileIn( $section );
        }
index f42e9f3..459d95b 100644 (file)
@@ -133,8 +133,6 @@ class ExtensionProcessor implements Processor {
                        }
                }
 
-
-
        }
 
        public function getExtractedInfo() {
index 5ee9fdb..15bb13f 100644 (file)
@@ -212,7 +212,6 @@ class ResourceLoader {
                        $this->errors[] = self::formatExceptionNoComment( $e );
                }
 
-
                return $result;
        }
 
@@ -225,7 +224,6 @@ class ResourceLoader {
        public function __construct( Config $config = null ) {
                global $IP;
 
-
                if ( $config === null ) {
                        wfDebug( __METHOD__ . ' was called without providing a Config instance' );
                        $config = ConfigFactory::getDefaultInstance()->makeConfig( 'main' );
@@ -360,7 +358,6 @@ class ResourceLoader {
                                . 'Edit your <code>LocalSettings.php</code> to enable it.' );
                }
 
-
                // Get core test suites
                $testModules = array();
                $testModules['qunit'] = array();
@@ -566,7 +563,6 @@ class ResourceLoader {
                // See http://bugs.php.net/bug.php?id=36514
                ob_start();
 
-
                // Find out which modules are missing and instantiate the others
                $modules = array();
                $missing = array();
@@ -595,8 +591,6 @@ class ResourceLoader {
                        $this->errors[] = self::formatExceptionNoComment( $e );
                }
 
-               wfProfileIn( __METHOD__ . '-getModifiedTime' );
-
                // To send Last-Modified and support If-Modified-Since, we need to detect
                // the last modified time
                $mtime = wfTimestamp( TS_UNIX, $this->config->get( 'CacheEpoch' ) );
@@ -614,8 +608,6 @@ class ResourceLoader {
                        }
                }
 
-               wfProfileOut( __METHOD__ . '-getModifiedTime' );
-
                // If there's an If-Modified-Since header, respond with a 304 appropriately
                if ( $this->tryRespondLastModified( $context, $mtime ) ) {
                        return; // output handled (buffers cleared)
@@ -864,7 +856,6 @@ class ResourceLoader {
    no modules were requested. Max made me put this here. */";
                }
 
-
                $image = $context->getImageObj();
                if ( $image ) {
                        $data = $image->getImageData( $context );
@@ -902,7 +893,6 @@ class ResourceLoader {
                         * @var $module ResourceLoaderModule
                         */
 
-                       wfProfileIn( __METHOD__ . '-' . $name );
                        try {
                                $scripts = '';
                                if ( $context->shouldIncludeScripts() ) {
@@ -1016,7 +1006,6 @@ class ResourceLoader {
                                unset( $modules[$name] );
                        }
                        $isRaw |= $module->isRaw();
-                       wfProfileOut( __METHOD__ . '-' . $name );
                }
 
                // Update module states
index c421034..fbca08e 100644 (file)
@@ -569,9 +569,7 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
                        return $this->modifiedTime[$context->getHash()];
                }
 
-               wfProfileIn( __METHOD__ . '-filemtime' );
                $filesMtime = max( array_map( array( __CLASS__, 'safeFilemtime' ), $files ) );
-               wfProfileOut( __METHOD__ . '-filemtime' );
 
                $this->modifiedTime[$context->getHash()] = max(
                        $filesMtime,
index cd6cf7d..5770276 100644 (file)
@@ -47,6 +47,7 @@ class SearchEngine {
 
        /** @var bool */
        protected $showSuggestion = true;
+       private $sort = 'relevance';
 
        /** @var array Feature values */
        protected $features = array();
@@ -309,6 +310,43 @@ class SearchEngine {
                $this->showSuggestion = $showSuggestion;
        }
 
+       /**
+        * Get the valid sort directions.  All search engines support 'relevance' but others
+        * might support more. The default in all implementations should be 'relevance.'
+        *
+        * @since 1.25
+        * @return array(string) the valid sort directions for setSort
+        */
+       public function getValidSorts() {
+               return array( 'relevance' );
+       }
+
+       /**
+        * Set the sort direction of the search results. Must be one returned by
+        * SearchEngine::getValidSorts()
+        *
+        * @since 1.25
+        * @throws InvalidArgumentException
+        * @param string $sort sort direction for query result
+        */
+       public function setSort( $sort ) {
+               if ( !in_array( $sort, $this->getValidSorts() ) ) {
+                       throw new InvalidArgumentException( "Invalid sort: $sort. " .
+                               "Must be one of: " . implode( ', ', $this->getValidSorts() ) );
+               }
+               $this->sort = $sort;
+       }
+
+       /**
+        * Get the sort direction of the search results
+        *
+        * @since 1.25
+        * @return string
+        */
+       public function getSort() {
+               return $this->sort;
+       }
+
        /**
         * Parse some common prefixes: all (search everything)
         * or namespace names
index c3c3a8f..255d005 100644 (file)
@@ -67,7 +67,6 @@ class SearchHighlighter {
                $spat .= '/';
                $textExt = array(); // text extracts
                $otherExt = array(); // other extracts
-               wfProfileIn( "$fname-split" );
                $start = 0;
                $textLen = strlen( $text );
                $count = 0; // sequence number to maintain ordering
@@ -132,8 +131,6 @@ class SearchHighlighter {
 
                $all = $textExt + $otherExt; // these have disjunct key sets
 
-               wfProfileOut( "$fname-split" );
-
                // prepare regexps
                foreach ( $terms as $index => $term ) {
                        // manually do upper/lowercase stuff for utf-8 since PHP won't do it
@@ -163,8 +160,6 @@ class SearchHighlighter {
                $pat1 = "/(" . $phrase . ")/ui";
                $pat2 = "/$patPre(" . $anyterm . ")$patPost/ui";
 
-               wfProfileIn( "$fname-extract" );
-
                $left = $contextlines;
 
                $snippets = array();
@@ -287,8 +282,6 @@ class SearchHighlighter {
                        }
                }
 
-               wfProfileOut( "$fname-extract" );
-
                return $extract;
        }
 
@@ -452,7 +445,6 @@ class SearchHighlighter {
         */
        function removeWiki( $text ) {
                $fname = __METHOD__;
-               wfProfileIn( $fname );
 
                // $text = preg_replace( "/'{2,5}/", "", $text );
                // $text = preg_replace( "/\[[a-z]+:\/\/[^ ]+ ([^]]+)\]/", "\\2", $text );
@@ -474,7 +466,6 @@ class SearchHighlighter {
                $text = preg_replace( "/('''|<\/?[iIuUbB]>)/", "", $text );
                $text = preg_replace( "/''/", "", $text );
 
-               wfProfileOut( $fname );
                return $text;
        }
 
@@ -523,7 +514,6 @@ class SearchHighlighter {
                $lineno = 0;
 
                $extract = "";
-               wfProfileIn( "$fname-extract" );
                foreach ( $lines as $line ) {
                        if ( 0 == $contextlines ) {
                                break;
@@ -551,7 +541,6 @@ class SearchHighlighter {
 
                        $extract .= "${line}\n";
                }
-               wfProfileOut( "$fname-extract" );
 
                return $extract;
        }
index f834085..485088c 100644 (file)
@@ -382,7 +382,6 @@ class SearchMySQL extends SearchDatabase {
        function normalizeText( $string ) {
                global $wgContLang;
 
-
                $out = parent::normalizeText( $string );
 
                // MySQL fulltext index doesn't grok utf-8, so we
@@ -415,7 +414,6 @@ class SearchMySQL extends SearchDatabase {
                        "$1u82e$2",
                        $out );
 
-
                return $out;
        }
 
index 9296aa5..999dda8 100644 (file)
@@ -1468,7 +1468,6 @@ abstract class Skin extends ContextSource {
        private function getCachedNotice( $name ) {
                global $wgRenderHashAppend, $parserMemc, $wgContLang;
 
-
                $needParse = false;
 
                if ( $name === 'default' ) {
index 960f1c1..45a1a8b 100644 (file)
@@ -180,11 +180,8 @@ class SkinTemplate extends Skin {
                $user = $this->getUser();
                $title = $this->getTitle();
 
-               wfProfileIn( __METHOD__ . '-init' );
                $tpl = $this->setupTemplate( $this->template, 'skins' );
-               wfProfileOut( __METHOD__ . '-init' );
 
-               wfProfileIn( __METHOD__ . '-stuff' );
                $this->thispage = $title->getPrefixedDBkey();
                $this->titletxt = $title->getPrefixedText();
                $this->userpage = $user->getUserPage()->getPrefixedText();
@@ -207,9 +204,6 @@ class SkinTemplate extends Skin {
                        $this->userpageUrlDetails = self::makeKnownUrlDetails( $this->userpage );
                }
 
-               wfProfileOut( __METHOD__ . '-stuff' );
-
-
                return $tpl;
        }
 
@@ -231,14 +225,10 @@ class SkinTemplate extends Skin {
 
                $out = $this->getOutput();
 
-               wfProfileIn( __METHOD__ . '-init' );
                $this->initPage( $out );
-               wfProfileOut( __METHOD__ . '-init' );
                $tpl = $this->prepareQuickTemplate( $out );
                // execute template
-               wfProfileIn( __METHOD__ . '-execute' );
                $res = $tpl->execute();
-               wfProfileOut( __METHOD__ . '-execute' );
 
                // result may be an error
                $this->printOrError( $res );
@@ -261,13 +251,11 @@ class SkinTemplate extends Skin {
                        $wgShowCreditsIfMax, $wgArticlePath,
                        $wgScriptPath, $wgServer;
 
-
                $title = $this->getTitle();
                $request = $this->getRequest();
                $out = $this->getOutput();
                $tpl = $this->setupTemplateForOutput();
 
-               wfProfileIn( __METHOD__ . '-stuff2' );
                $tpl->set( 'title', $out->getPageTitle() );
                $tpl->set( 'pagetitle', $out->getHTMLTitle() );
                $tpl->set( 'displaytitle', $out->mPageLinkTitle );
@@ -362,9 +350,6 @@ class SkinTemplate extends Skin {
                        $tpl->set( 'userlangattributes', $attrs );
                }
 
-               wfProfileOut( __METHOD__ . '-stuff2' );
-
-               wfProfileIn( __METHOD__ . '-stuff3' );
                $tpl->set( 'newtalk', $this->getNewtalks() );
                $tpl->set( 'logo', $this->logoText() );
 
@@ -385,9 +370,7 @@ class SkinTemplate extends Skin {
                        }
                        $tpl->set( 'copyright', $this->getCopyright() );
                }
-               wfProfileOut( __METHOD__ . '-stuff3' );
 
-               wfProfileIn( __METHOD__ . '-stuff4' );
                $tpl->set( 'copyrightico', $this->getCopyrightIcon() );
                $tpl->set( 'poweredbyico', $this->getPoweredBy() );
                $tpl->set( 'disclaimer', $this->disclaimerLink() );
@@ -458,9 +441,7 @@ class SkinTemplate extends Skin {
                } else {
                        $tpl->set( 'language_urls', false );
                }
-               wfProfileOut( __METHOD__ . '-stuff4' );
 
-               wfProfileIn( __METHOD__ . '-stuff5' );
                # Personal toolbar
                $tpl->set( 'personal_urls', $this->buildPersonalUrls() );
                $content_navigation = $this->buildContentNavigationUrls();
@@ -500,7 +481,6 @@ class SkinTemplate extends Skin {
                // allow extensions adding stuff after the page content.
                // See Skin::afterContentHook() for further documentation.
                $tpl->set( 'dataAfterContent', $this->afterContentHook() );
-               wfProfileOut( __METHOD__ . '-stuff5' );
 
                return $tpl;
        }
@@ -814,7 +794,6 @@ class SkinTemplate extends Skin {
        protected function buildContentNavigationUrls() {
                global $wgDisableLangConversion;
 
-
                // Display tabs for the relevant title rather than always the title itself
                $title = $this->getRelevantTitle();
                $onPage = $title->equals( $this->getTitle() );
@@ -900,8 +879,6 @@ class SkinTemplate extends Skin {
                                        );
                                }
 
-                               wfProfileIn( __METHOD__ . '-edit' );
-
                                // Checks if user can edit the current page if it exists or create it otherwise
                                if ( $title->quickUserCan( 'edit', $user )
                                        && ( $title->exists() || $title->quickUserCan( 'create', $user ) )
@@ -958,9 +935,7 @@ class SkinTemplate extends Skin {
                                                'primary' => true, // don't collapse this in vector
                                        );
                                }
-                               wfProfileOut( __METHOD__ . '-edit' );
 
-                               wfProfileIn( __METHOD__ . '-live' );
                                // Checks if the page exists
                                if ( $title->exists() ) {
                                        // Adds history view link
@@ -1021,8 +996,6 @@ class SkinTemplate extends Skin {
                                        );
                                }
 
-                               wfProfileOut( __METHOD__ . '-live' );
-
                                // Checks if the user is logged in
                                if ( $this->loggedin && $user->isAllowedAll( 'viewmywatchlist', 'editmywatchlist' ) ) {
                                        /**
@@ -1129,7 +1102,6 @@ class SkinTemplate extends Skin {
                        }
                }
 
-
                return $content_navigation;
        }
 
@@ -1140,7 +1112,6 @@ class SkinTemplate extends Skin {
         */
        private function buildContentActionUrls( $content_navigation ) {
 
-
                // content_actions has been replaced with content_navigation for backwards
                // compatibility and also for skins that just want simple tabs content_actions
                // is now built by flattening the content_navigation arrays into one
@@ -1172,7 +1143,6 @@ class SkinTemplate extends Skin {
                        }
                }
 
-
                return $content_actions;
        }
 
@@ -1183,7 +1153,6 @@ class SkinTemplate extends Skin {
        protected function buildNavUrls() {
                global $wgUploadNavigationUrl;
 
-
                $out = $this->getOutput();
                $request = $this->getRequest();
 
index a6721f0..7cf94cc 100644 (file)
@@ -233,7 +233,6 @@ class AllMessagesTablePager extends TablePager {
                // Normalise message names so they look like page titles
                $messageNames = array_map( array( $this->lang, 'ucfirst' ), $messageNames );
 
-
                return $messageNames;
        }
 
@@ -250,7 +249,6 @@ class AllMessagesTablePager extends TablePager {
         */
        public static function getCustomisedStatuses( $messageNames, $langcode = 'en', $foreign = false ) {
                // FIXME: This function should be moved to Language:: or something.
-               wfProfileIn( __METHOD__ . '-db' );
 
                $dbr = wfGetDB( DB_SLAVE );
                $res = $dbr->select( 'page',
@@ -286,8 +284,6 @@ class AllMessagesTablePager extends TablePager {
                        }
                }
 
-               wfProfileOut( __METHOD__ . '-db' );
-
                return array( 'pages' => $pageFlags, 'talks' => $talkFlags );
        }
 
index da2dc7c..c96fd14 100644 (file)
@@ -1117,7 +1117,6 @@ class ContribsPager extends ReverseChronologicalPager {
                        $ret = Html::rawElement( 'li', array( 'class' => $classes ), $ret ) . "\n";
                }
 
-
                return $ret;
        }
 
index 659a413..680aa35 100644 (file)
@@ -257,7 +257,6 @@ class DeletedContribsPager extends IndexPager {
 
                $ret = Html::rawElement( 'li', array(), $ret ) . "\n";
 
-
                return $ret;
        }
 
index 75015bb..56c4eb5 100644 (file)
@@ -246,7 +246,7 @@ class UsersPager extends AlphabeticPager {
                $this->userGroupCache = $cache;
 
                // Add page of groups to link batch
-               foreach( $groups as $group => $unused ) {
+               foreach ( $groups as $group => $unused ) {
                        $groupPage = User::getGroupPage( $group );
                        if ( $groupPage ) {
                                $batch->addObj( $groupPage );
index a4e2af9..7e74cd5 100644 (file)
@@ -543,7 +543,6 @@ class MergeHistoryPager extends ReverseChronologicalPager {
                $batch->execute();
                $this->mResult->seek( 0 );
 
-
                return '';
        }
 
index 23c1dd6..d25c2c8 100644 (file)
@@ -117,7 +117,6 @@ class SpecialProtectedtitles extends SpecialPage {
                        )->escaped();
                }
 
-
                // @todo i18n: This should use a comma separator instead of a hard coded comma, right?
                return '<li>' . $lang->specialList( $link, implode( $description_items, ', ' ) ) . "</li>\n";
        }
index a196e77..2aa629e 100644 (file)
@@ -275,7 +275,6 @@ class SpecialVersion extends SpecialPage {
                                )->text();
                }
 
-
                return $version;
        }
 
@@ -302,7 +301,6 @@ class SpecialVersion extends SpecialPage {
                        }
                }
 
-
                return $v;
        }
 
@@ -730,7 +728,7 @@ class SpecialVersion extends SpecialPage {
                        list( $vcsVersion, $vcsLink, $vcsDate ) = $cache->get( $memcKey );
 
                        if ( !$vcsVersion ) {
-                               wfDebug( "Getting VCS info for extension $extensionName" );
+                               wfDebug( "Getting VCS info for extension {$extension['name']}" );
                                $gitInfo = new GitInfo( $extensionPath );
                                $vcsVersion = $gitInfo->getHeadSHA1();
                                if ( $vcsVersion !== false ) {
@@ -746,7 +744,7 @@ class SpecialVersion extends SpecialPage {
                                }
                                $cache->set( $memcKey, array( $vcsVersion, $vcsLink, $vcsDate ), 60 * 60 * 24 );
                        } else {
-                               wfDebug( "Pulled VCS info for extension $extensionName from cache" );
+                               wfDebug( "Pulled VCS info for extension {$extension['name']} from cache" );
                        }
                }
 
@@ -833,12 +831,12 @@ class SpecialVersion extends SpecialPage {
 
                // ... now get the authors for this extension
                $authors = isset( $extension['author'] ) ? $extension['author'] : array();
-               $authors = $this->listAuthors( $authors, $extensionName, $extensionPath );
+               $authors = $this->listAuthors( $authors, $extension['name'], $extensionPath );
 
                // Finally! Create the table
                $html = Html::openElement( 'tr', array(
                                'class' => 'mw-version-ext',
-                               'id' => "mw-version-ext-{$extensionName}"
+                               'id' => "mw-version-ext-{$extension['name']}"
                        )
                );
 
index 795afc6..a8a38c7 100644 (file)
@@ -335,7 +335,6 @@ abstract class UploadBase {
                        return array( 'status' => self::HOOK_ABORTED, 'error' => $error );
                }
 
-
                return array( 'status' => self::OK );
        }
 
@@ -401,7 +400,6 @@ abstract class UploadBase {
                        }
                }
 
-
                return true;
        }
 
@@ -528,7 +526,6 @@ abstract class UploadBase {
                        return array( 'uploadvirus', $virus );
                }
 
-
                return true;
        }
 
@@ -689,7 +686,6 @@ abstract class UploadBase {
                        }
                }
 
-
                return $warnings;
        }
 
@@ -729,7 +725,6 @@ abstract class UploadBase {
                        $this->postProcessUpload();
                }
 
-
                return $status;
        }
 
@@ -925,7 +920,6 @@ abstract class UploadBase {
                $file = $stash->stashFile( $this->mTempPath, $this->getSourceType() );
                $this->mLocalFile = $file;
 
-
                return $file;
        }
 
@@ -1691,7 +1685,6 @@ abstract class UploadBase {
                        wfDebug( __METHOD__ . ": FOUND VIRUS! scanner feedback: $output \n" );
                }
 
-
                return $output;
        }
 
index 5af4545..e6c0e78 100644 (file)
@@ -313,7 +313,6 @@ class MWCryptRand {
                        // entropy so this is also preferable to just trying to read urandom because it may work
                        // on Windows systems as well.
                        if ( function_exists( 'mcrypt_create_iv' ) ) {
-                               wfProfileIn( __METHOD__ . '-mcrypt' );
                                $rem = $bytes - strlen( $buffer );
                                $iv = mcrypt_create_iv( $rem, MCRYPT_DEV_URANDOM );
                                if ( $iv === false ) {
@@ -323,7 +322,6 @@ class MWCryptRand {
                                        wfDebug( __METHOD__ . ": mcrypt_create_iv generated " . strlen( $iv ) .
                                                " bytes of randomness.\n" );
                                }
-                               wfProfileOut( __METHOD__ . '-mcrypt' );
                        }
                }
 
@@ -336,7 +334,6 @@ class MWCryptRand {
                        if ( function_exists( 'openssl_random_pseudo_bytes' )
                                && ( !wfIsWindows() || version_compare( PHP_VERSION, '5.3.4', '>=' ) )
                        ) {
-                               wfProfileIn( __METHOD__ . '-openssl' );
                                $rem = $bytes - strlen( $buffer );
                                $openssl_bytes = openssl_random_pseudo_bytes( $rem, $openssl_strong );
                                if ( $openssl_bytes === false ) {
@@ -352,7 +349,6 @@ class MWCryptRand {
                                        // using it use it's say on whether the randomness is strong
                                        $this->strong = !!$openssl_strong;
                                }
-                               wfProfileOut( __METHOD__ . '-openssl' );
                        }
                }
 
@@ -360,7 +356,6 @@ class MWCryptRand {
                if ( strlen( $buffer ) < $bytes &&
                        ( function_exists( 'stream_set_read_buffer' ) || $forceStrong )
                ) {
-                       wfProfileIn( __METHOD__ . '-fopen-urandom' );
                        $rem = $bytes - strlen( $buffer );
                        if ( !function_exists( 'stream_set_read_buffer' ) && $forceStrong ) {
                                wfDebug( __METHOD__ . ": Was forced to read from /dev/urandom " .
@@ -399,7 +394,6 @@ class MWCryptRand {
                        } else {
                                wfDebug( __METHOD__ . ": /dev/urandom could not be opened.\n" );
                        }
-                       wfProfileOut( __METHOD__ . '-fopen-urandom' );
                }
 
                // If we cannot use or generate enough data from a secure source
@@ -413,12 +407,10 @@ class MWCryptRand {
                                ": Falling back to using a pseudo random state to generate randomness.\n" );
                }
                while ( strlen( $buffer ) < $bytes ) {
-                       wfProfileIn( __METHOD__ . '-fallback' );
                        $buffer .= $this->hmac( $this->randomState(), mt_rand() );
                        // This code is never really cryptographically strong, if we use it
                        // at all, then set strong to false.
                        $this->strong = false;
-                       wfProfileOut( __METHOD__ . '-fallback' );
                }
 
                // Once the buffer has been filled up with enough random data to fulfill
@@ -430,7 +422,6 @@ class MWCryptRand {
                wfDebug( __METHOD__ . ": " . strlen( $buffer ) .
                        " bytes of randomness leftover in the buffer.\n" );
 
-
                return $generated;
        }
 
index 86f4512..c71e315 100644 (file)
@@ -498,16 +498,12 @@ class ReplacementArray {
         */
        function replace( $subject ) {
                if ( function_exists( 'fss_prep_replace' ) ) {
-                       wfProfileIn( __METHOD__ . '-fss' );
                        if ( $this->fss === false ) {
                                $this->fss = fss_prep_replace( $this->data );
                        }
                        $result = fss_exec_replace( $this->fss, $subject );
-                       wfProfileOut( __METHOD__ . '-fss' );
                } else {
-                       wfProfileIn( __METHOD__ . '-strtr' );
                        $result = strtr( $subject, $this->data );
-                       wfProfileOut( __METHOD__ . '-strtr' );
                }
 
                return $result;
index cb71217..4271ed3 100644 (file)
@@ -67,23 +67,35 @@ class ZhConverter extends LanguageConverter {
                $this->mTables = array(
                        'zh-hans' => new ReplacementArray( $zh2Hans ),
                        'zh-hant' => new ReplacementArray( $zh2Hant ),
-                       'zh-cn' => new ReplacementArray( array_merge( $zh2Hans, $zh2CN ) ),
-                       'zh-hk' => new ReplacementArray( array_merge( $zh2Hant, $zh2HK ) ),
-                       'zh-mo' => new ReplacementArray( array_merge( $zh2Hant, $zh2HK ) ),
-                       'zh-my' => new ReplacementArray( array_merge( $zh2Hans, $zh2SG ) ),
-                       'zh-sg' => new ReplacementArray( array_merge( $zh2Hans, $zh2SG ) ),
-                       'zh-tw' => new ReplacementArray( array_merge( $zh2Hant, $zh2TW ) ),
+                       'zh-cn' => new ReplacementArray( $zh2CN ),
+                       'zh-hk' => new ReplacementArray( $zh2HK ),
+                       'zh-mo' => new ReplacementArray( $zh2HK ),
+                       'zh-my' => new ReplacementArray( $zh2SG ),
+                       'zh-sg' => new ReplacementArray( $zh2SG ),
+                       'zh-tw' => new ReplacementArray( $zh2TW ),
                        'zh' => new ReplacementArray
                );
        }
 
        function postLoadTables() {
-               $this->mTables['zh-cn']->merge( $this->mTables['zh-hans'] );
-               $this->mTables['zh-hk']->merge( $this->mTables['zh-hant'] );
-               $this->mTables['zh-mo']->merge( $this->mTables['zh-hant'] );
-               $this->mTables['zh-my']->merge( $this->mTables['zh-hans'] );
-               $this->mTables['zh-sg']->merge( $this->mTables['zh-hans'] );
-               $this->mTables['zh-tw']->merge( $this->mTables['zh-hant'] );
+               $this->mTables['zh-cn']->setArray(
+                       $this->mTables['zh-cn']->getArray() + $this->mTables['zh-hans']->getArray()
+               );
+               $this->mTables['zh-hk']->setArray(
+                       $this->mTables['zh-hk']->getArray() + $this->mTables['zh-hant']->getArray()
+               );
+               $this->mTables['zh-mo']->setArray(
+                       $this->mTables['zh-mo']->getArray() + $this->mTables['zh-hant']->getArray()
+               );
+               $this->mTables['zh-my']->setArray(
+                       $this->mTables['zh-my']->getArray() + $this->mTables['zh-hans']->getArray()
+               );
+               $this->mTables['zh-sg']->setArray(
+                       $this->mTables['zh-sg']->getArray() + $this->mTables['zh-hans']->getArray()
+               );
+               $this->mTables['zh-tw']->setArray(
+                       $this->mTables['zh-tw']->getArray() + $this->mTables['zh-hant']->getArray()
+               );
        }
 
        /**
index 8b23909..f66cd5a 100644 (file)
--- a/load.php
+++ b/load.php
@@ -31,7 +31,6 @@ if ( !function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '5.3
 
 require __DIR__ . '/includes/WebStart.php';
 
-wfProfileIn( 'load.php' );
 
 // URL safety checks
 if ( !$wgRequest->checkUrlExtension() ) {
@@ -44,7 +43,6 @@ $configFactory = ConfigFactory::getDefaultInstance();
 $resourceLoader = new ResourceLoader( $configFactory->makeConfig( 'main' ) );
 $resourceLoader->respond( new ResourceLoaderContext( $resourceLoader, $wgRequest ) );
 
-wfProfileOut( 'load.php' );
 wfLogProfilingData();
 
 // Shut down the database.
index 25ecc09..e20c477 100644 (file)
@@ -49,9 +49,6 @@ if ( isset( $options['d'] ) ) {
                        $lb->setServerInfo( $i, $server );
                }
        }
-       if ( $d > 2 ) {
-               $wgDebugFunctionEntry = true;
-       }
 }
 
 $__useReadline = function_exists( 'readline_add_history' )
index 0912554..ad951b0 100644 (file)
@@ -36,8 +36,9 @@
        // Standalone icons
        //
        // Markup:
-       // <div class="mw-ui-icon mw-ui-icon-element mw-ui-icon-ok">OK</div>
-       // <div class="mw-ui-icon mw-ui-icon-element mw-ui-icon-ok mw-ui-button mw-ui-progressive">OK</div>
+       // <div class="mw-ui-icon mw-ui-icon-element mw-ui-icon-ok">OK</div><br/>
+       // <div class="mw-ui-icon mw-ui-icon-element mw-ui-icon-ok mw-ui-button mw-ui-progressive">OK</div><br/>
+       // <button class="mw-ui-icon mw-ui-icon-ok mw-ui-icon-element mw-ui-button mw-ui-quiet" title="">Close</button>
        //
        // Styleguide 6.1.1.
        &.mw-ui-icon-element {
index af02429..bbe8cc7 100644 (file)
  */
 class SiteListFileCacheBuilderTest extends PHPUnit_Framework_TestCase {
 
-       public function testBuild() {
-               $cacheFile = $this->getCacheFile();
+       protected function setUp() {
+               $this->cacheFile = $this->getCacheFile();
+       }
 
-               $cacheBuilder = $this->newSiteListFileCacheBuilder( $this->getSites(), $cacheFile );
+       protected function tearDown() {
+               unlink( $this->cacheFile );
+       }
+
+       public function testBuild() {
+               $cacheBuilder = $this->newSiteListFileCacheBuilder( $this->getSites() );
                $cacheBuilder->build();
 
-               $contents = file_get_contents( $cacheFile );
+               $contents = file_get_contents( $this->cacheFile );
                $this->assertEquals( json_encode( $this->getExpectedData() ), $contents );
        }
 
@@ -85,10 +91,10 @@ class SiteListFileCacheBuilderTest extends PHPUnit_Framework_TestCase {
                );
        }
 
-       private function newSiteListFileCacheBuilder( SiteList $sites, $cacheFile ) {
+       private function newSiteListFileCacheBuilder( SiteList $sites ) {
                return new SiteListFileCacheBuilder(
                        $this->getSiteSQLStore( $sites ),
-                       $cacheFile
+                       $this->cacheFile
                );
        }
 
@@ -124,7 +130,7 @@ class SiteListFileCacheBuilderTest extends PHPUnit_Framework_TestCase {
        }
 
        private function getCacheFile() {
-               return sys_get_temp_dir() . '/sites-' . time() . '.json';
+               return tempnam( sys_get_temp_dir(), 'mw-test-sitelist' );
        }
 
 }
index b598eed..05dcd8a 100644 (file)
  */
 class SiteListFileCacheTest extends PHPUnit_Framework_TestCase {
 
-       public function testGetSites() {
-               $cacheFile = $this->getCacheFile();
+       protected function setUp() {
+               $this->cacheFile = $this->getCacheFile();
+       }
+
+       protected function tearDown() {
+               unlink( $this->cacheFile );
+       }
 
+       public function testGetSites() {
                $sites = $this->getSites();
-               $cacheBuilder = $this->newSiteListFileCacheBuilder( $sites, $cacheFile );
+               $cacheBuilder = $this->newSiteListFileCacheBuilder( $sites );
                $cacheBuilder->build();
 
-               $cache = new SiteListFileCache( $cacheFile );
+               $cache = new SiteListFileCache( $this->cacheFile );
                $this->assertEquals( $sites, $cache->getSites() );
        }
 
        public function testGetSite() {
-               $cacheFile = $this->getCacheFile();
-
                $sites = $this->getSites();
-               $cacheBuilder = $this->newSiteListFileCacheBuilder( $sites, $cacheFile );
+               $cacheBuilder = $this->newSiteListFileCacheBuilder( $sites );
                $cacheBuilder->build();
 
-               $cache = new SiteListFileCache( $cacheFile );
+               $cache = new SiteListFileCache( $this->cacheFile );
 
                $this->assertEquals( $sites->getSite( 'enwiktionary' ), $cache->getSite( 'enwiktionary' ) );
        }
 
-       private function newSiteListFileCacheBuilder( SiteList $sites, $cacheFile ) {
+       private function newSiteListFileCacheBuilder( SiteList $sites ) {
                return new SiteListFileCacheBuilder(
                        $this->getSiteSQLStore( $sites ),
-                       $cacheFile
+                       $this->cacheFile
                );
        }
 
@@ -92,7 +96,7 @@ class SiteListFileCacheTest extends PHPUnit_Framework_TestCase {
        }
 
        private function getCacheFile() {
-               return sys_get_temp_dir() . '/sites-' . time() . '.json';
+               return tempnam( sys_get_temp_dir(), 'mw-test-sitelist' );
        }
 
 }