mirror of
https://github.com/laravel/valet.git
synced 2026-02-05 08:30:07 +01:00
Smarter frontControllerDirectory method
The previous method simply returned `web` if there was a file named `craft` in the $sitePath (which means we’re running Craft 3). The problem is that many sites, especially upgraded ones, will be serving out of `public`. This is also in line with the default Forge/ServerPilot default dirs. So we test to see if either `/web` or `/public` exist, and return them if so. Otherwise default to the current method. Signed-off-by: Andrew Welch <andrew@nystudio107.com>
This commit is contained in:
@@ -23,6 +23,14 @@ public function serves($sitePath, $siteName, $uri)
|
|||||||
*/
|
*/
|
||||||
public function frontControllerDirectory($sitePath)
|
public function frontControllerDirectory($sitePath)
|
||||||
{
|
{
|
||||||
|
$dirs = ['web', 'public'];
|
||||||
|
|
||||||
|
foreach ($dirs as $dir) {
|
||||||
|
if (is_dir($sitePath.'/'.$dir)) {
|
||||||
|
return $dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Give up, and just return the default
|
||||||
return is_file($sitePath.'/craft') ? 'web' : 'public';
|
return is_file($sitePath.'/craft') ? 'web' : 'public';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user