forking works now
[phorkie.git] / src / Phorkie / Repositories.php
index 6582ae818050adf6ce15b08441eceab3cf28fcb9..3afe8c5b01c510e138ca2a0309f1fede06a8a3ab 100644 (file)
@@ -13,7 +13,12 @@ class Repositories
      */
     public function createNew()
     {
-        $n = basename(end(glob($this->reposDir . '/*', GLOB_ONLYDIR))) + 1;
+        chdir($this->reposDir);
+        $dirs = glob('*', GLOB_ONLYDIR);
+        sort($dirs, SORT_NUMERIC);
+        $n = end($dirs) + 1;
+        unset($dirs);
+
         $dir = $this->reposDir . '/' . $n . '/'; 
         mkdir($dir, 0777);//FIXME
         $r = new Repository();