[ Index ]

PHP Cross Reference of YOURLS

title

Body

[close]

/includes/Database/ -> Profiler.php (source)

   1  <?php
   2  
   3  /**
   4   * Custom profiler for YOURLS
   5   *
   6   * Based on \Aura\Sql\Profiler\Profiler to tweak function finish()
   7   *
   8   * @since 1.7.10
   9   */
  10  
  11  namespace YOURLS\Database;
  12  
  13  class Profiler extends \Aura\Sql\Profiler\Profiler {
  14      /**
  15       *
  16       * Finishes and logs a profile entry.
  17       *
  18       * We're just overriding the original class finish() to
  19       * - not throw an exception and collect a backtrace that will remain unused
  20       * - not flatten the array of 'values' into a string
  21       *
  22       * @param string $statement The statement being profiled, if any.
  23       * @param array $values The values bound to the statement, if any.
  24       * @return void
  25       */
  26      public function finish($statement = null, array $values = [])
  27      {
  28          if (! $this->active) {
  29              return;
  30          }
  31  
  32          $this->context['duration'] = microtime(true) - $this->context['start'];
  33          $this->context['statement'] = $statement;
  34          $this->context['values'] = (array)$values;
  35  
  36          $this->logger->log($this->logLevel, $this->logFormat, $this->context);
  37  
  38          $this->context = [];
  39      }
  40  }


Generated: Sat Nov 9 05:10:01 2024 Cross-referenced by PHPXref 0.7.1