6 public function __construct()
8 $this->workDir = $GLOBALS['phorkie']['cfg']['workdir'];
9 $this->gitDir = $GLOBALS['phorkie']['cfg']['gitdir'];
15 public function createNew()
18 $dirs = glob('*.git', GLOB_ONLYDIR);
19 array_walk($dirs, function ($dir) { return substr($dir, 0, -4); });
20 sort($dirs, SORT_NUMERIC);
23 chdir($this->workDir);
24 $dir = $this->workDir . '/' . $n . '/';
25 mkdir($dir, 0777);//FIXME
26 $r = new Repository();
29 $r->gitDir = $this->gitDir . '/' . $n . '.git/';
30 mkdir($r->gitDir, 0777);//FIXME
36 * Get a list of repository objects
38 * @param integer $page Page number, beginning with 0
39 * @param integer $perPage Number of repositories per page
41 * @return array Array of Repositories first, number of repositories second
43 public function getList($page = 0, $perPage = 10)
46 $dirs = glob('*.git', GLOB_ONLYDIR);
47 sort($dirs, SORT_NUMERIC);
49 $some = array_slice($dirs, $page * $perPage, $perPage);
51 foreach ($some as $oneDir) {
52 $r = new Repository();
53 $r->loadById(substr($oneDir, 0, -4));
56 return array($repos, count($dirs));