Forráskód Böngészése

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
Mafoo 8 éve
szülő
commit
188b2240ce
2 módosított fájl, 4 hozzáadás és 0 törlés
  1. 2 0
      resources/classes/domains.php
  2. 2 0
      resources/classes/menu.php

+ 2 - 0
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++;
 				}

+ 2 - 0
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";