2 require_once '../env.inc.php';
3 require_once $gfwww.'include/pre.php';
4 require_once $gfcommon.'frs/FRSFile.class.php';
5 require_once $gfcommon.'frs/FRSPackage.class.php';
6 require_once $gfcommon.'frs/FRSRelease.class.php';
16 public $pk_vars = array('Active' => 1, 'Hidden' =>3);
18 public $rel_vars = array('Active' => 1, 'Hidden' =>3);
21 function __construct($frs, $group_id) {
23 $this->group_id = $group_id;
24 $group =& group_get_object($group_id);
25 if (!$group || !is_object($group)) {
26 print "error retrieving group from id";
27 } elseif ($group->isError()) {
30 $this->group = $group;
35 $pkgs = &get_frs_packages($this->group);
36 foreach($pkgs as $pkg){
37 $pkg->delete(true,true);
41 foreach($this->frs as $pk_name => $pk_content){
42 // new dBug(array($pk_name,$pk_content));
44 $pkg = new FRSPackage($this->group);
45 //new dBug(textareaSpecialchars($pk_name));
46 $pkg->create($pk_name);
47 $pkg->update($pk_name, $this->pk_vars[$pk_content['status']]);
50 foreach($pk_content['releases'] as $rel_name => $rel_content){
51 // new dBug(array($rel_name,$rel_content));
53 $rel = new FRSRelease($pkg);
54 $rel->create($rel_name, $rel_content['release_notes'], $rel_content['change_log'], 0, strtotime($rel_content['date']));
55 $rel->update($this->rel_vars[$rel_content['status']], $rel_name, $rel_content['release_notes'], $rel_content['change_log'], 0, strtotime($rel_content['date']));
56 foreach($rel_content['files'] as $fname => $fcontent){
58 $file = new FRSFile($rel);
59 $res = db_query_params('SELECT processor_id
61 WHERE name=$1', array($fcontent['processor']));
62 //TODO:Cleanup, there must be a function to catch only one result
63 while ($row=db_fetch_array($res)){
64 $processor_id=$row['processor_id'];
67 $res = db_query_params('SELECT type_id
69 WHERE name=$1', array($fcontent['type']));
70 //TODO:Cleanup, there must be a function to catch only one result
71 while ($row=db_fetch_array($res)){
72 $type_id=$row['type_id'];
74 $file->create($fname, '/tmp/'.$fcontent['url'], $type_id, $processor_id, strtotime($fcontent['date']));