batch/application/Bootstrap.php

41 lines
1.0 KiB
PHP
Raw Normal View History

2013-06-19 09:45:13 +00:00
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initConfig()
{
$config = new Zend_Config($this->getOptions());
Zend_Registry::set('config', $config);
return $config;
}
protected function _initDb()
{
$c = Zend_Registry::get('config');
try {
$db = Zend_Db::factory($c->profil->db->metier);
} catch ( Exception $e ) {
echo "Database !\n";
exit;
}
/**
* Set the default adapter to use with all model
*/
Zend_Db_Table::setDefaultAdapter($db);
}
protected function _initCache()
{
2013-10-25 07:48:20 +00:00
if ( APPLICATION_ENV!='development' ) {
2013-06-19 09:45:13 +00:00
//MetadataCache pour la base de données
$frontendOptions = array(
'lifetime' => 14400,
'automatic_serialization' => true
);
$backendOptions = array();
$cache = Zend_Cache::factory('Core','Apc', $frontendOptions, $backendOptions);
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
2013-10-25 07:48:20 +00:00
}
2013-06-19 09:45:13 +00:00
}
}