Try to detect APC, and add a cache for the translation

This commit is contained in:
Michael RICOIS 2013-05-31 15:34:29 +00:00
parent faaa693b70
commit 71d0e63af7
3 changed files with 26 additions and 7 deletions

View File

@ -110,13 +110,12 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
protected function _initCache()
{
//MetadataCache pour la base de données
$frontendOptions = array(
'lifetime' => 28800,
'automatic_serialization' => true
);
$backendOptions = array();
$cache = Zend_Cache::factory('Core','Apc', $frontendOptions, $backendOptions);
$cache = Zend_Cache::factory(
'Core',
'Apc',
array('lifetime' => 28800,'automatic_serialization' => true),
array()
);
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
}

View File

@ -26,6 +26,14 @@ class Application_Controller_Plugin_Lang extends Zend_Controller_Plugin_Abstract
$locale = new Zend_Locale('fr');
}
$cache = Zend_Cache::factory(
'Core',
'Apc',
array('lifetime' => 28800,'automatic_serialization' => true),
array()
);
Zend_Translate::setCache($cache);
$translate = new Zend_Translate(
array(
'adapter' => 'gettext',

View File

@ -7,6 +7,18 @@ defined('APPLICATION_PATH')
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Check APC parameters
if (ini_get('apc.enabled')!=1) {
switch ( APPLICATION_ENV ) {
case 'production':
echo "Erreur technique.";
break;
default:
echo "APC is not enabled !";
break;
}
}
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),