PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 5.8.2
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v5.8.2
5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / libs / Zend / Db / Profiler / Firebug.php
matomo / app / libs / Zend / Db / Profiler Last commit date
Exception.php 2 years ago Firebug.php 2 years ago Query.php 2 years ago
Firebug.php
134 lines
1 <?php
2
3 namespace {
4 /**
5 * Zend Framework
6 *
7 * LICENSE
8 *
9 * This source file is subject to the new BSD license that is bundled
10 * with this package in the file LICENSE.txt.
11 * It is also available through the world-wide-web at this URL:
12 * http://framework.zend.com/license/new-bsd
13 * If you did not receive a copy of the license and are unable to
14 * obtain it through the world-wide-web, please send an email
15 * to license@zend.com so we can send you a copy immediately.
16 *
17 * @category Zend
18 * @package Zend_Db
19 * @subpackage Profiler
20 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
21 * @license http://framework.zend.com/license/new-bsd New BSD License
22 * @version $Id: Firebug.php 23775 2011-03-01 17:25:24Z ralph $
23 */
24 /** Zend_Db_Profiler */
25 // require_once 'Zend/Db/Profiler.php';
26 /** Zend_Wildfire_Plugin_FirePhp */
27 // require_once 'Zend/Wildfire/Plugin/FirePhp.php';
28 /** Zend_Wildfire_Plugin_FirePhp_TableMessage */
29 // require_once 'Zend/Wildfire/Plugin/FirePhp/TableMessage.php';
30 /**
31 * Writes DB events as log messages to the Firebug Console via FirePHP.
32 *
33 * @category Zend
34 * @package Zend_Db
35 * @subpackage Profiler
36 * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
37 * @license http://framework.zend.com/license/new-bsd New BSD License
38 */
39 class Zend_Db_Profiler_Firebug extends \Zend_Db_Profiler
40 {
41 /**
42 * The original label for this profiler.
43 * @var string
44 */
45 protected $_label = null;
46 /**
47 * The label template for this profiler
48 * @var string
49 */
50 protected $_label_template = '%label% (%totalCount% @ %totalDuration% sec)';
51 /**
52 * The message envelope holding the profiling summary
53 * @var Zend_Wildfire_Plugin_FirePhp_TableMessage
54 */
55 protected $_message = null;
56 /**
57 * The total time taken for all profiled queries.
58 * @var float
59 */
60 protected $_totalElapsedTime = 0;
61 /**
62 * Constructor
63 *
64 * @param string $label OPTIONAL Label for the profiling info.
65 * @return void
66 */
67 public function __construct($label = null)
68 {
69 $this->_label = $label;
70 if (!$this->_label) {
71 $this->_label = 'Zend_Db_Profiler_Firebug';
72 }
73 }
74 /**
75 * Enable or disable the profiler. If $enable is false, the profiler
76 * is disabled and will not log any queries sent to it.
77 *
78 * @param boolean $enable
79 * @return Zend_Db_Profiler Provides a fluent interface
80 */
81 public function setEnabled($enable)
82 {
83 parent::setEnabled($enable);
84 if ($this->getEnabled()) {
85 if (!$this->_message) {
86 $this->_message = new \Zend_Wildfire_Plugin_FirePhp_TableMessage($this->_label);
87 $this->_message->setBuffered(\true);
88 $this->_message->setHeader(array('Time', 'Event', 'Parameters'));
89 $this->_message->setDestroy(\true);
90 $this->_message->setOption('includeLineNumbers', \false);
91 \Zend_Wildfire_Plugin_FirePhp::getInstance()->send($this->_message);
92 }
93 } else {
94 if ($this->_message) {
95 $this->_message->setDestroy(\true);
96 $this->_message = null;
97 }
98 }
99 return $this;
100 }
101 /**
102 * Intercept the query end and log the profiling data.
103 *
104 * @param integer $queryId
105 * @throws Zend_Db_Profiler_Exception
106 * @return void
107 */
108 public function queryEnd($queryId)
109 {
110 $state = parent::queryEnd($queryId);
111 if (!$this->getEnabled() || $state == self::IGNORED) {
112 return;
113 }
114 $this->_message->setDestroy(\false);
115 $profile = $this->getQueryProfile($queryId);
116 $this->_totalElapsedTime += $profile->getElapsedSecs();
117 $this->_message->addRow(array((string) \round($profile->getElapsedSecs(), 5), $profile->getQuery(), ($params = $profile->getQueryParams()) ? $params : null));
118 $this->updateMessageLabel();
119 }
120 /**
121 * Update the label of the message holding the profile info.
122 *
123 * @return void
124 */
125 protected function updateMessageLabel()
126 {
127 if (!$this->_message) {
128 return;
129 }
130 $this->_message->setLabel(\str_replace(array('%label%', '%totalCount%', '%totalDuration%'), array($this->_label, $this->getTotalNumQueries(), (string) \round($this->_totalElapsedTime, 5)), $this->_label_template));
131 }
132 }
133 }
134