X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/ede9ef521fbe3b9fc3ee95c410edd906f8e64284..b5859f1f2baf8dc945cbeac0622f8f1039702171:/src/phorkie/Repositories.php diff --git a/src/phorkie/Repositories.php b/src/phorkie/Repositories.php index 7ed3188..c605996 100644 --- a/src/phorkie/Repositories.php +++ b/src/phorkie/Repositories.php @@ -16,14 +16,16 @@ 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); - $n = end($dirs) + mt_rand(65536, 16777216); + + if ($GLOBALS['phorkie']['cfg']['randomIds']) { + $n = end($dirs) + mt_rand(65536, 16777216); + } else { + $n = end($dirs) + 1; + } chdir($this->workDir); $dir = $this->workDir . '/' . $n . '/';