Remove Profiler::isStub()
authorChad Horohoe <chadh@wikimedia.org>
Thu, 4 Dec 2014 03:48:27 +0000 (19:48 -0800)
committerChad Horohoe <chadh@wikimedia.org>
Thu, 4 Dec 2014 04:19:56 +0000 (20:19 -0800)
Just check for ProfilerStub directly.

Change-Id: I503916599f182df4206da5282193ae6ec9324ee6

includes/GlobalFunctions.php
includes/db/Database.php
includes/profiler/Profiler.php
includes/profiler/ProfilerStandard.php
includes/profiler/ProfilerStub.php
includes/profiler/ProfilerXhprof.php

index 1a901f3..14326ec 100644 (file)
@@ -1196,7 +1196,7 @@ function wfLogProfilingData() {
        $profiler = Profiler::instance();
 
        # Profiling must actually be enabled...
-       if ( $profiler->isStub() ) {
+       if ( $profiler instanceof ProfilerStub ) {
                return;
        }
 
index 41b70c3..a805fa5 100644 (file)
@@ -963,7 +963,7 @@ abstract class DatabaseBase implements IDatabase {
                $isMaster = !is_null( $this->getLBInfo( 'master' ) );
 
                $profiler = Profiler::instance();
-               if ( !$profiler->isStub() ) {
+               if ( !$profiler instanceof ProfilerStub ) {
                        # generalizeSQL will probably cut down the query to reasonable
                        # logging size most of the time. The substr is really just a sanity check.
                        if ( $isMaster ) {
index 9650ff5..2be142f 100644 (file)
@@ -100,13 +100,6 @@ abstract class Profiler {
                }
        }
 
-       /**
-        * Return whether this a stub profiler
-        *
-        * @return bool
-        */
-       abstract public function isStub();
-
        /**
         * @param string $id
         */
@@ -178,7 +171,7 @@ abstract class Profiler {
        public function logData() {
                $output = isset( $this->params['output'] ) ? $this->params['output'] : null;
 
-               if ( !$output || $this->isStub() ) {
+               if ( !$output || $this instanceof ProfilerStub ) {
                        // return early when no output classes defined or we're a stub
                        return;
                }
index ab5e3ab..87706e6 100644 (file)
@@ -57,15 +57,6 @@ class ProfilerStandard extends Profiler {
                }
        }
 
-       /**
-        * Return whether this a stub profiler
-        *
-        * @return bool
-        */
-       public function isStub() {
-               return false;
-       }
-
        /**
         * Add the inital item in the stack.
         */
index 6fc74ef..b400601 100644 (file)
  * @ingroup Profiler
  */
 class ProfilerStub extends Profiler {
-       public function isStub() {
-               return true;
-       }
-
        public function profileIn( $fn ) {
        }
 
index 88196db..69d2552 100644 (file)
@@ -95,10 +95,6 @@ class ProfilerXhprof extends Profiler {
                $this->xhprof = new Xhprof( $params );
        }
 
-       public function isStub() {
-               return false;
-       }
-
        /**
         * No-op for xhprof profiling.
         *