create-prisma-php-app 1.17.15 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bootstrap.php
CHANGED
|
@@ -93,12 +93,45 @@ function determineContentToInclude()
|
|
|
93
93
|
$layoutsToInclude[] = $baseDir . '/layout.php';
|
|
94
94
|
}
|
|
95
95
|
} else {
|
|
96
|
-
$includePath = $baseDir .
|
|
96
|
+
$includePath = $baseDir . getFilePrecedence();
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
return ['path' => $includePath, 'layouts' => $layoutsToInclude, 'uri' => $uri];
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
function getFilePrecedence()
|
|
103
|
+
{
|
|
104
|
+
global $_filesListRoutes;
|
|
105
|
+
|
|
106
|
+
// Normalize the file paths for consistent comparison
|
|
107
|
+
$_filesListRoutes = array_map(function ($route) {
|
|
108
|
+
return str_replace('\\', '/', $route);
|
|
109
|
+
}, $_filesListRoutes);
|
|
110
|
+
|
|
111
|
+
// Look for route.php in the /src/app/ directory
|
|
112
|
+
$routeFile = array_filter($_filesListRoutes, function ($route) {
|
|
113
|
+
return preg_match('/^\.\/src\/app\/route\.php$/', $route);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
// If route.php is found, return just the file name
|
|
117
|
+
if (!empty($routeFile)) {
|
|
118
|
+
return '/route.php';
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// If route.php is not found, look for index.php in the /src/app/ directory
|
|
122
|
+
$indexFile = array_filter($_filesListRoutes, function ($route) {
|
|
123
|
+
return preg_match('/^\.\/src\/app\/index\.php$/', $route);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
// If index.php is found, return just the file name
|
|
127
|
+
if (!empty($indexFile)) {
|
|
128
|
+
return '/index.php';
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// If neither file is found, return null or handle the case as needed
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
|
|
102
135
|
function uriExtractor(string $scriptUrl): string
|
|
103
136
|
{
|
|
104
137
|
$prismaPHPSettings = json_decode(file_get_contents("prisma-php.json"), true);
|
|
@@ -431,6 +464,8 @@ function wireCallback()
|
|
|
431
464
|
'data' => $data
|
|
432
465
|
];
|
|
433
466
|
|
|
467
|
+
$callbackResponse = null;
|
|
468
|
+
|
|
434
469
|
// Validate and call the dynamic function
|
|
435
470
|
if (isset($data['callback'])) {
|
|
436
471
|
// Sanitize and create a dynamic function name
|