Added utility to nuke the templating cache directory.
This commit is contained in:
parent
155b301405
commit
9d70505ad8
2 changed files with 18 additions and 1 deletions
|
@ -11,7 +11,7 @@ class TemplatingContext {
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
Dependencies $deps,
|
Dependencies $deps,
|
||||||
string $cachePath,
|
public private(set) string $cachePath,
|
||||||
) {
|
) {
|
||||||
$this->env = new TplEnvironment(
|
$this->env = new TplEnvironment(
|
||||||
Misuzu::PATH_TEMPLATES,
|
Misuzu::PATH_TEMPLATES,
|
||||||
|
|
17
tools/nuke-tpl-cache
Executable file
17
tools/nuke-tpl-cache
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
namespace Misuzu;
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../misuzu.php';
|
||||||
|
|
||||||
|
$path = $msz->tplCtx->cachePath;
|
||||||
|
if(empty($path))
|
||||||
|
die(sprintf('No cache path is specified.%s', PHP_EOL));
|
||||||
|
|
||||||
|
if(!is_dir($path))
|
||||||
|
die(sprintf('Cache directory does not exist.%s', PHP_EOL));
|
||||||
|
|
||||||
|
if(fileowner($path) !== posix_getuid())
|
||||||
|
die(sprintf('Script must be run as the owner of the cache directory.%s', PHP_EOL));
|
||||||
|
|
||||||
|
echo `rm -rv {$path}`;
|
Loading…
Add table
Add a link
Reference in a new issue