From 52f3b13312e2d261f748f4f28577deaf8e197e6f Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Wed, 3 Dec 2014 19:48:27 -0800 Subject: [PATCH] Remove Profiler::isStub() Just check for ProfilerStub directly. Change-Id: I503916599f182df4206da5282193ae6ec9324ee6 --- includes/GlobalFunctions.php | 2 +- includes/db/Database.php | 2 +- includes/profiler/Profiler.php | 9 +-------- includes/profiler/ProfilerStandard.php | 9 --------- includes/profiler/ProfilerStub.php | 4 ---- includes/profiler/ProfilerXhprof.php | 4 ---- 6 files changed, 3 insertions(+), 27 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 1a901f3947..14326ec29e 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -1196,7 +1196,7 @@ function wfLogProfilingData() { $profiler = Profiler::instance(); # Profiling must actually be enabled... - if ( $profiler->isStub() ) { + if ( $profiler instanceof ProfilerStub ) { return; } diff --git a/includes/db/Database.php b/includes/db/Database.php index 41b70c39eb..a805fa5e03 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -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 ) { diff --git a/includes/profiler/Profiler.php b/includes/profiler/Profiler.php index 9650ff5199..2be142fc6c 100644 --- a/includes/profiler/Profiler.php +++ b/includes/profiler/Profiler.php @@ -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; } diff --git a/includes/profiler/ProfilerStandard.php b/includes/profiler/ProfilerStandard.php index ab5e3abfb1..87706e6abc 100644 --- a/includes/profiler/ProfilerStandard.php +++ b/includes/profiler/ProfilerStandard.php @@ -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. */ diff --git a/includes/profiler/ProfilerStub.php b/includes/profiler/ProfilerStub.php index 6fc74ef29a..b400601610 100644 --- a/includes/profiler/ProfilerStub.php +++ b/includes/profiler/ProfilerStub.php @@ -27,10 +27,6 @@ * @ingroup Profiler */ class ProfilerStub extends Profiler { - public function isStub() { - return true; - } - public function profileIn( $fn ) { } diff --git a/includes/profiler/ProfilerXhprof.php b/includes/profiler/ProfilerXhprof.php index 88196db130..69d25524d5 100644 --- a/includes/profiler/ProfilerXhprof.php +++ b/includes/profiler/ProfilerXhprof.php @@ -95,10 +95,6 @@ class ProfilerXhprof extends Profiler { $this->xhprof = new Xhprof( $params ); } - public function isStub() { - return false; - } - /** * No-op for xhprof profiling. * -- 2.20.1