[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm /lonnet/perl lonnet.pm

raeburn raeburn at source.lon-capa.org
Tue Mar 25 05:41:17 EDT 2014


raeburn		Tue Mar 25 09:41:17 2014 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
    /loncom/auth	lonroles.pm 
  Log:
  - Support situation where different servers belonging to user's (and course's)
    domain are running different versions of LON-CAPA, and role selected has a 
    version requirement unmet by server currently hosting user session.     
    - Additional arg passed to &choose_server() -- $required (version of LON-CAPA 
      required for selected role).
    - Additional arg passed to &compare_server_load() -- $required (version of 
      LON-CAPA required). 
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1252 loncom/lonnet/perl/lonnet.pm:1.1253
--- loncom/lonnet/perl/lonnet.pm:1.1252	Sun Mar  9 15:39:04 2014
+++ loncom/lonnet/perl/lonnet.pm	Tue Mar 25 09:41:08 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1252 2014/03/09 15:39:04 raeburn Exp $
+# $Id: lonnet.pm,v 1.1253 2014/03/25 09:41:08 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -890,7 +890,17 @@
 }
 
 sub compare_server_load {
-    my ($try_server, $spare_server, $lowest_load) = @_;
+    my ($try_server, $spare_server, $lowest_load, $required) = @_;
+
+    if ($required) {
+        my ($reqdmajor,$reqdminor) = ($required =~ /^(\d+)\.(\d+)$/);
+        my $remoterev = &get_server_loncaparev(undef,$try_server);
+        my ($major,$minor) = ($remoterev =~ /^\'?(\d+)\.(\d+)\.[\w.\-]+\'?$/);
+        if (($major eq '' && $minor eq '') ||
+            (($reqdmajor > $major) || (($reqdmajor == $major) && ($reqdminor > $minor)))) {
+            return ($spare_server,$lowest_load);
+        }
+    }
 
     my $loadans     = &reply('load',    $try_server);
     my $userloadans = &reply('userload',$try_server);
@@ -951,7 +961,7 @@
 # --------- determine least loaded server in a user's domain which allows login
 
 sub choose_server {
-    my ($udom,$checkloginvia) = @_;
+    my ($udom,$checkloginvia,$required) = @_;
     my %domconfhash = &Apache::loncommon::get_domainconf($udom);
     my %servers = &get_servers($udom);
     my $lowest_load = 30000;
@@ -963,14 +973,14 @@
             if ($loginvia) {
                 my ($server,$path) = split(/:/,$loginvia);
                 ($login_host, $lowest_load) =
-                    &compare_server_load($server, $login_host, $lowest_load);
+                    &compare_server_load($server, $login_host, $lowest_load, $required);
                 if ($login_host eq $server) {
                     $portal_path = $path;
                     $isredirect = 1;
                 }
             } else {
                 ($login_host, $lowest_load) =
-                    &compare_server_load($lonhost, $login_host, $lowest_load);
+                    &compare_server_load($lonhost, $login_host, $lowest_load, $required);
                 if ($login_host eq $lonhost) {
                     $portal_path = '';
                     $isredirect = ''; 
@@ -978,7 +988,7 @@
             }
         } else {
             ($login_host, $lowest_load) =
-                &compare_server_load($lonhost, $login_host, $lowest_load);
+                &compare_server_load($lonhost, $login_host, $lowest_load, $required);
         }
     }
     if ($login_host ne '') {
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.300 loncom/auth/lonroles.pm:1.301
--- loncom/auth/lonroles.pm:1.300	Tue Mar 25 09:29:43 2014
+++ loncom/auth/lonroles.pm	Tue Mar 25 09:41:16 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.300 2014/03/25 09:29:43 raeburn Exp $
+# $Id: lonroles.pm,v 1.301 2014/03/25 09:41:16 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1750,7 +1750,7 @@
             my $otherserver;
             if (($major eq '' && $minor eq '') || 
                 (($reqdmajor > $major) || (($reqdmajor == $major) && ($reqdminor > $minor)))) {
-                my ($userdomserver) = &Apache::lonnet::choose_server($env{'user.domain'});
+                my ($userdomserver) = &Apache::lonnet::choose_server($env{'user.domain'},undef,$required);
                 my $switchlcrev = 
                     &Apache::lonnet::get_server_loncaparev($env{'user.domain'},
                                                            $userdomserver);




More information about the LON-CAPA-cvs mailing list