Miscellaneous profiling fixes
authorPlatonides <platonides@gmail.com>
Sun, 6 Jan 2013 18:23:10 +0000 (19:23 +0100)
committerPlatonides <platonides@gmail.com>
Sun, 6 Jan 2013 21:35:11 +0000 (22:35 +0100)
Change-Id: I8d8ce0bc0383e4feb4ed38fd96b2dd516dcb742e

includes/EditPage.php
includes/Linker.php
includes/User.php
includes/db/DatabaseMysql.php
includes/db/LoadBalancer.php
includes/parser/Parser_LinkHooks.php

index cf2b878..b4b82eb 100644 (file)
@@ -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;
                }
index 05a9905..d1a1ac0 100644 (file)
@@ -1923,7 +1923,7 @@ class Linker {
                        }
                        $outText .= '</ul>';
                }
-               wfProfileOut( __METHOD__  );
+               wfProfileOut( __METHOD__ );
                return $outText;
        }
 
@@ -1949,7 +1949,7 @@ class Linker {
                        }
                        $outText .= '</ul>';
                }
-               wfProfileOut( __METHOD__  );
+               wfProfileOut( __METHOD__ );
                return $outText;
        }
 
index fad9af8..ed3fe76 100644 (file)
@@ -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__ );
index 36a1126..8708608 100644 (file)
@@ -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" );
                        }
                }
 
index 8ba5f4f..2858cd9 100644 (file)
@@ -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] ) ) {
index e4f5d12..d1ca8aa 100644 (file)
@@ -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;
                }