From fb0966908bf2ea0bafe88dfda0ad6660c2cbe107 Mon Sep 17 00:00:00 2001 From: Platonides Date: Sun, 6 Jan 2013 19:23:10 +0100 Subject: [PATCH] Miscellaneous profiling fixes Change-Id: I8d8ce0bc0383e4feb4ed38fd96b2dd516dcb742e --- includes/EditPage.php | 7 ++++--- includes/Linker.php | 4 ++-- includes/User.php | 1 + includes/db/DatabaseMysql.php | 4 ++-- includes/db/LoadBalancer.php | 2 +- includes/parser/Parser_LinkHooks.php | 4 +++- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index cf2b87875f..b4b82ebc87 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1235,7 +1235,7 @@ class EditPage { $status = Status::newGood(); - wfProfileIn( __METHOD__ ); + wfProfileIn( __METHOD__ ); wfProfileIn( __METHOD__ . '-checks' ); if ( !wfRunHooks( 'EditPage::attemptSave', array( $this ) ) ) { @@ -1243,7 +1243,7 @@ class EditPage { $status->fatal( 'hookaborted' ); $status->value = self::AS_HOOK_ERROR; wfProfileOut( __METHOD__ . '-checks' ); - wfProfileOut( __METHOD__ ); + wfProfileOut( __METHOD__ ); return $status; } @@ -1253,6 +1253,7 @@ class EditPage { } catch ( MWContentSerializationException $ex ) { $status->fatal( 'content-failed-to-parse', $this->contentModel, $this->contentFormat, $ex->getMessage() ); $status->value = self::AS_PARSE_ERROR; + wfProfileOut( __METHOD__ . '-checks' ); wfProfileOut( __METHOD__ ); return $status; } @@ -1265,7 +1266,7 @@ class EditPage { $status->setResult( false, $code ); wfProfileOut( __METHOD__ . '-checks' ); - wfProfileOut( __METHOD__ ); + wfProfileOut( __METHOD__ ); return $status; } diff --git a/includes/Linker.php b/includes/Linker.php index 05a9905669..d1a1ac0fa5 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1923,7 +1923,7 @@ class Linker { } $outText .= ''; } - wfProfileOut( __METHOD__ ); + wfProfileOut( __METHOD__ ); return $outText; } @@ -1949,7 +1949,7 @@ class Linker { } $outText .= ''; } - wfProfileOut( __METHOD__ ); + wfProfileOut( __METHOD__ ); return $outText; } diff --git a/includes/User.php b/includes/User.php index fad9af8d7b..ed3fe7630f 100644 --- a/includes/User.php +++ b/includes/User.php @@ -293,6 +293,7 @@ class User { wfRunHooks( 'UserLoadAfterLoadFromSession', array( $this ) ); break; default: + wfProfileOut( __METHOD__ ); throw new MWException( "Unrecognised value for User->mFrom: \"{$this->mFrom}\"" ); } wfProfileOut( __METHOD__ ); diff --git a/includes/db/DatabaseMysql.php b/includes/db/DatabaseMysql.php index 36a1126ca2..8708608eb6 100644 --- a/includes/db/DatabaseMysql.php +++ b/includes/db/DatabaseMysql.php @@ -133,7 +133,7 @@ class DatabaseMysql extends DatabaseBase { substr( $password, 0, 3 ) . "..., error: " . $error . "\n" ); wfProfileOut( __METHOD__ ); - $this->reportConnectionError( $error ); + return $this->reportConnectionError( $error ); } if ( $dbName != '' ) { @@ -146,7 +146,7 @@ class DatabaseMysql extends DatabaseBase { "from client host " . wfHostname() . "\n" ); wfProfileOut( __METHOD__ ); - $this->reportConnectionError( "Error selecting database $dbName" ); + return $this->reportConnectionError( "Error selecting database $dbName" ); } } diff --git a/includes/db/LoadBalancer.php b/includes/db/LoadBalancer.php index 8ba5f4f80b..2858cd9aa2 100644 --- a/includes/db/LoadBalancer.php +++ b/includes/db/LoadBalancer.php @@ -579,7 +579,7 @@ class LoadBalancer { wfProfileIn( __METHOD__ ); if ( $wiki !== false ) { $conn = $this->openForeignConnection( $i, $wiki ); - wfProfileOut( __METHOD__); + wfProfileOut( __METHOD__ ); return $conn; } if ( isset( $this->mConns['local'][$i][0] ) ) { diff --git a/includes/parser/Parser_LinkHooks.php b/includes/parser/Parser_LinkHooks.php index e4f5d1262a..d1ca8aac72 100644 --- a/includes/parser/Parser_LinkHooks.php +++ b/includes/parser/Parser_LinkHooks.php @@ -149,8 +149,8 @@ class Parser_LinkHooks extends Parser { $holders = new LinkHolderArray( $this ); if( is_null( $this->mTitle ) ) { - wfProfileOut( __METHOD__ ); wfProfileOut( __METHOD__.'-setup' ); + wfProfileOut( __METHOD__ ); throw new MWException( __METHOD__.": \$this->mTitle is null\n" ); } @@ -224,10 +224,12 @@ class Parser_LinkHooks extends Parser { wfProfileIn( __METHOD__ ); $wt = isset($paramText) ? "[[$titleText|$paramText]]" : "[[$titleText]]"; wfProfileIn( __METHOD__."-misc" ); + # Don't allow internal links to pages containing # PROTO: where PROTO is a valid URL protocol; these # should be external links. if( preg_match('/^\b(?i:' . wfUrlProtocols() . ')/', $titleText) ) { + wfProfileOut( __METHOD__."-misc" ); wfProfileOut( __METHOD__ ); return $wt; } -- 2.20.1