1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-05 00:20:08 +01:00

Flatten structure

This commit is contained in:
Stidges
2021-06-14 21:20:11 +02:00
parent 6cec35d205
commit 6fa23d9f48

View File

@@ -128,14 +128,22 @@ function valet_default_site_path($config)
function get_valet_site_path($valetConfig, $siteName, $domain) function get_valet_site_path($valetConfig, $siteName, $domain)
{ {
$valetSitePath = null; $valetSitePath = null;
foreach ($valetConfig['paths'] as $path) { foreach ($valetConfig['paths'] as $path) {
if ($handle = opendir($path)) { $handle = opendir($path);
if ($handle === false) {
continue;
}
$dirs = []; $dirs = [];
while (false !== ($file = readdir($handle))) { while (false !== ($file = readdir($handle))) {
if (! is_dir($path.'/'.$file)) continue; if (is_dir($path.'/'.$file) && ! in_array($file, ['.', '..', '.DS_Store'])) {
if (in_array($file, ['.', '..', '.DS_Store'])) continue;
$dirs[] = $file; $dirs[] = $file;
} }
}
closedir($handle); closedir($handle);
// Note: strtolower used below because Nginx only tells us lowercase names // Note: strtolower used below because Nginx only tells us lowercase names
@@ -156,7 +164,6 @@ function get_valet_site_path($valetConfig, $siteName, $domain)
} }
} }
} }
}
$domain = array_slice(explode('.', $siteName), -1)[0]; $domain = array_slice(explode('.', $siteName), -1)[0];
$valetSitePath = get_valet_site_path($valetConfig, $siteName, $domain); $valetSitePath = get_valet_site_path($valetConfig, $siteName, $domain);