[LON-CAPA-cvs] cvs: loncom /automation Autocreate.pl batchcreatecourse.pm /interface loncreatecourse.pm
raeburn
raeburn at source.lon-capa.org
Thu Jul 25 22:28:34 EDT 2019
raeburn Fri Jul 26 02:28:34 2019 EDT
Modified files:
/loncom/automation batchcreatecourse.pm Autocreate.pl
/loncom/interface loncreatecourse.pm
Log:
- Devalidate cache for self-cataloging of courses, based on institutional
code for institution's nodes, when creating an "official" course.
Index: loncom/automation/batchcreatecourse.pm
diff -u loncom/automation/batchcreatecourse.pm:1.42 loncom/automation/batchcreatecourse.pm:1.43
--- loncom/automation/batchcreatecourse.pm:1.42 Thu Aug 25 22:33:06 2016
+++ loncom/automation/batchcreatecourse.pm Fri Jul 26 02:28:28 2019
@@ -1,5 +1,5 @@
#
-# $Id: batchcreatecourse.pm,v 1.42 2016/08/25 22:33:06 raeburn Exp $
+# $Id: batchcreatecourse.pm,v 1.43 2019/07/26 02:28:28 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -211,7 +211,7 @@
$longroles{'Community'}{$1} = $3;
}
}
- my ($logmsg,$keysmsg,$newusermsg,$addresult,%codehash);
+ my ($logmsg,$keysmsg,$newusermsg,$addresult,%codehash,%instcodes);
my %enrollcount = ();
my $newcoursedir = LONCAPA::tempdir().'/addcourse/'.$dom.'/'.$context;
if ($context eq 'auto') {
@@ -239,12 +239,15 @@
if ($code) {
$codehash{$courseid} = $code;
}
+ if ($details{$num}{'coursecode'} ne '') {
+ push(@{$instcodes{$details{$num}{'coursecode'}}},$courseid);
+ }
}
}
}
}
}
- return ($output,$logmsg,$keysmsg,\%codehash);
+ return ($output,$logmsg,$keysmsg,\%codehash,\%instcodes);
}
#############################################################
@@ -568,7 +571,7 @@
} else {
return;
}
-
+
#
# Make owner a coordinator
#
Index: loncom/automation/Autocreate.pl
diff -u loncom/automation/Autocreate.pl:1.20 loncom/automation/Autocreate.pl:1.21
--- loncom/automation/Autocreate.pl:1.20 Wed Nov 16 18:09:21 2016
+++ loncom/automation/Autocreate.pl Fri Jul 26 02:28:28 2019
@@ -2,7 +2,7 @@
#
# Automated Course Creation script
#
-# $Id: Autocreate.pl,v 1.20 2016/11/16 18:09:21 raeburn Exp $
+# $Id: Autocreate.pl,v 1.21 2019/07/26 02:28:28 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -175,7 +175,8 @@
closedir(DIR);
my %courseids = ();
print $fh "Sending to batch - auto,$dom,$dcname,$dcdom ".join(":", at requests)."\n";
- my ($result,$logmsg) = &LONCAPA::batchcreatecourse::create_courses(\@requests,\%courseids,'auto',$dom,$dcname,$dcdom);
+ my ($result,$logmsg,$keysmsg,$codesref,$instcodesref) =
+ &LONCAPA::batchcreatecourse::create_courses(\@requests,\%courseids,'auto',$dom,$dcname,$dcdom);
my $outcome;
if ($result ne '') {
$outcome = $result."\n";
@@ -183,6 +184,9 @@
if ($logmsg ne '') {
$outcome .= $logmsg."\n";
}
+ if ($keysmsg ne '') {
+ $outcome .= $keysmsg."\n";
+ }
print $fh $outcome;
my $output;
@@ -210,6 +214,22 @@
}
$output =~ s/:$//;
&unset_dc_env();
+ if (ref($instcodesref) eq 'HASH') {
+ if (keys(%{$instcodesref}) > 0) {
+ &Apache::lonnet::devalidate_cache_new('instcats',$dom);
+ if (&Apache::lonnet::shared_institution($dom)) {
+ my %servers = &Apache::lonnet::internet_dom_servers($dom);
+ my %thismachine;
+ map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids();
+ if (keys(%servers)) {
+ foreach my $server (keys(%servers)) {
+ next if ($thismachine{$server});
+ &Apache::lonnet::remote_devalidate_cache($server,['instcats:'.$dom]);
+ }
+ }
+ }
+ }
+ }
return $output;
}
Index: loncom/interface/loncreatecourse.pm
diff -u loncom/interface/loncreatecourse.pm:1.171 loncom/interface/loncreatecourse.pm:1.172
--- loncom/interface/loncreatecourse.pm:1.171 Thu Jul 25 20:23:52 2019
+++ loncom/interface/loncreatecourse.pm Fri Jul 26 02:28:34 2019
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Create a course
#
-# $Id: loncreatecourse.pm,v 1.171 2019/07/25 20:23:52 raeburn Exp $
+# $Id: loncreatecourse.pm,v 1.172 2019/07/26 02:28:34 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -932,6 +932,7 @@
}
my $updatecats;
if ((ref($instcodesref) eq 'HASH') && (keys(%{$instcodesref}) > 0)) {
+ &Apache::lonnet::devalidate_cache_new('instcats',$defdom);
$updatecats = 1;
}
®ister_cleanups($r,$defdom,$updatecats);
More information about the LON-CAPA-cvs
mailing list