From 32a6f76ed0a9f29ebd82daa73f55626db5ad241e Mon Sep 17 00:00:00 2001 From: Mafoo Date: Thu, 8 Jun 2017 16:41:56 +0100 Subject: [PATCH] Enhance [master] provide $app_path during upgrade (#2573) if a application is installed via a symlink PHP will resolve the symlink for __DIR__ and __FILE__ making it impossible for an application to work out it's relative path withing the fusion system. By providing $app_path during upgrade routines an application will beable to provide the correct link for menu items (e.g. /opt/languages/index.php) instead of having to hard code it where it could change depending on how the application was installed --- resources/classes/domains.php | 2 ++ resources/classes/menu.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/resources/classes/domains.php b/resources/classes/domains.php index 7b25757054..e66ae791d7 100644 --- a/resources/classes/domains.php +++ b/resources/classes/domains.php @@ -240,6 +240,8 @@ if (!class_exists('domains')) { $db = $this->db; $x=0; foreach ($config_list as &$config_path) { + $app_path = dirname($config_path); + $app_path = preg_replace('/\A.*(\/.*\/.*)\z/', '$1', $app_path); include($config_path); $x++; } diff --git a/resources/classes/menu.php b/resources/classes/menu.php index db9079fc63..9f57105470 100644 --- a/resources/classes/menu.php +++ b/resources/classes/menu.php @@ -70,6 +70,8 @@ if (!class_exists('menu')) { $config_list = glob($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/*/*/app_menu.php"); $x = 0; foreach ($config_list as &$config_path) { + $app_path = dirname($config_path); + $app_path = preg_replace('/\A.*(\/.*\/.*)\z/', '$1', $app_path); $y = 0; try { //echo "[".$x ."] ".$config_path."\n";