Add hooks for changing Twig cache path and disabling cache (for WP Engine) [MAILPOET-3157]

This commit is contained in:
wxa
2020-09-22 09:24:11 +03:00
committed by Veljko V
parent 9424049e76
commit fc31567b39
2 changed files with 4 additions and 2 deletions

View File

@@ -54,7 +54,7 @@ class Env {
self::$utilPath = self::$path . '/lib/Util'; self::$utilPath = self::$path . '/lib/Util';
$wpUploadDir = WPFunctions::get()->wpUploadDir(); $wpUploadDir = WPFunctions::get()->wpUploadDir();
self::$tempPath = $wpUploadDir['basedir'] . '/' . self::$pluginName; self::$tempPath = $wpUploadDir['basedir'] . '/' . self::$pluginName;
self::$cachePath = self::$tempPath . '/cache'; self::$cachePath = WPFunctions::get()->applyFilters('mailpoet_template_cache_path', self::$tempPath . '/cache');
self::$tempUrl = $wpUploadDir['baseurl'] . '/' . self::$pluginName; self::$tempUrl = $wpUploadDir['baseurl'] . '/' . self::$pluginName;
self::$languagesPath = self::$path . '/lang'; self::$languagesPath = self::$path . '/lang';
self::$libPath = self::$path . '/lib'; self::$libPath = self::$path . '/lib';

View File

@@ -2,6 +2,8 @@
namespace MailPoet\Config; namespace MailPoet\Config;
use MailPoet\WP\Functions as WPFunctions;
class RendererFactory { class RendererFactory {
/** @var Renderer|null */ /** @var Renderer|null */
@@ -9,7 +11,7 @@ class RendererFactory {
public function getRenderer() { public function getRenderer() {
if (!$this->renderer) { if (!$this->renderer) {
$caching = !WP_DEBUG; $caching = WPFunctions::get()->applyFilters('mailpoet_template_cache_enabled', !WP_DEBUG);
$debugging = WP_DEBUG; $debugging = WP_DEBUG;
$this->renderer = new Renderer($caching, $debugging); $this->renderer = new Renderer($caching, $debugging);
} }