Firebug database profiler

This commit is contained in:
Michael RICOIS 2012-07-30 07:48:19 +00:00
parent c2bd5bd412
commit a1ba1ac947

View File

@ -1,5 +1,4 @@
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initViewSettings()
@ -36,9 +35,11 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
protected function _initLogging()
{
//Logger de développement
//Firebug
$writer = new Zend_Log_Writer_Firebug();
if(APPLICATION_ENV=='production') $writer->setEnabled(false);
if(APPLICATION_ENV=='production') {
$writer->setEnabled(false);
}
$logger = new Zend_Log($writer);
Zend_Registry::set('firebug', $logger);
}
@ -50,9 +51,27 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
$db = Zend_Db::factory($dbConfig->db);
Zend_Db_Table::setDefaultAdapter ($db);
} catch ( Exception $e ) {
exit ( $e->getMessage() );
if (APPLICATION_ENV == 'development') {
print_r($e);
} else {
echo "Le service rencontre actuellement un problème technique.";
}
exit;
}
/**
* Set the default adapter to use with all model
*/
Zend_Db_Table::setDefaultAdapter($db);
/**
* Set Firebug Database profiler
*/
if (APPLICATION_ENV == 'development') {
$profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
$profiler->setEnabled(true);
$db->setProfiler($profiler);
}
Zend_Registry::set('db', $db);
}