Merge pull request 'fix(crm): resolve PathManager root for MoneyFlix standalone clone (BIT-24925)' (#1) from fix/bit-24925-crm-admin-pathmanager into master

Merge fix/bit-24925-crm-admin-pathmanager → master: fix PathManager root for MoneyFlix standalone clone (BIT-24925)
This commit was merged in pull request #1.
This commit is contained in:
spark committed 2026-06-10 18:56:46 +01:00
commit d7dc1e7f43
1 file changed
+21 -8
+21 -8
View File
@@ -54,20 +54,33 @@ class PathManager
*/
private static function findRootPath(): string
{
// Force root path to be the directory containing the app folder
// This fixes the issue where composer.json exists in both root and app directories
$currentPath = __DIR__;
// Go up directories until we find the directory that contains both composer.json and app folder
while ($currentPath !== '/' && $currentPath !== '') {
if (file_exists($currentPath . '/composer.json') && is_dir($currentPath . '/app')) {
if (!file_exists($currentPath . '/composer.json')) {
$currentPath = dirname($currentPath);
continue;
}
// Standard monorepo (CRM_Project): composer.json at repo root + app/
if (is_dir($currentPath . '/app')) {
return $currentPath;
}
// Standalone CRM clone (MoneyFlix): composer.json lives in crm/ with Modules/
if (is_dir($currentPath . '/Modules')) {
$parentPath = dirname($currentPath);
if ($parentPath !== $currentPath && is_dir($parentPath . '/storage')) {
return $parentPath;
}
return $currentPath;
}
$currentPath = dirname($currentPath);
}
// Fallback to current directory if composer.json not found
return dirname(__DIR__, 3);
return dirname(__DIR__, 2);
}
/**