From: Christian Weiske Date: Wed, 22 Mar 2023 19:22:01 +0000 (+0100) Subject: Fix stripping ".git" from dir names X-Git-Url: https://git.cweiske.de/phorkie.git/commitdiff_plain/894b39fb81760fb6fbff105159da993b512f8ce3 Fix stripping ".git" from dir names This did never work, but earlier PHP versions did not complain --- diff --git a/src/phorkie/Repositories.php b/src/phorkie/Repositories.php index 9021a2e..c605996 100644 --- a/src/phorkie/Repositories.php +++ b/src/phorkie/Repositories.php @@ -16,13 +16,11 @@ class Repositories { chdir($this->gitDir); $dirs = glob('*.git', GLOB_ONLYDIR); - array_walk( - $dirs, - function ($dir) { - return substr($dir, 0, -4); - } - ); + foreach ($dirs as $key => $dir) { + $dirs[$key] = substr($dir, 0, -4); + } sort($dirs, SORT_NUMERIC); + if ($GLOBALS['phorkie']['cfg']['randomIds']) { $n = end($dirs) + mt_rand(65536, 16777216); } else {