Merge "Remove obvious function-level profiling"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 7 Jan 2015 19:27:45 +0000 (19:27 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 7 Jan 2015 19:27:45 +0000 (19:27 +0000)
1  2 
includes/MagicWord.php
includes/page/WikiPage.php

diff --combined includes/MagicWord.php
@@@ -330,15 -330,12 +330,12 @@@ class MagicWord 
         */
        function load( $id ) {
                global $wgContLang;
-               wfProfileIn( __METHOD__ );
                $this->mId = $id;
                $wgContLang->getMagic( $this );
                if ( !$this->mSynonyms ) {
                        $this->mSynonyms = array( 'brionmademeputthishere' );
-                       wfProfileOut( __METHOD__ );
                        throw new MWException( "Error: invalid magic word '$id'" );
                }
-               wfProfileOut( __METHOD__ );
        }
  
        /**
         * This method uses the php feature to do several replacements at the same time,
         * thereby gaining some efficiency. The result is placed in the out variable
         * $result. The return value is true if something was replaced.
 -       * @todo Should this be static? It doesn't seem to be used at all
 +       * @deprecated since 1.25, unused
         *
         * @param array $magicarr
         * @param string $subject
         * @return bool
         */
        function replaceMultiple( $magicarr, $subject, &$result ) {
 +              wfDeprecated( __METHOD__, '1.25' );
                $search = array();
                $replace = array();
                foreach ( $magicarr as $id => $replacement ) {
@@@ -557,7 -557,6 +557,6 @@@ class WikiPage implements Page, IDBAcce
         * @return Revision|null
         */
        public function getOldestRevision() {
-               wfProfileIn( __METHOD__ );
  
                // Try using the slave database first, then try the master
                $continue = 2;
                        }
                }
  
-               wfProfileOut( __METHOD__ );
                return $row ? Revision::newFromRow( $row ) : null;
        }
  
         * @return array Array of authors, duplicates not removed
         */
        public function getLastNAuthors( $num, $revLatest = 0 ) {
-               wfProfileIn( __METHOD__ );
                // First try the slave
                // If that doesn't have the latest revision, try the master
                $continue = 2;
                        );
  
                        if ( !$res ) {
-                               wfProfileOut( __METHOD__ );
                                return array();
                        }
  
                        $authors[] = $row->rev_user_text;
                }
  
-               wfProfileOut( __METHOD__ );
                return $authors;
        }
  
         * @return ParserOutput|bool ParserOutput or false if the revision was not found
         */
        public function getParserOutput( ParserOptions $parserOptions, $oldid = null ) {
-               wfProfileIn( __METHOD__ );
  
                $useParserCache = $this->isParserCacheUsed( $parserOptions, $oldid );
                wfDebug( __METHOD__ . ': using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" );
                if ( $useParserCache ) {
                        $parserOutput = ParserCache::singleton()->get( $this, $parserOptions );
                        if ( $parserOutput !== false ) {
-                               wfProfileOut( __METHOD__ );
                                return $parserOutput;
                        }
                }
                $pool = new PoolWorkArticleView( $this, $parserOptions, $oldid, $useParserCache );
                $pool->execute();
  
-               wfProfileOut( __METHOD__ );
  
                return $pool->getParserOutput();
        }
         * @return int The newly created page_id key, or false if the title already existed
         */
        public function insertOn( $dbw ) {
-               wfProfileIn( __METHOD__ );
  
                $page_id = $dbw->nextSequenceValue( 'page_page_id_seq' );
                $dbw->insert( 'page', array(
                        $this->mId = $newid;
                        $this->mTitle->resetArticleID( $newid );
                }
-               wfProfileOut( __METHOD__ );
  
                return $affected ? $newid : false;
        }
        ) {
                global $wgContentHandlerUseDB;
  
-               wfProfileIn( __METHOD__ );
  
                $content = $revision->getContent();
                $len = $content ? $content->getSize() : 0;
                                                                                                        $this->mLatest, $revision->getContentModel() );
                }
  
-               wfProfileOut( __METHOD__ );
                return $result;
        }
  
                        return true;
                }
  
