protected function _initProfiler() { $this->bootstrap('db'); $profiler = new Zend_Db_Profiler('All DB Queries'); $profiler->setEnabled(true); $this->getResource('db')->setProfiler($profiler); }
/** * Enable or disable the profiler. If $enable is false, the profiler * is disabled and will not log any queries sent to it. * * @param boolean $enable * @return Zend_Db_Profiler Provides a fluent interface */ public function setEnabled($enable) { parent::setEnabled($enable); if ($this->getEnabled()) { if (!$this->_message) { $this->_message = new Zend_Wildfire_Plugin_FirePhp_TableMessage($this->_label); $this->_message->setBuffered(true); $this->_message->setHeader(array('Time', 'Event', 'Parameters')); $this->_message->setDestroy(true); Zend_Wildfire_Plugin_FirePhp::getInstance()->send($this->_message); } } else { if ($this->_message) { $this->_message->setDestroy(true); $this->_message = null; } } return $this; }
/** * Empty constructor to make it parameterless. */ public function __construct() { $profiler = new Zend_Db_Profiler(); $profiler->setEnabled(true); $this->setProfiler($profiler); }
/** * Enable or disable the profiler. If $enable is false, the profiler * is disabled and will not log any queries sent to it. * * @param boolean $enable * @return \Zend_Db_Profiler Provides a fluent interface */ public function setEnabled($enable) { parent::setEnabled($enable); return $this; }
protected function _initDbProfiler() { if (APPLICATION_ENV === 'development') { if (isset($_GET['_profileSql'])) { setcookie('_profileSql', $_GET['_profileSql']); } if (isset($_COOKIE['_profileSql'])) { $profiler = new Zend_Db_Profiler(); $profiler->setEnabled(true); Zend_Db_Table_Abstract::getDefaultAdapter()->setProfiler($profiler); register_shutdown_function(array('Tools_System_Tools', 'sqlProfiler')); } } }
/** * @return null|\Zend_Db_Profiler|\Zend_Db_Profiler_Firebug */ protected static function initDbProfiler() { // No profile should be enabled on live environment if (Constants::ENV_LIVE == APPLICATION_ENV) { return null; } $profiler = null; $options = isset(self::$config['resources']['profiler']) ? self::$config['resources']['profiler'] : array(); $enabled = isset($options['enabled']) && $options['enabled'] == 1; if ($enabled) { if (isset($options['type']) && $options['type'] == 'firebug') { $profiler = new \Zend_Db_Profiler_Firebug('DB Queries'); } else { $profiler = new \Zend_Db_Profiler(); } $profiler->setEnabled(true); } return $profiler; }
public function setEnabled($enable) { $this->_message = new Zend_Log_Writer_Stream($this->_stream); $this->_logger = new Zend_Log($this->_message); parent::setEnabled($enable); }
/** * Get DB profiler * * @param string $connectionName * @return mixed|Zend_Db_Profiler */ function profiler($connectionName = 'core_read') { if (false == ($profiler = Mage::registry('profiler'))) { /** @var $resource Mage_Core_Model_Resource */ $resource = Mage::getSingleton('core/resource'); /** @var $db Varien_Db_Adapter_Pdo_Mysql */ $db = $resource->getConnection($connectionName); $profiler = new Zend_Db_Profiler(); $profiler->setEnabled(1); $db->setProfiler($profiler); Mage::register('profiler', $profiler); } return $profiler; }