mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
Add prefix compile ID for template file name
This commit is contained in:
parent
6331ad44a4
commit
05e35261e4
@ -115,6 +115,11 @@ class Fenom
|
|||||||
*/
|
*/
|
||||||
protected $_compile_dir = "/tmp";
|
protected $_compile_dir = "/tmp";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string compile prefix ID template
|
||||||
|
*/
|
||||||
|
protected $_compile_id = "default";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string[] compile directory for custom provider
|
* @var string[] compile directory for custom provider
|
||||||
*/
|
*/
|
||||||
@ -428,6 +433,18 @@ class Fenom
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set compile prefix ID template
|
||||||
|
*
|
||||||
|
* @param string $id prefix ID to store compiled templates
|
||||||
|
* @return Fenom
|
||||||
|
*/
|
||||||
|
public function setCompileId($id)
|
||||||
|
{
|
||||||
|
$this->_compile_id = $id;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param callable $cb
|
* @param callable $cb
|
||||||
@ -1020,10 +1037,10 @@ class Fenom
|
|||||||
foreach ($tpl as &$t) {
|
foreach ($tpl as &$t) {
|
||||||
$t = str_replace(":", "_", basename($t));
|
$t = str_replace(":", "_", basename($t));
|
||||||
}
|
}
|
||||||
return implode("~", $tpl) . "." . sprintf("%x.%x.php", crc32($hash), strlen($hash));
|
return $this->_compile_id . '_' . implode("~", $tpl) . "." . sprintf("%x.%x.php", crc32($hash), strlen($hash));
|
||||||
} else {
|
} else {
|
||||||
$hash = $tpl . ":" . $options;
|
$hash = $tpl . ":" . $options;
|
||||||
return sprintf("%s.%x.%x.php", str_replace(":", "_", basename($tpl)), crc32($hash), strlen($hash));
|
return sprintf($this->_compile_id . "_%s.%x.%x.php", str_replace(":", "_", basename($tpl)), crc32($hash), strlen($hash));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user