5 * Fabio Bertagnin nov 2005
6 * fbertatnin@mail.transiciel.com
8 * This file is part of FusionForge.
10 * FusionForge is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * GForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with GForge; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 require_once $gfcommon.'include/pre.php';
26 require $gfcommon.'include/cron_utils.php';
31 $chroot_dir = forge_get_config('chroot');
32 $ftp_dir = forge_get_config('ftp_upload_dir')."/pub/";
33 $home_dir = $chroot_dir.forge_get_config('homedir_prefix')."/";
35 $res_db = db_query_params ('SELECT user_id FROM users WHERE unix_status=$1',
38 while($e = db_fetch_array($res_db)) {
39 $users[] = user_get_object ($e['user_id']) ;
43 foreach ($users as $u) {
44 $dir = "$home_dir".$u->getUnixName()."/pub";
45 if (is_dir("$home_dir".$u->getUnixName())) {
46 foreach ($u->getGroups() as $project) {
47 $g = $project->getUnixName() ;
48 if (is_dir("$ftp_dir"."$g")) {
49 if (is_dir("$dir/$g")) {
50 $cmd = "/bin/umount $dir/$g";
52 $cmd = "/bin/rmdir $dir/$g";
56 $cmd = "/bin/mkdir $dir";
59 $cmd = "/bin/mkdir $dir/$g";
61 $cmd = "/bin/mount --bind $ftp_dir"."$g $dir/$g";
63 echo "allow ".$u->getUnixName()." to access at $dir/$g\n";
69 function print_debug($text)
74 function execute($cmd)
76 // print_debug ("cmd= ".$cmd);
77 $res = shell_exec($cmd);
78 // print_debug ("res= ".$res);