Errors in cache?

A place to discuss the testing process in beta cycles or against SVN for the CMS Made Simple CORE package.
Locked
von-hamster
Power Poster
Power Poster
Posts: 339
Joined: Thu Nov 01, 2007 3:11 pm

Errors in cache?

Post by von-hamster »

I try to do next:


Code: Select all

if (!$this->IsFileTemplateCached($template, '', '', $name)) {
       // some prepare code
}
echo $this->ProcessTemplate($template, '', true, $name);


But it's not work.

In core code i found this:

/lib/classes/class.module.inc.php

Code: Select all

function ProcessTemplate($tpl_name, $designation = '', $cache = false, $cacheid = '')
   {
      $this->LoadTemplateMethods();
// ________________ Here cache is force off: $cache = false. I think, '= false' - is error _____________
      return cms_module_ProcessTemplate($this, $tpl_name, $designation, $cache = false, $cacheid);
   }


/lib/classes/module_support/modtemplates.inc.php

Code: Select all

function cms_module_IsFileTemplateCached(&$modinstance, $tpl_name, $designation = '', $timestamp = '', $cacheid = '')
{
   $ok = (strpos($tpl_name, '..') === false);
   if (!$ok) return;

   global $gCms;
   $smarty = &$gCms->GetSmarty();
   $oldcache = $smarty->caching;

// _______________ here force cache off ___________________
   $smarty->caching = false;

// _______________ and then check for cache - for what??? May be: $smarty->caching = true; ___________
   $result = $smarty->is_cached('module_file_tpl:'.$modinstance->GetName().';'.$tpl_name, $cacheid, ($designation != ''?$designation:$modinstance->GetName()));

   if ($result == true && $timestamp != '' && intval($smarty->_cache_info['timestamp']) < intval($timestamp))
   {
      $smarty->clear_cache('module_file_tpl:'.$modinstance->GetName().';'.$tpl_name, $cacheid, ($designation != ''?$designation:$modinstance->GetName()));
      $result = false;
   }

   $smarty->caching = $oldcache;
   return $result;
}

function cms_module_ProcessTemplate(&$modinstance, $tpl_name, $designation = '', $cache = false, $cacheid = '')
{
   $ok = (strpos($tpl_name, '..') === false);
   if (!$ok) return;

   global $gCms;
   $smarty = &$gCms->GetSmarty();

   $oldcache = $smarty->caching;

// _______________ And here may be: $smarty->caching = $cache; ?____________________
   $smarty->caching = false;

   $result = $smarty->fetch('module_file_tpl:'.$modinstance->GetName().';'.$tpl_name, $cacheid, ($designation != ''?$designation:$modinstance->GetName()));
   $smarty->caching = $oldcache;

   return $result;
}


PS... Sorry for my english  :)
alby

Re: Errors in cache?

Post by alby »

von-hamster wrote:I try to do next:


thank you
this must be checked, but remember that all modules (recent at least) using DB templates and not file

Alby
von-hamster
Power Poster
Power Poster
Posts: 339
Joined: Thu Nov 01, 2007 3:11 pm

Re: Errors in cache?

Post by von-hamster »

I use files, it's easier for me...
Locked

Return to “[locked] Quality Assurance”