diff --git a/src/opnsense/mvc/app/config/services.php b/src/opnsense/mvc/app/config/services.php index fa36a6d7c..8dd6dd57b 100644 --- a/src/opnsense/mvc/app/config/services.php +++ b/src/opnsense/mvc/app/config/services.php @@ -52,7 +52,7 @@ $di->set('view', function () use ($config) { )); // register additional volt template functions $volt->getCompiler()->addFunction('theme_file_or_default', 'view_fetch_themed_filename'); - $volt->getCompiler()->addFunction('file_exists', 'file_exists'); + $volt->getCompiler()->addFunction('file_exists', 'view_file_exists'); return $volt; }, diff --git a/src/opnsense/www/index.php b/src/opnsense/www/index.php index eac29f57e..8fe865126 100644 --- a/src/opnsense/www/index.php +++ b/src/opnsense/www/index.php @@ -23,6 +23,16 @@ function view_fetch_themed_filename($url, $theme) return $url; // not found, return source } +/** + * check if file exists, wrapper around file_exists() so services.php can define other implementation for local testing + * @param string $filename to check + * @return boolean + */ +function view_file_exists($filename) +{ + return file_exists($filename); +} + try { /** * Read the configuration