From f7fdbc679e058993384f01f5fbb7da0c191061c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20DUBUC?= Date: Tue, 23 Aug 2016 11:05:57 +0200 Subject: [PATCH] =?UTF-8?q?Supprime=20le=20dossier=20cache=20du=20d=C3=A9p?= =?UTF-8?q?=C3=B4t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + application/Bootstrap.php | 25 ++++++++++++++++--------- cache/.gitignore | 4 ---- 3 files changed, 17 insertions(+), 13 deletions(-) delete mode 100644 cache/.gitignore diff --git a/.gitignore b/.gitignore index 7387222d..c905a8dd 100755 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ vendor /nbproject *.phar composer.lock +cache diff --git a/application/Bootstrap.php b/application/Bootstrap.php index 3c03443d..9c6eb893 100755 --- a/application/Bootstrap.php +++ b/application/Bootstrap.php @@ -23,7 +23,7 @@ public function run() return parent::run(); } - + /** * Initialisation de l'auto-loader */ @@ -32,14 +32,14 @@ protected function _initAutoLoader() $autoloader = Zend_Loader_Autoloader::getInstance(); $autoloader_application = new Zend_Application_Module_Autoloader(array('basePath' => APPLICATION_PATH, 'namespace' => null)); - + $autoloader_application->addResourceType('cache', 'cache/', 'Cache'); - + $autoloader->pushAutoloader($autoloader_application); return $autoloader; } - + /** * Initialisation d'un cache standard * @param array $frontendOptions surcharge des options de configuration du front @@ -47,14 +47,21 @@ protected function _initAutoLoader() * @return Cache une instance de cache */ protected function getCache(array $frontendOptions = array(), array $backendOptions = array()) { - + $options = $this->getOption('cache'); - + + if(!empty($options) && $options['enabled'] && $options['adapter'] == 'File') { + $file = $options['cache_dir']; + if(!file_exists($file)) { + mkdir($file); + } + } + return Zend_Cache::factory( // front adapter 'Core', // back adapter - $options['adapter'], + $options['adapter'], // frontend options array_merge(array( 'caching' => $options['enabled'], @@ -66,7 +73,7 @@ protected function getCache(array $frontendOptions = array(), array $backendOpti array_merge(array( 'servers' => array( array( - 'host' => $options['host'], + 'host' => $options['host'], 'port' => $options['port'], ), ), @@ -100,7 +107,7 @@ protected function _initCacheSearch() return $this->getCache(); } - + /** * Initialisation de la vue diff --git a/cache/.gitignore b/cache/.gitignore deleted file mode 100644 index 86d0cb27..00000000 --- a/cache/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Ignore everything in this directory -* -# Except this file -!.gitignore \ No newline at end of file