forking works now
[phorkie.git] / src / Phorkie / Repositories.php
1 <?php
2 namespace Phorkie;
3
4 class Repositories
5 {
6     public function __construct()
7     {
8         $this->reposDir = $GLOBALS['phorkie']['cfg']['repos'];
9     }
10
11     /**
12      * @return Repository
13      */
14     public function createNew()
15     {
16         chdir($this->reposDir);
17         $dirs = glob('*', GLOB_ONLYDIR);
18         sort($dirs, SORT_NUMERIC);
19         $n = end($dirs) + 1;
20         unset($dirs);
21
22         $dir = $this->reposDir . '/' . $n . '/'; 
23         mkdir($dir, 0777);//FIXME
24         $r = new Repository();
25         $r->id = $n;
26         $r->repoDir = $dir;
27         return $r;
28     }
29
30 }
31
32 ?>