本文整理汇总了PHP中Zend_Db_Profiler::setEnabled方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Db_Profiler::setEnabled方法的具体用法?PHP Zend_Db_Profiler::setEnabled怎么用?PHP Zend_Db_Profiler::setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Db_Profiler
的用法示例。
在下文中一共展示了Zend_Db_Profiler::setEnabled方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initProfiler
protected function _initProfiler()
{
$this->bootstrap('db');
$profiler = new Zend_Db_Profiler('All DB Queries');
$profiler->setEnabled(true);
$this->getResource('db')->setProfiler($profiler);
}
示例2: setEnabled
/**
* 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;
}
示例3: __construct
/**
* Empty constructor to make it parameterless.
*/
public function __construct()
{
$profiler = new Zend_Db_Profiler();
$profiler->setEnabled(true);
$this->setProfiler($profiler);
}
示例4: setEnabled
/**
* 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;
}
示例5: _initDbProfiler
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'));
}
}
}
示例6: initDbProfiler
/**
* @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;
}
示例7: setEnabled
public function setEnabled($enable)
{
$this->_message = new Zend_Log_Writer_Stream($this->_stream);
$this->_logger = new Zend_Log($this->_message);
parent::setEnabled($enable);
}
示例8: profiler
/**
* 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;
}