[LON-CAPA-cvs] cvs: loncom / Lond.pm lond

droeschl droeschl at source.lon-capa.org
Thu Apr 26 16:00:57 EDT 2012


droeschl		Thu Apr 26 20:00:57 2012 EDT

  Modified files:              
    /loncom	lond Lond.pm 
  Log:
  changes related to BZ 6585
  lond:
  - moved get_courseinfo_hash into Lond.pm
  
  
Index: loncom/lond
diff -u loncom/lond:1.492 loncom/lond:1.493
--- loncom/lond:1.492	Thu Apr 26 19:51:40 2012
+++ loncom/lond	Thu Apr 26 20:00:57 2012
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.492 2012/04/26 19:51:40 droeschl Exp $
+# $Id: lond,v 1.493 2012/04/26 20:00:57 droeschl Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -61,7 +61,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.492 $'; #' stupid emacs
+my $VERSION='$Revision: 1.493 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid="default";
 my $currentdomainid;
@@ -7364,41 +7364,6 @@
 }
 
 
-# 
-# get_courseinfo_hash() is used to retrieve course information from the db
-# file: nohist_courseids.db for a course for which the current server is *not*
-# the home server.
-#
-# A hash of a hash will be retrieved. The outer hash contains a single key --
-# courseID -- for the course for which the data are being requested.
-# The contents of the inner hash, for that single item in the outer hash
-# are returned (and cached in memcache for 10 minutes).
-# 
-
-sub get_courseinfo_hash {
-    my ($cnum,$cdom,$home) = @_;
-    my %info;
-    eval {
-        local($SIG{ALRM}) = sub { die "timeout\n"; };
-        local($SIG{__DIE__})='DEFAULT';
-        alarm(3);
-        %info = &Apache::lonnet::courseiddump($cdom,'.',1,'.','.',$cnum,1,[$home],'.');
-        alarm(0);
-    };
-    if ($@) {
-        if ($@ eq "timeout\n") {
-            &logthis("<font color='blue'>WARNING courseiddump for $cnum:$cdom from $home timedout</font>");
-        } else {
-            &logthis("<font color='yellow'>WARNING unexpected error during eval of call for courseiddump from $home</font>");
-        }
-    } else {
-        if (ref($info{$cdom.'_'.$cnum}) eq 'HASH') {
-            my $hashid = $cdom.':'.$cnum;
-            return &Apache::lonnet::do_cache_new('courseinfo',$hashid,$info{$cdom.'_'.$cnum},600);
-        }
-    }
-    return;
-}
 
 
 sub distro_and_arch {
Index: loncom/Lond.pm
diff -u loncom/Lond.pm:1.2 loncom/Lond.pm:1.3
--- loncom/Lond.pm:1.2	Thu Apr 26 19:51:40 2012
+++ loncom/Lond.pm	Thu Apr 26 20:00:57 2012
@@ -1,6 +1,6 @@
 # The LearningOnline Network
 #
-# $Id: Lond.pm,v 1.2 2012/04/26 19:51:40 droeschl Exp $
+# $Id: Lond.pm,v 1.3 2012/04/26 20:00:57 droeschl Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -300,6 +300,30 @@
 }
 
 
+sub get_courseinfo_hash {
+    my ($cnum,$cdom,$home) = @_;
+    my %info;
+    eval {
+        local($SIG{ALRM}) = sub { die "timeout\n"; };
+        local($SIG{__DIE__})='DEFAULT';
+        alarm(3);
+        %info = &Apache::lonnet::courseiddump($cdom,'.',1,'.','.',$cnum,1,[$home],'.');
+        alarm(0);
+    };
+    if ($@) {
+        if ($@ eq "timeout\n") {
+            &logthis("<font color='blue'>WARNING courseiddump for $cnum:$cdom from $home timedout</font>");
+        } else {
+            &logthis("<font color='yellow'>WARNING unexpected error during eval of call for courseiddump from $home</font>");
+        }
+    } else {
+        if (ref($info{$cdom.'_'.$cnum}) eq 'HASH') {
+            my $hashid = $cdom.':'.$cnum;
+            return &Apache::lonnet::do_cache_new('courseinfo',$hashid,$info{$cdom.'_'.$cnum},600);
+        }
+    }
+    return;
+}
 
 
 
@@ -408,6 +432,19 @@
 is compatible, 1 will be returned.
 
 
+=item get_courseinfo_hash( $cnum, $cdom, $home )
+
+get_courseinfo_hash() is used to retrieve course information from the db
+file: nohist_courseids.db for a course for which the current server is *not*
+the home server.
+
+A hash of a hash will be retrieved. The outer hash contains a single key --
+courseID -- for the course for which the data are being requested.
+The contents of the inner hash, for that single item in the outer hash
+are returned (and cached in memcache for 10 minutes).
+
+
+
 =back
 
 =head1 BUGS




More information about the LON-CAPA-cvs mailing list