Remove obvious function-level profiling

Change-Id: I0c272eb337566eff28d46d198c9aa065ffdbddb2
This commit is contained in:
Chad Horohoe 2015-02-11 08:49:13 -08:00
parent 1c58fd6df9
commit d9869ef8d0
2 changed files with 0 additions and 28 deletions

View file

@ -48,10 +48,8 @@ class ApiQueryExtracts extends ApiQueryBase {
}
public function execute() {
wfProfileIn( __METHOD__ );
$titles = $this->getPageSet()->getGoodTitles();
if ( count( $titles ) == 0 ) {
wfProfileOut( __METHOD__ );
return;
}
$isXml = $this->getMain()->isInternalMode() || $this->getMain()->getPrinter()->getFormat() == 'XML';
@ -94,7 +92,6 @@ class ApiQueryExtracts extends ApiQueryBase {
break;
}
}
wfProfileOut( __METHOD__ );
}
public function getCacheMode( $params ) {
@ -107,7 +104,6 @@ class ApiQueryExtracts extends ApiQueryBase {
* @return string
*/
private function getExtract( Title $title ) {
wfProfileIn( __METHOD__ );
$page = WikiPage::factory( $title );
$introOnly = $this->params['intro'];
@ -124,7 +120,6 @@ class ApiQueryExtracts extends ApiQueryBase {
$text = $this->convertText( $text, $title, $this->params['plaintext'] );
$this->setCache( $page, $text );
}
wfProfileOut( __METHOD__ );
return $text;
}
@ -167,7 +162,6 @@ class ApiQueryExtracts extends ApiQueryBase {
* @return string
*/
private function parse( WikiPage $page ) {
wfProfileIn( __METHOD__ );
if ( !$this->parserOptions ) {
$this->parserOptions = new ParserOptions( new User( '127.0.0.1' ) );
}
@ -180,7 +174,6 @@ class ApiQueryExtracts extends ApiQueryBase {
if ( $this->params['intro'] ) {
$text = $this->getFirstSection( $text, false );
}
wfProfileOut( __METHOD__ );
return $text;
}
}
@ -211,7 +204,6 @@ class ApiQueryExtracts extends ApiQueryBase {
throw $e;
}
}
wfProfileOut( __METHOD__ );
return $data['parse']['text']['*'];
}
@ -221,7 +213,6 @@ class ApiQueryExtracts extends ApiQueryBase {
* @return string
*/
private function convertText( $text ) {
wfProfileIn( __METHOD__ );
$fmt = new ExtractFormatter(
$text,
$this->params['plaintext'],
@ -229,7 +220,6 @@ class ApiQueryExtracts extends ApiQueryBase {
);
$text = $fmt->getText();
wfProfileOut( __METHOD__ );
return trim( $text );
}
@ -254,12 +244,10 @@ class ApiQueryExtracts extends ApiQueryBase {
* @return string
*/
private function getFirstChars( $text, $requestedLength ) {
wfProfileIn( __METHOD__ );
$text = ExtractFormatter::getFirstChars( $text, $requestedLength );
// Fix possibly unclosed tags
$text = $this->tidy( $text );
$text .= wfMessage( 'ellipsis' )->inContentLanguage()->text();
wfProfileOut( __METHOD__ );
return $text;
}
@ -269,11 +257,8 @@ class ApiQueryExtracts extends ApiQueryBase {
* @return string
*/
private function getFirstSentences( $text, $requestedSentenceCount ) {
wfProfileIn( __METHOD__ );
$text = ExtractFormatter::getFirstSentences( $text, $requestedSentenceCount );
$text = $this->tidy( $text );
wfProfileOut( __METHOD__ );
return $text;
}
@ -283,11 +268,9 @@ class ApiQueryExtracts extends ApiQueryBase {
* @return string
*/
private function tidy( $text ) {
wfProfileIn( __METHOD__ );
if ( $this->getConfig()->get( 'UseTidy' ) && !$this->params['plaintext'] ) {
$text = trim ( MWTidy::tidy( $text ) );
}
wfProfileOut( __METHOD__ );
return $text;
}

View file

@ -35,7 +35,6 @@ class ExtractFormatter extends HtmlFormatter {
* @param Config $config
*/
public function __construct( $text, $plainText, Config $config ) {
wfProfileIn( __METHOD__ );
parent::__construct( HtmlFormatter::wrapHTML( $text ) );
$this->plainText = $plainText;
@ -47,11 +46,9 @@ class ExtractFormatter extends HtmlFormatter {
} else {
$this->flatten( array( 'a' ) );
}
wfProfileOut( __METHOD__ );
}
public function getText( $dummy = null ) {
wfProfileIn( __METHOD__ );
$this->filterContent();
$text = parent::getText();
if ( $this->plainText ) {
@ -60,19 +57,16 @@ class ExtractFormatter extends HtmlFormatter {
$text = str_replace( "\r", "\n", $text ); // for Windows
$text = preg_replace( "/\n{3,}/", "\n\n", $text ); // normalise newlines
}
wfProfileOut( __METHOD__ );
return $text;
}
public function onHtmlReady( $html ) {
wfProfileIn( __METHOD__ );
if ( $this->plainText ) {
$html = preg_replace( '/\s*(<h([1-6])\b)/i',
"\n\n" . self::SECTION_MARKER_START . '$2' . self::SECTION_MARKER_END . '$1' ,
$html
);
}
wfProfileOut( __METHOD__ );
return $html;
}
@ -84,7 +78,6 @@ class ExtractFormatter extends HtmlFormatter {
* @return string
*/
public static function getFirstSentences( $text, $requestedSentenceCount ) {
wfProfileIn( __METHOD__ );
// Based on code from OpenSearchXml by Brion Vibber
$endchars = array(
'([^\d])\.\s', '\!\s', '\?\s', // regular ASCII
@ -109,7 +102,6 @@ class ExtractFormatter extends HtmlFormatter {
$lines = explode( "\n", $text );
$text = trim( $lines[0] );
}
wfProfileOut( __METHOD__ );
return $text;
}
@ -121,15 +113,12 @@ class ExtractFormatter extends HtmlFormatter {
* @return string
*/
public static function getFirstChars( $text, $requestedLength ) {
wfProfileIn( __METHOD__ );
$length = mb_strlen( $text );
if ( $length <= $requestedLength ) {
wfProfileOut( __METHOD__ );
return $text;
}
$pattern = "#^.{{$requestedLength}}[\\w/]*>?#su";
preg_match( $pattern, $text, $m );
wfProfileOut( __METHOD__ );
return $m[0];
}