From 531aa2906ec1086d8bf15f7d09f84fc775714cde Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 14 Sep 2016 05:18:57 -0700 Subject: [PATCH] Move TransactionProfiler to /libs/rdbms Change-Id: I13173facc9f101bca69e3bf3e85f292f8468e855 --- autoload.php | 2 +- includes/{profiler => libs/rdbms}/TransactionProfiler.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) rename includes/{profiler => libs/rdbms}/TransactionProfiler.php (98%) diff --git a/autoload.php b/autoload.php index a71d9432e7..4b5d9e8b8a 100644 --- a/autoload.php +++ b/autoload.php @@ -1419,7 +1419,7 @@ $wgAutoloadLocalClasses = [ 'TitleValue' => __DIR__ . '/includes/title/TitleValue.php', 'TrackBlobs' => __DIR__ . '/maintenance/storage/trackBlobs.php', 'TraditionalImageGallery' => __DIR__ . '/includes/gallery/TraditionalImageGallery.php', - 'TransactionProfiler' => __DIR__ . '/includes/profiler/TransactionProfiler.php', + 'TransactionProfiler' => __DIR__ . '/includes/libs/rdbms/TransactionProfiler.php', 'TransformParameterError' => __DIR__ . '/includes/media/MediaTransformOutput.php', 'TransformTooBigImageAreaError' => __DIR__ . '/includes/media/MediaTransformOutput.php', 'TransformationalImageHandler' => __DIR__ . '/includes/media/TransformationalImageHandler.php', diff --git a/includes/profiler/TransactionProfiler.php b/includes/libs/rdbms/TransactionProfiler.php similarity index 98% rename from includes/profiler/TransactionProfiler.php rename to includes/libs/rdbms/TransactionProfiler.php index bf26573cc3..5c9976d1bf 100644 --- a/includes/profiler/TransactionProfiler.php +++ b/includes/libs/rdbms/TransactionProfiler.php @@ -198,8 +198,9 @@ class TransactionProfiler implements LoggerAwareInterface { $elapsed = ( $eTime - $sTime ); if ( $isWrite && $n > $this->expect['maxAffected'] ) { - $this->logger->info( "Query affected $n row(s):\n" . $query . "\n" . - wfBacktrace( true ) ); + $this->logger->info( + "Query affected $n row(s):\n" . $query . "\n" . + ( new RuntimeException() )->getTraceAsString() ); } // Report when too many writes/queries happen... @@ -322,7 +323,7 @@ class TransactionProfiler implements LoggerAwareInterface { $this->logger->info( "Expectation ($expect <= $n) by $by not met$actual:\n$query\n" . - wfBacktrace( true ) + ( new RuntimeException() )->getTraceAsString() ); } } -- 2.20.1