浏览代码

Core\View: Add delete() method

Probably needed for a plugin system.
Visman 1 年之前
父节点
当前提交
e096fa6965
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      app/Core/View.php

+ 10 - 0
app/Core/View.php

@@ -215,6 +215,16 @@ class View
         return $php;
     }
 
+    /**
+     * Удаляет файлы кэша для шаблона $name
+     */
+    public function delete(string $name): void
+    {
+        $st = \preg_replace('%\W%', '-', $name);
+
+        \array_map('\\unlink', \glob("{$this->cacheDir}/_{$st}-*.php"));
+    }
+
     /**
      * Генерирует $php файл на основе шаблона $tpl
      */