fix(crm): resolve PathManager root for MoneyFlix standalone clone

findRootPath() fell back to /opt/bitreport when composer.json lives
under crm/ with Modules/, breaking auth layout resolution and /login 500.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
XikaandCursor committed 2026-06-10 17:54:57 +00:00
1 parent 293b764799
commit a5e2e0623b
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);
}
/**