1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-04 16:10:08 +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:
Andrew Welch
2018-02-01 13:12:03 -05:00
parent e5f9914f05
commit cc0e4922f6

View File

@@ -23,6 +23,14 @@ public function serves($sitePath, $siteName, $uri)
*/
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';
}