From: Alan Knowles Date: Fri, 26 Feb 2021 04:09:13 +0000 (+0800) Subject: Fix #6614 - regen of template not occuring X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=commitdiff_plain;h=c6e311a038a01c59a92b5e3400fc8c9061569fd5 Fix #6614 - regen of template not occuring --- diff --git a/DataObjects/Core_templatestr.php b/DataObjects/Core_templatestr.php index 88a9785a..00ebbb03 100644 --- a/DataObjects/Core_templatestr.php +++ b/DataObjects/Core_templatestr.php @@ -604,9 +604,21 @@ class Pman_Core_DataObjects_Core_templatestr extends DB_DataObject } - // determine if a complied template need recompling function translateChanged($flexy) + { + + $date = $this->lastUpdated($flexy); + if ($date === false) { + return false; + } + $utime = file_exists($flexy->compiledTemplate) ? filemtime( $flexy->compiledTemplate) : 0; + return strtotime($date) > $utime; + } + + // determine if a complied template need recompling + + function lastUpdated($flexy) { //return true; // var_dump('check changed?'); @@ -616,12 +628,14 @@ class Pman_Core_DataObjects_Core_templatestr extends DB_DataObject //var_dump($flexy->compiledTemplate); $utime = file_exists($flexy->compiledTemplate) ? filemtime( $flexy->compiledTemplate) : 0; - + static $cache = array(); // cache of templates.. $ff = HTML_FlexyFramework::get(); $view_name = isset($ff->Pman_Core['view_name']) ? $ff->Pman_Core['view_name'] : false; + // find which of the template directories was actually used for the template. + $tempdir = ''; foreach($flexy->options['templateDir'] as $td) { if (substr($flexy->currentTemplate, 0, strlen($td)) == $td) { @@ -633,6 +647,7 @@ class Pman_Core_DataObjects_Core_templatestr extends DB_DataObject $tmpname = substr($flexy->currentTemplate, strlen($td) +1); + // we do not have any record of this template.. if (isset($cache[$tmpname]) && $cache[$tmpname] === false) { return false; } @@ -666,9 +681,14 @@ class Pman_Core_DataObjects_Core_templatestr extends DB_DataObject $x->lang = $flexy->options['locale']; $x->active = 1; $x->template_id = $tmpl->id; - $x->whereAdd("updated > '". date('Y-m-d H:i:s', $utime)."'"); - - return $x->count() ? true : false; + //$x->whereAdd("updated > '". date('Y-m-d H:i:s', $utime)."'"); + if ($x->count() < 1) { + return false; // we don't have any record of it. + } + $x->selectAdd(); + $x->selectAdd('max(updated) as max_updated'); + $x->find(true); + return $x->max_updated; } diff --git a/UpdateDatabase/MysqlLinks.php b/UpdateDatabase/MysqlLinks.php index 83b96348..0bdd5084 100644 --- a/UpdateDatabase/MysqlLinks.php +++ b/UpdateDatabase/MysqlLinks.php @@ -167,7 +167,7 @@ class Pman_Core_UpdateDatabase_MysqlLinks { } $q = DB_DAtaObject::factory('core_enum'); - $q->query("ALTER TABLE $tbl COMMENT = '{$q->escape($fkstr)}'"); + $q->query("ALTER TABLE `$tbl` COMMENT = '{$q->escape($fkstr)}'");