Skip to content

Commit 64112be

Browse files
committed
fix(HTMLPurifier): set cache folder in folder cache/HTMLPurifier
1 parent 954b831 commit 64112be

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

includes/services/HtmlPurifierService.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313

1414
class HtmlPurifierService
1515
{
16+
public const HTMLPURIFIER_CACHE_FODLER = "cache/HTMLpurifier";
17+
1618
protected $params;
1719
protected $wiki;
1820
private $purifier;
@@ -47,6 +49,13 @@ public function cleanHTML(string $dirty_html): string
4749
'_top',
4850
]);
4951

52+
// set the cache folder
53+
// doc : http://htmlpurifier.org/live/configdoc/plain.html#Cache.SerializerPath
54+
if (!is_dir(self::HTMLPURIFIER_CACHE_FODLER)) {
55+
mkdir(self::HTMLPURIFIER_CACHE_FODLER, 0777, true);
56+
}
57+
$config->set('Cache.SerializerPath', realpath(self::HTMLPURIFIER_CACHE_FODLER));
58+
5059
$this->purifier = new HTMLPurifier($config);
5160
}
5261

0 commit comments

Comments
 (0)