diff options
Diffstat (limited to 'util/precompile_smarty3.php')
| -rwxr-xr-x | util/precompile_smarty3.php | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/util/precompile_smarty3.php b/util/precompile_smarty3.php index 10b2eadb6..ead62fecf 100755 --- a/util/precompile_smarty3.php +++ b/util/precompile_smarty3.php @@ -1,15 +1,19 @@ <?php - -/** -* @package util -*/ - -require_once('boot.php'); -require_once('vendor/smarty/smarty/libs/Smarty.class.php'); +/* Utility script to compile all smarty templates + * + * SPDX-FileCopyrightText: 2013, 2025 The Hubzilla Community + * SPDX-FileContributor: fabrixxm <fabrix.xm@gmail.com> + * SPDX-FileContributor: Mario <mario@mariovavti.com> + * SPDX-FileContributor: Harald Eilertsen <haraldei@anduin.net> + * + * SPDX-License-Identifier: MIT + */ + +require_once dirname(__DIR__) . '/boot.php'; $folders = array_merge(array('view/tpl/'), glob('view/theme/*/tpl/*', GLOB_ONLYDIR)); -$s = new Smarty(); +$s = new \Smarty\Smarty(); $s->setTemplateDir($folders); @@ -17,7 +21,16 @@ $s->setCompileDir(TEMPLATE_BUILD_PATH . '/compiled/'); $s->setConfigDir(TEMPLATE_BUILD_PATH . '/config/'); $s->setCacheDir(TEMPLATE_BUILD_PATH . '/cache/'); -$s->left_delimiter = '{{'; -$s->right_delimiter = '}}'; +$s->setLeftDelimiter('{{'); +$s->setRightDelimiter('}}'); +// Capture the output... +ob_start(); $s->compileAllTemplates('.tpl', true); +$buf = ob_get_flush(); + +// ...so that we can check if there was any errors +if (strpos($buf, '------>Error: ') !== false) { + // Signal to the shell if there was + exit(-1); +} |
