diff --git a/Math.hooks.php b/Math.hooks.php index c9e6482..62b64e0 100644 --- a/Math.hooks.php +++ b/Math.hooks.php @@ -97,7 +97,6 @@ class MathHooks { return ''; } - wfProfileIn( __METHOD__ ); $mode = (int)$parser->getUser()->getOption( 'math' ); // Indicate that this page uses math. @@ -139,7 +138,6 @@ class MathHooks { } // Writes cache if rendering was successful $renderer->writeCache(); - wfProfileOut( __METHOD__ ); return array( $renderedMath, "markerType" => 'nowiki' ); } diff --git a/MathLaTeXML.php b/MathLaTeXML.php index 8df9251..4fca925 100644 --- a/MathLaTeXML.php +++ b/MathLaTeXML.php @@ -94,7 +94,7 @@ class MathLaTeXML extends MathMathML { */ protected function doRender() { global $wgMathDebug; - wfProfileIn( __METHOD__ ); + if ( trim( $this->getTex() ) === '' ) { wfDebugLog( "Math", "Rendering was requested, but no TeX string is specified." ); $this->lastError = $this->getError( 'math_empty_tex' ); @@ -127,7 +127,6 @@ class MathLaTeXML extends MathMathML { wfDebugLog( "Math", "\nLaTeXML InvalidMathML:" . var_export( array( 'post' => $post, 'host' => $host , 'result' => $res ), true ) . "\n\n" ); - wfProfileOut( __METHOD__ ); return false; } } else { @@ -135,12 +134,10 @@ class MathLaTeXML extends MathMathML { wfDebugLog( "Math", "\nLaTeXML InvalidJSON:" . var_export( array( 'post' => $post, 'host' => $host , 'res' => $res ), true ) . "\n\n" ); - wfProfileOut( __METHOD__ ); return false; } } else { // Error message has already been set. - wfProfileOut( __METHOD__ ); return false; } } diff --git a/MathMathML.php b/MathMathML.php index b42e7d8..c40f8b9 100644 --- a/MathMathML.php +++ b/MathMathML.php @@ -82,15 +82,12 @@ class MathMathML extends MathRenderer { * @see MathRenderer::render() */ public function render( $forceReRendering = false ) { - wfProfileIn( __METHOD__ ); if ( $forceReRendering ) { $this->setPurge( true ); } if ( $this->renderingRequired() ) { - wfProfileOut( __METHOD__ ); - return $this->doRender( ); + return $this->doRender(); } - wfProfileOut( __METHOD__ ); return true; } @@ -143,7 +140,6 @@ class MathMathML extends MathRenderer { // TODO: Change the timeout mechanism. global $wgMathLaTeXMLTimeout; - wfProfileIn( __METHOD__ ); $error = ''; $res = null; if ( !$host ) { @@ -159,7 +155,6 @@ class MathMathML extends MathRenderer { $status = $req->execute(); if ( $status->isGood() ) { $res = $req->getContent(); - wfProfileOut( __METHOD__ ); return true; } else { if ( $status->hasMessage( 'http-timed-out' ) ) { @@ -176,7 +171,6 @@ class MathMathML extends MathRenderer { . var_export( array( 'post' => $post, 'host' => $host , 'errormsg' => $errormsg ), true ) . "\n\n" ); } - wfProfileOut( __METHOD__ ); return false; } } diff --git a/MathRenderer.php b/MathRenderer.php index 7e69eb1..b1b2bc6 100644 --- a/MathRenderer.php +++ b/MathRenderer.php @@ -259,7 +259,6 @@ abstract class MathRenderer { * @return boolean true if read successfully, false otherwise */ public function readFromDatabase() { - wfProfileIn( __METHOD__ ); /** @var DatabaseBase */ $dbr = wfGetDB( DB_SLAVE ); /** @var ResultWrapper */ @@ -270,12 +269,10 @@ abstract class MathRenderer { if ( $rpage !== false ) { $this->initializeFromDatabaseRow( $rpage ); $this->storedInDatabase = true; - wfProfileOut( __METHOD__ ); return true; } else { # Missing from the database and/or the render cache $this->storedInDatabase = false; - wfProfileOut( __METHOD__ ); return false; } } diff --git a/MathTexvc.php b/MathTexvc.php index 562af16..a2f6113 100644 --- a/MathTexvc.php +++ b/MathTexvc.php @@ -174,11 +174,9 @@ class MathTexvc extends MathRenderer { public function callTexvc() { global $wgTexvc, $wgTexvcBackgroundColor, $wgHooks; - wfProfileIn( __METHOD__ ); $tmpDir = wfTempDir(); if ( !is_executable( $wgTexvc ) ) { wfDebugLog( 'texvc', "$wgTexvc does not exist or is not executable." ); - wfProfileOut( __METHOD__ ); return $this->getError( 'math_notexvc' ); } @@ -204,11 +202,9 @@ class MathTexvc extends MathRenderer { if ( strlen( $contents ) == 0 ) { if ( !file_exists( $tmpDir ) || !is_writable( $tmpDir ) ) { wfDebugLog( 'texvc', "TeX output directory $tmpDir is missing or not writable" ); - wfProfileOut( __METHOD__ ); return $this->getError( 'math_bad_tmpdir' ); } else { wfDebugLog( 'texvc', "TeX command '$cmd' returned no output and status code $retval." ); - wfProfileOut( __METHOD__ ); return $this->getError( 'math_unknown_error' ); } } @@ -265,16 +261,12 @@ class MathTexvc extends MathRenderer { wfRunHooks( 'MathAfterTexvc', array( &$this, &$errmsg ) ); if ( $errmsg ) { - wfProfileOut( __METHOD__ ); return $errmsg; } elseif ( !preg_match( "/^[a-f0-9]{32}$/", $this->getHash() ) ) { - wfProfileOut( __METHOD__ ); return $this->getError( 'math_unknown_error' ); } elseif ( !file_exists( "$tmpDir/{$this->getHash()}.png" ) ) { - wfProfileOut( __METHOD__ ); return $this->getError( 'math_image_error' ); } elseif ( filesize( "$tmpDir/{$this->getHash()}.png" ) == 0 ) { - wfProfileOut( __METHOD__ ); return $this->getError( 'math_image_error' ); } @@ -283,7 +275,6 @@ class MathTexvc extends MathRenderer { $backend = $this->getBackend(); # Create any containers/directories as needed... if ( !$backend->prepare( array( 'dir' => $hashpath ) )->isOK() ) { - wfProfileOut( __METHOD__ ); return $this->getError( 'math_output_error' ); } // Store the file at the final storage path... @@ -304,7 +295,6 @@ class MathTexvc extends MathRenderer { 'ref' => $tempFsFile // keep file alive ); - wfProfileOut( __METHOD__ ); return self::MW_TEXVC_SUCCESS; } @@ -367,7 +357,6 @@ class MathTexvc extends MathRenderer { public function writeCache() { global $wgUseSquid; - wfProfileIn( __METHOD__ ); $updated = parent::writeCache(); // If we're replacing an older version of the image, make sure it's current. if ( $updated && $wgUseSquid ) { @@ -375,7 +364,7 @@ class MathTexvc extends MathRenderer { $u = new SquidUpdate( $urls ); $u->doUpdate(); } - wfProfileOut( __METHOD__ ); + return $updated; } @@ -387,11 +376,9 @@ class MathTexvc extends MathRenderer { public function readCache() { global $wgMathCheckFiles; - wfProfileIn( __METHOD__ ); if ( $this->isInDatabase() ) { if ( !$wgMathCheckFiles ) { // Short-circuit the file existence & migration checks - wfProfileOut( __METHOD__ ); return true; } $filename = $this->getHashPath() . "/{$this->getHash()}.png"; // final storage path @@ -401,12 +388,10 @@ class MathTexvc extends MathRenderer { // Some horrible error corrupted stuff :( $backend->quickDelete( array( 'src' => $filename ) ); } else { - wfProfileOut( __METHOD__ ); return true; // cache hit } } } - wfProfileOut( __METHOD__ ); return false; } public function getPng() {