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';
29 * unixname:fullname:description:ispublic:username
30 * username is login of admin user
32 * Beware of colons in text fields (fullname, description)!
35 $f = fopen ('groups.txt', 'r') ;
37 $l = trim (fgets ($f, 1024)) ;
38 if ($l == "") { continue ; } ;
39 $array = explode (':', $l) ;
40 $unixname = $array[0] ;
41 $fullname = $array[1] ;
42 $description = $array[2] ;
43 $is_public = $array[3] ;
44 $username = $array[4] ;
46 $u = user_get_object_by_name($username) ;
48 print "Error: invalid user\n" ;
54 $r = $g->create ($u, $fullname, $unixname, $description, 'Project injected into the database by inject-groups.php', 'shell', 'scm', $is_public, false) ;
57 print "Error: ". $g->getErrorMessage () . "\n" ;
62 $admin = user_get_object_by_name ('admin') ;
63 session_set_new ($admin->getID ()) ;
64 $r = $g->setStatus ($admin, 'A') ;
66 print "Error: ". $g->getErrorMessage () . "\n" ;
74 // If everything went well so far, we can commit
79 // c-file-style: "bsd"