From cdf3d4202673f93552080b1e369c1eb986da8ef5 Mon Sep 17 00:00:00 2001 From: leon Date: Wed, 26 Jul 2023 11:29:22 +0800 Subject: [PATCH] DataObjects/Core_template.php --- DataObjects/Core_template.php | 42 +++++++++-------------------------- 1 file changed, 11 insertions(+), 31 deletions(-) diff --git a/DataObjects/Core_template.php b/DataObjects/Core_template.php index 8a2a0cc9..f6a2b961 100644 --- a/DataObjects/Core_template.php +++ b/DataObjects/Core_template.php @@ -519,40 +519,20 @@ class Pman_Core_DataObjects_Core_template extends DB_DataObject return; } + if ($tmpl->id) { + $tmpl->is_deleted = 0; + $tmpl->filetype = 'js'; + $tmpl->update($tmpl); + } else { + $tmpl->is_deleted = 0; + $tmpl->filetype = 'js'; + $tmpl->lang = 'en'; + $tmpl->insert(); + } + /* - $tmpl = DB_DataObject::Factory($this->tableName()); - $tmpl->view_name = $pgdata['base']; - $tmpl->currentTemplate = $pgdata['template_dir'] . '/'. $pgdata['template']; - - if ($tmpl->get('template', $pgdata['template'])) { - if (strtotime($tmpl->updated) >= filemtime( $tmpl->currentTemplate )) { - if ($tmpl->is_deleted != 0 || $tmpl->filetype != 'js') { - $oo = clone($tmpl); - $tmpl->is_deleted = 0; - $tmpl->filetype = 'js'; - $tmpl->update($oo); - } - return $tmpl; - } - } - $words = array(); - - $fc = file_get_contents( $tmpl->currentTemplate ); - - preg_match_all('/\._\("([^"]+)"\)/', $fc, $outd); - $words = $outd[1]; - - preg_match_all('/\._\(\'([^\']+)\'\)/', $fc, $outs); - - // ?? seriously adding two arrays? - $words = array_diff(array_merge($words, $outs[1]), array_intersect($words, $outs[1])); - $words = array_unique($words); - - if (empty($words)) { - return; - } if ($tmpl->id) { $tmpl->is_deleted = 0; $tmpl->filetype = 'js'; -- 2.39.2