-               wfProfileIn( __METHOD__ );
                if ( $isRedirect ) {
                        $this->insertRedirectEntry( $redirectTitle );
                } else {
                if ( $this->getTitle()->getNamespace() == NS_FILE ) {
                        RepoGroup::singleton()->getLocalRepo()->invalidateImageRedirect( $this->getTitle() );
                }
-               wfProfileOut( __METHOD__ );
  
                return ( $dbw->affectedRows() != 0 );
        }
         * @return bool
         */
        public function updateIfNewerOn( $dbw, $revision ) {
-               wfProfileIn( __METHOD__ );
  
                $row = $dbw->selectRow(
                        array( 'revision', 'page' ),
  
                if ( $row ) {
                        if ( wfTimestamp( TS_MW, $row->rev_timestamp ) >= $revision->getTimestamp() ) {
-                               wfProfileOut( __METHOD__ );
                                return false;
                        }
                        $prev = $row->rev_id;
  
                $ret = $this->updateRevisionOn( $dbw, $revision, $prev, $lastRevIsRedirect );
  
-               wfProfileOut( __METHOD__ );
                return $ret;
        }
  
         */
        public function replaceSectionContent( $sectionId, Content $sectionContent, $sectionTitle = '',
                $edittime = null ) {
-               wfProfileIn( __METHOD__ );
  
                $baseRevId = null;
                if ( $edittime && $sectionId !== 'new' ) {
                        }
                }
  
-               wfProfileOut( __METHOD__ );
                return $this->replaceSectionAtRev( $sectionId, $sectionContent, $sectionTitle, $baseRevId );
        }
  
        public function replaceSectionAtRev( $sectionId, Content $sectionContent,
                $sectionTitle = '', $baseRevId = null
        ) {
-               wfProfileIn( __METHOD__ );
  
                if ( strval( $sectionId ) === '' ) {
                        // Whole-page edit; let the whole text through
                        $newContent = $sectionContent;
                } else {
                        if ( !$this->supportsSections() ) {
-                               wfProfileOut( __METHOD__ );
                                throw new MWException( "sections not supported for content model " .
                                        $this->getContentHandler()->getModelID() );
                        }
                                if ( !$rev ) {
                                        wfDebug( __METHOD__ . " asked for bogus section (page: " .
                                                $this->getId() . "; section: $sectionId)\n" );
-                                       wfProfileOut( __METHOD__ );
                                        return null;
                                }
  
  
                        if ( !$oldContent ) {
                                wfDebug( __METHOD__ . ": no page text\n" );
-                               wfProfileOut( __METHOD__ );
                                return null;
                        }
  
                        $newContent = $oldContent->replaceSection( $sectionId, $sectionContent, $sectionTitle );
                }
  
-               wfProfileOut( __METHOD__ );
                return $newContent;
        }
  
                        throw new MWException( 'Something is trying to edit an article with an empty title' );
                }
  
-               wfProfileIn( __METHOD__ );
  
                if ( !$content->getContentHandler()->canBeUsedOn( $this->getTitle() ) ) {
-                       wfProfileOut( __METHOD__ );
                        return Status::newFatal( 'content-not-allowed-here',
                                ContentHandler::getLocalizedName( $content->getModel() ),
                                $this->getTitle()->getPrefixedText() );
                                $status->fatal( 'edit-hook-aborted' );
                        }
  
-                       wfProfileOut( __METHOD__ );
                        return $status;
                }
  
                                wfDebug( __METHOD__ . ": EDIT_UPDATE specified but article doesn't exist\n" );
                                $status->fatal( 'edit-gone-missing' );
  
-                               wfProfileOut( __METHOD__ );
                                return $status;
                        } elseif ( !$old_content ) {
                                // Sanity check for bug 37225
-                               wfProfileOut( __METHOD__ );
                                throw new MWException( "Could not find text for current revision {$oldid}." );
                        }
  
                                        if ( !$status->isOK() ) {
                                                $dbw->rollback( __METHOD__ );
  
-                                               wfProfileOut( __METHOD__ );
                                                return $status;
                                        }
                                        $revisionId = $revision->insertOn( $dbw );
  
                                                $dbw->rollback( __METHOD__ );
  
-                                               wfProfileOut( __METHOD__ );
                                                return $status;
                                        }
  
                                if ( !$status->isOK() ) {
                                        $dbw->rollback( __METHOD__ );
  
-                                       wfProfileOut( __METHOD__ );
                                        return $status;
                                }
  
                                        $dbw->rollback( __METHOD__ );
                                        $status->fatal( 'edit-already-exists' );
  
-                                       wfProfileOut( __METHOD__ );
                                        return $status;
                                }
  
                        $user->addAutopromoteOnceGroups( 'onEdit' );
                } );
  
-               wfProfileOut( __METHOD__ );
                return $status;
        }
  
        public function doEditUpdates( Revision $revision, User $user, array $options = array() ) {
                global $wgEnableParserCache;
  
-               wfProfileIn( __METHOD__ );
  
                $options += array(
                        'changed' => true,
                }
  
                if ( !$this->exists() ) {
-                       wfProfileOut( __METHOD__ );
                        return;
                }
  
                        self::onArticleEdit( $this->mTitle );
                }
  
-               wfProfileOut( __METHOD__ );
        }
  
        /**
        public function doQuickEditContent( Content $content, User $user, $comment = '', $minor = false,
                $serialFormat = null
        ) {
-               wfProfileIn( __METHOD__ );
  
                $serialized = $content->serialize( $serialFormat );
  
  
                Hooks::run( 'NewRevisionFromEditComplete', array( $this, $revision, false, $user ) );
  
-               wfProfileOut( __METHOD__ );
        }
  
        /**
         *
         * @param Title $title
         */
 -      public static function onArticleCreate( $title ) {
 +      public static function onArticleCreate( Title $title ) {
                // Update existence markers on article/talk tabs...
                $other = $title->getOtherPage();
  
         *
         * @param Title $title
         */
 -      public static function onArticleDelete( $title ) {
 +      public static function onArticleDelete( Title $title ) {
                // Update existence markers on article/talk tabs...
                $other = $title->getOtherPage();
  
         * Purge caches on page update etc
         *
         * @param Title $title
 -       * @todo Verify that $title is always a Title object (and never false or
 -       *   null), add Title hint to parameter $title.
         */
 -      public static function onArticleEdit( $title ) {
 +      public static function onArticleEdit( Title $title ) {
                // Invalidate caches of articles which include this page
                DeferredUpdates::addHTMLCacheUpdate( $title, 'templatelinks' );