if (Profiling::IsProfilingEnabled() && !isset($this->usage[$name]))
$this->usage[$name] = 0;
+ $tpl_path = $this->_TemplatePath($name);
+ if (!file_exists($tpl_path))
+ throw new TemplateException("Template $name does not exist at path $tpl_path");
+
// First check the memory cache.
if (isset($this->cache[$name]))
return clone $this->cache[$name];
// Then check if the cache backend has it.
- $template = $this->_QueryCache($name);
+ $template = $this->_QueryCache($name, $tpl_path);
if ($template) {
$this->cache[$name] = $template;
return clone $template;
Queries the optional CacheBackend for a template.
@param string Template name
+ @param string Template path
@return Template|NULL
*/
- protected function _QueryCache($name)
+ protected function _QueryCache($name, $tpl_path)
{
if (!$this->cache_backend)
return NULL;
- $tpl_path = $this->_TemplatePath($name);
$data = $this->cache_backend->GetTemplateDataForName($name, filemtime($tpl_path));
if (!$data)
return NULL;