[LON-CAPA-cvs] cvs: loncom /debugging_tools move_construction_spaces.pl

raeburn raeburn at source.lon-capa.org
Wed Oct 26 23:43:53 EDT 2011


raeburn		Thu Oct 27 03:43:53 2011 EDT

  Modified files:              
    /loncom/debugging_tools	move_construction_spaces.pl 
  Log:
  - Early out if configuration information unavailable for:
    lonUsersDir, lonDocRoot, or lonDaemons perlvars.
  - Remove duplicated retrieval of configuration information.
  
  
Index: loncom/debugging_tools/move_construction_spaces.pl
diff -u loncom/debugging_tools/move_construction_spaces.pl:1.3 loncom/debugging_tools/move_construction_spaces.pl:1.4
--- loncom/debugging_tools/move_construction_spaces.pl:1.3	Thu Oct 27 03:31:50 2011
+++ loncom/debugging_tools/move_construction_spaces.pl	Thu Oct 27 03:43:53 2011
@@ -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 @@
 }
 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 = <PIPE>;
             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 @@
           "'/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 @@
                     unless (grep(/^\Q$domain\E$/, at 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)) {




More information about the LON-CAPA-cvs mailing list