Beispiel #1
0
 public function tree()
 {
     $git = new Git();
     $repositories = new repositories($this->getDb());
     $tree = new tree($this->getDb());
     //$tree_data=$tree->delete();
     //$repo_name = 'gitosis-admin';
     $all_repos = $repositories->select('*');
     //$repo_tree = $git->git_tree($repo_name);
     //$repo_tree = $git->git_tree();
     /*foreach($repo_tree as $repo_tree_term)
     		{
     		        
     			$tree->insert($repo_tree_term);
     		}*/
     foreach ($all_repos as $repo) {
         display($repo);
         $repo_name = isset($repo['name']) ? $repo['name'] : false;
         if ($repo_name) {
             $repo_trees = $git->git_tree($repo_name);
             display($repo_trees);
             if (count($repo_trees) > 0) {
                 foreach ($repo_trees as $tree_term) {
                     if (isset($tree_term['repo']) && isset($tree_term['commit']) && $tree_term['repo'] != '' && $tree_term['commit'] != '') {
                         $old_data = $tree->select('*', 'WHERE repo="' . $tree_term['repo'] . '" AND commit="' . $tree_term['commit'] . '"');
                         if (!isset($old_data[0]['id'])) {
                             $tree->insert($tree_term);
                         }
                     }
                 }
             }
         }
     }
 }