5 * Fabio Bertagnin nov 2005
6 * fbertatnin@mail.transiciel.com
8 * This file is part of FusionForge. FusionForge is free software;
9 * you can redistribute it and/or modify it under the terms of the
10 * GNU General Public License as published by the Free Software
11 * Foundation; either version 2 of the Licence, or (at your option)
14 * FusionForge is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 require_once $gfcommon.'include/pre.php';
25 require $gfcommon.'include/cron_utils.php';
30 $chroot_dir = forge_get_config('chroot');
31 $ftp_dir = forge_get_config('ftp_upload_dir')."/pub/";
32 $home_dir = $chroot_dir.forge_get_config('homedir_prefix')."/";
34 $res_db = db_query_params ('SELECT user_id FROM users WHERE unix_status=$1',
37 while($e = db_fetch_array($res_db)) {
38 $users[] = user_get_object ($e['user_id']) ;
42 foreach ($users as $u) {
43 $dir = "$home_dir".$u->getUnixName()."/pub";
44 if (is_dir("$home_dir".$u->getUnixName())) {
45 foreach ($u->getGroups() as $project) {
46 $g = $project->getUnixName() ;
47 if (is_dir("$ftp_dir"."$g")) {
48 if (is_dir("$dir/$g")) {
49 $cmd = "/bin/umount $dir/$g";
51 $cmd = "/bin/rmdir $dir/$g";
55 $cmd = "/bin/mkdir $dir";
58 $cmd = "/bin/mkdir $dir/$g";
60 $cmd = "/bin/mount --bind $ftp_dir"."$g $dir/$g";
62 echo "allow ".$u->getUnixName()." to access at $dir/$g\n";
68 function print_debug($text)
73 function execute($cmd)
75 // print_debug ("cmd= ".$cmd);
76 $res = shell_exec($cmd);
77 // print_debug ("res= ".$res);