change smarty cache and compile directory

This commit is contained in:
Manuel Raynaud
2013-06-21 10:37:08 +02:00
parent 686cb0bff1
commit eff5529e1b
2 changed files with 6 additions and 4 deletions

View File

@@ -51,6 +51,8 @@
<service id="thelia.parser" class="Thelia\Core\Template\Smarty\SmartyParser" scope="request">
<argument type="service" id="request" />
<argument type="service" id="event_dispatcher"/>
<argument >false</argument>
<argument >%kernel.environment%</argument>
</service>
<!-- Smarty parser plugins -->

View File

@@ -32,7 +32,7 @@ class SmartyParser extends Smarty implements ParserInterface {
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher
* @param bool $template
*/
public function __construct(Request $request, EventDispatcherInterface $dispatcher, $template = false)
public function __construct(Request $request, EventDispatcherInterface $dispatcher, $template = false, $env = "prod")
{
parent::__construct();
@@ -41,13 +41,13 @@ class SmartyParser extends Smarty implements ParserInterface {
// Configure basic Smarty parameters
$compile_dir = THELIA_ROOT . 'cache/smarty/compile';
$compile_dir = THELIA_ROOT . 'cache/'. $env .'/smarty/compile';
if (! is_dir($compile_dir)) @mkdir($compile_dir, 0777, true);
$cache_dir = THELIA_ROOT . 'cache/smarty/cache';
$cache_dir = THELIA_ROOT . 'cache/'. $env .'/smarty/cache';
if (! is_dir($cache_dir)) @mkdir($cache_dir, 0777, true);
$this->setTemplate($template != false ? $template : 'smarty-sample');
$this->setTemplate($template ?: 'smarty-sample');
$this->setCompileDir($compile_dir);
$this->setCacheDir($cache_dir);