X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FBasePath.php;h=f29c2e864ec414b7d1219344e4e14d6fd0b622f9;hb=c9cce8492e5b2607b2a092474d1de4d188b7a2c9;hp=a2849831eb55e8708b2d97fa77cd46b8d2a0cfc8;hpb=01b7a3976ff1a00700c429db43fcbdec7158abca;p=friendica.git diff --git a/src/Util/BasePath.php b/src/Util/BasePath.php index a2849831eb..f29c2e864e 100644 --- a/src/Util/BasePath.php +++ b/src/Util/BasePath.php @@ -17,17 +17,23 @@ class BasePath * * @throws \Exception if directory isn't usable */ - public static function create($basePath, $server = []) + public static function create($basePath, array $server = []) { - if (!$basePath && !empty($server['DOCUMENT_ROOT'])) { + if ((!$basePath || !is_dir($basePath)) && !empty($server['DOCUMENT_ROOT'])) { $basePath = $server['DOCUMENT_ROOT']; } - if (!$basePath && !empty($server['PWD'])) { + if ((!$basePath || !is_dir($basePath)) && !empty($server['PWD'])) { $basePath = $server['PWD']; } - return self::getRealPath($basePath); + $basePath = self::getRealPath($basePath); + + if (!is_dir($basePath)) { + throw new \Exception(sprintf('\'%s\' is not a valid basepath', $basePath)); + } + + return $basePath; } /**