4 * Copyright 2009, Roland Mas
6 * This file is part of FusionForge. FusionForge is free software;
7 * you can redistribute it and/or modify it under the terms of the
8 * GNU General Public License as published by the Free Software
9 * Foundation; either version 2 of the Licence, or (at your option)
12 * FusionForge is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 require (dirname (__FILE__).'/../common/include/env.inc.php');
23 require_once $gfcommon.'include/pre.php';
24 require_once $gfcommon.'frs/FRSPackage.class.php';
25 require_once $gfcommon.'frs/FRSRelease.class.php';
26 require_once $gfcommon.'frs/FRSFile.class.php';
32 * project:packagename:releasename:filepath:notes:changes:type:processor
33 * type taken from SELECT * from frs_filetype:
40 5900 | Other Source File
43 * processor taken from SELECT * from frs_processor:
52 $f = fopen ('files.txt', 'r') ;
54 $l = trim (fgets ($f, 1024)) ;
55 if ($l == "") { continue ; } ;
56 $array = explode (':', $l) ;
57 $projectname = $array[0] ;
58 $packagename = $array[1] ;
59 $releasename = $array[2] ;
60 $filepath = $array[3] ;
62 $changes = $array[5] ;
64 $processorid = $array[7] ;
66 $admin = user_get_object_by_name ('admin') ;
67 session_set_new ($admin->getID ()) ;
69 $g = group_get_object_by_name ($projectname);
71 print "Error: invalid group\n" ;
76 $packages = get_frs_packages ($g) ;
79 foreach ($packages as $cur) {
80 if ($cur->getName () == $packagename) {
87 $package = new FRSPackage ($g) ;
88 $r = $package->create ($packagename) ;
90 if (!$r || !$package) {
91 print "Error when creating FRS package\n" ;
96 $releases = $package->getReleases () ;
99 foreach ($releases as $cur) {
100 if ($cur->getName () == $releasename) {
107 $release = new FRSRelease ($package) ;
108 $r = $release->create ($releasename, $notes, $changes, false) ;
110 if (!$r || !$release) {
111 print "Error when creating FRS release\n" ;
116 $file = new FRSFile ($release) ;
117 $pathcomponents = explode ('/', $filepath) ;
118 $filename = $pathcomponents[count($pathcomponents)-1] ;
119 $r = $file->create ($filename, $filepath, $typeid, $processorid) ;
122 print "Error when creating FRS file\n" ;
129 // If everything went well so far, we can commit
134 // c-file-style: "bsd"