From da32666df92ab9b08fa55c70a30db5513ebe2e04 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 19 Oct 2016 16:44:04 +0200 Subject: [PATCH] only check vfs for templates, if /etemplates is mounted --- api/src/Etemplate/Widget/Template.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/api/src/Etemplate/Widget/Template.php b/api/src/Etemplate/Widget/Template.php index f4dc7503c0..718449475c 100644 --- a/api/src/Etemplate/Widget/Template.php +++ b/api/src/Etemplate/Widget/Template.php @@ -143,6 +143,7 @@ class Template extends Etemplate\Widget */ public static function relPath($name, $template_set=null, $version='') { + static $prefixes = null; unset($version); // not used currently list($app, $rest) = explode('.', $name, 2); @@ -153,7 +154,17 @@ class Template extends Etemplate\Widget $template_path = '/'.$app.'/templates/'.$template_set.'/'.$rest.'.xet'; $default_path = '/'.$app.'/templates/default/'.$rest.'.xet'; - foreach(array(Api\Vfs::PREFIX.self::VFS_TEMPLATE_PATH, EGW_SERVER_ROOT) as $prefix) + // check if /etemplates is mounted in VFS and prefer it in that case over phy. file-system + if (!isset($prefixes)) + { + $prefixes = array(EGW_SERVER_ROOT); + $fs_tab = Api\Vfs::mount(); + if (isset($fs_tab[self::VFS_TEMPLATE_PATH])) + { + array_unshift($prefixes, Api\Vfs::PREFIX.self::VFS_TEMPLATE_PATH); + } + } + foreach($prefixes as $prefix) { if (file_exists($prefix.$template_path)) {