--- loncom/debugging_tools/move_construction_spaces.pl 2011/10/27 03:31:50 1.3 +++ loncom/debugging_tools/move_construction_spaces.pl 2011/10/27 03:43:53 1.4 @@ -5,7 +5,7 @@ # Move Construction Spaces from /home/$user/public_html # to /home/httpd/html/priv/$domain/$user and vice versa # -# $Id: move_construction_spaces.pl,v 1.3 2011/10/27 03:31:50 raeburn Exp $ +# $Id: move_construction_spaces.pl,v 1.4 2011/10/27 03:43:53 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -57,18 +57,30 @@ if (ref($perlvar) eq 'HASH') { } undef($perlvar); +if ($lonuserdir eq '') { + print &mt('Could not determine location of [_1] directory.',"'lonUsersDir'")."\n". + &mt('Stopping')."\n"; + exit; +} + +if ($londocroot eq '') { + print &mt('Could not determine location of [_1] directory.',"'lonDocRoot'")."\n". + &mt('Stopping')."\n"; + exit; +} + my $distro; -if ($londaemons ne '') { +if ($londaemons eq '') { + print &mt('Could not determine location of [_1] directory.',"'lonDaemons'")."\n". + &mt('Stopping')."\n"; + exit; +} else { if (-e "$londaemons/distprobe") { if (open(PIPE,"perl $londaemons/distprobe|")) { $distro = ; close(PIPE); } } -} else { - print &mt('Could not determine location of [_1] directory.',"'lonDaemons'")."\n". - &mt('Stopping')."\n"; - exit; } if ($distro eq '') { @@ -149,14 +161,6 @@ print "\n".&mt("Moving authors' Construc "'/home'","'$londocroot/priv/'")."\n\n". &mt('If there are ambiguities (i.e., the same username belongs to two domains), this will be flagged, and you will be able to decide how to proceed.')."\n"; -my $perlvar=&LONCAPA::Configuration::read_conf(); -my ($lonuserdir,$londocroot); -if (ref($perlvar) eq 'HASH') { - $lonuserdir = $perlvar->{'lonUsersDir'}; - $londocroot = $perlvar->{'lonDocRoot'}; -} -undef($perlvar); - my (undef,undef,$uid,$gid) = getpwnam('www'); my ($action) = ($parameter=~/^(move|undo)$/); if ($action eq '') { @@ -254,7 +258,7 @@ if ($lonuserdir) { unless (grep(/^\Q$domain\E$/,@machinedoms)) { push(@machinedoms,$domain); } - my $dom_target="/home/httpd/html/priv/$domain"; + my $dom_target="$londocroot/priv/$domain"; if ($action eq 'move') { if (!-e $dom_target) { if (mkdir($dom_target,0755)) {