+
+ /**
+ * Returns a ScopedCallback which resets the silence flag in the transaction profiler when it is
+ * destroyed on the end of a scope, for example on return or throw
+ * @return ScopedCallback
+ * @since 1.32
+ */
+ protected function silenceTransactionProfiler() {
+ $trxProfiler = Profiler::instance()->getTransactionProfiler();
+ $oldSilenced = $trxProfiler->setSilenced( true );
+ return new ScopedCallback( function () use ( $trxProfiler, $oldSilenced ) {
+ $trxProfiler->setSilenced( $oldSilenced );
+ } );
+ }