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);
20 function __construct($frs, $group_id) {
22 $this->group_id = $group_id;
23 $group = group_get_object($group_id);
24 if (!$group || !is_object($group)) {
25 print "error retrieving group from id";
26 } elseif ($group->isError()) {
29 $this->group = $group;
33 $pkgs = &get_frs_packages($this->group);
34 foreach($pkgs as $pkg){
35 $pkg->delete(true,true);
39 foreach($this->frs as $pk_name => $pk_content){
40 // new dBug(array($pk_name,$pk_content));
42 $pkg = new FRSPackage($this->group);
43 //new dBug(textareaSpecialchars($pk_name));
44 $pkg->create($pk_name);
45 $pkg->update($pk_name, $this->pk_vars[$pk_content['status']]);
48 foreach($pk_content['releases'] as $rel_name => $rel_content){
49 // new dBug(array($rel_name,$rel_content));
51 $rel = new FRSRelease($pkg);
52 $rel->create($rel_name, $rel_content['release_notes'], $rel_content['change_log'], 0, strtotime($rel_content['date']));
53 $rel->update($this->rel_vars[$rel_content['status']], $rel_name, $rel_content['release_notes'], $rel_content['change_log'], 0, strtotime($rel_content['date']));
54 foreach($rel_content['files'] as $fname => $fcontent){
56 $file = new FRSFile($rel);
57 $res = db_query_params('SELECT processor_id
59 WHERE name=$1', array($fcontent['processor']));
60 //TODO:Cleanup, there must be a function to catch only one result
61 while ($row=db_fetch_array($res)){
62 $processor_id=$row['processor_id'];
65 $res = db_query_params('SELECT type_id
67 WHERE name=$1', array($fcontent['type']));
68 //TODO:Cleanup, there must be a function to catch only one result
69 while ($row=db_fetch_array($res)){
70 $type_id=$row['type_id'];
72 $file->create($fname, '/tmp/'.$fcontent['url'], $type_id, $processor_id, strtotime($fcontent['date']));