4 * Copyright 2009, Roland Mas
6 * This file is part of FusionForge.
8 * FusionForge is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published
10 * by the Free Software Foundation; either version 2 of the License,
11 * or (at your option) any later version.
13 * FusionForge is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with FusionForge; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 require (dirname (__FILE__).'/../www/env.inc.php');
25 require_once $gfwww.'include/pre.php';
26 require_once $gfcommon.'frs/FRSPackage.class.php';
27 require_once $gfcommon.'frs/FRSRelease.class.php';
28 require_once $gfcommon.'frs/FRSFile.class.php';
34 * project:packagename:releasename:filepath:notes:changes:type:processor
35 * type taken from SELECT * from frs_filetype:
42 5900 | Other Source File
45 * processor taken from SELECT * from frs_processor:
54 $f = fopen ('files.txt', 'r') ;
56 $l = trim (fgets ($f, 1024)) ;
57 if ($l == "") { continue ; } ;
58 $array = explode (':', $l) ;
59 $projectname = $array[0] ;
60 $packagename = $array[1] ;
61 $releasename = $array[2] ;
62 $filepath = $array[3] ;
64 $changes = $array[5] ;
66 $processorid = $array[7] ;
68 $admin = user_get_object_by_name ('admin') ;
69 session_set_new ($admin->getID ()) ;
71 $g = group_get_object_by_name ($projectname);
73 print "Error: invalid group\n" ;
78 $packages = get_frs_packages ($g) ;
81 foreach ($packages as $cur) {
82 if ($cur->getName () == $packagename) {
89 $package = new FRSPackage ($g) ;
90 $r = $package->create ($packagename) ;
92 if (!$r || !$package) {
93 print "Error when creating FRS package\n" ;
98 $releases = $package->getReleases () ;
101 foreach ($releases as $cur) {
102 if ($cur->getName () == $releasename) {
109 $release = new FRSRelease ($package) ;
110 $r = $release->create ($releasename, $notes, $changes, false) ;
112 if (!$r || !$release) {
113 print "Error when creating FRS release\n" ;
118 $file = new FRSFile ($release) ;
119 $pathcomponents = explode ('/', $filepath) ;
120 $filename = $pathcomponents[count($pathcomponents)-1] ;
121 $r = $file->create ($filename, $filepath, $typeid, $processorid) ;
124 print "Error when creating FRS file\n" ;
131 // If everything went well so far, we can commit
136 // c-file-style: "bsd"