Disable twig cache for developers (instead of having config flag)

This commit is contained in:
Eric
2020-07-16 15:07:03 +02:00
parent 11ef705816
commit e4ab543aff

View File

@@ -7,7 +7,6 @@
namespace Combodo\iTop\Application\TwigBase\Twig;
use IssueLog;
use MetaModel;
use Twig\Environment;
use Twig_Environment;
use Twig_Error;
@@ -23,8 +22,9 @@ class TwigHelper
$oLoader = new Twig_Loader_Filesystem($sViewPath);
$oTwig = new Twig_Environment($oLoader);
Extension::RegisterTwigExtensions($oTwig);
if (MetaModel::GetConfig()->Get('apc_cache.enabled'))
if (!utils::IsDevelopmentEnvironment())
{
// Disable the cache in development environment
$sLocalPath = utils::LocalPath($sViewPath);
$sLocalPath = str_replace('env-'.utils::GetCurrentEnvironment(), 'twig', $sLocalPath);
$sCachePath = utils::GetCachePath().$sLocalPath;