[LON-CAPA-cvs] cvs: loncom(version_2_11_X) / Lond.pm
raeburn
raeburn at source.lon-capa.org
Sat Sep 1 21:58:31 EDT 2018
raeburn Sun Sep 2 01:58:31 2018 EDT
Modified files: (Branch: version_2_11_X)
/loncom Lond.pm
Log:
- For 2.11
Backport 1.10, 1.11.
Index: loncom/Lond.pm
diff -u loncom/Lond.pm:1.8 loncom/Lond.pm:1.8.2.1
--- loncom/Lond.pm:1.8 Fri May 22 21:14:59 2015
+++ loncom/Lond.pm Sun Sep 2 01:58:30 2018
@@ -1,6 +1,6 @@
# The LearningOnline Network
#
-# $Id: Lond.pm,v 1.8 2015/05/22 21:14:59 raeburn Exp $
+# $Id: Lond.pm,v 1.8.2.1 2018/09/02 01:58:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -782,6 +782,34 @@
return $qresult;
}
+sub is_course {
+ my ($cdom,$cnum) = @_;
+
+ return unless (($cdom =~ /^$LONCAPA::match_domain$/) &&
+ ($cnum =~ /^$LONCAPA::match_courseid$/));
+ my $hashid = $cdom.':'.$cnum;
+ my ($iscourse,$cached) =
+ &Apache::lonnet::is_cached_new('iscourse',$hashid);
+ unless (defined($cached)) {
+ my $hashref =
+ &tie_domain_hash($cdom, "nohist_courseids", &GDBM_WRCREAT());
+ if (ref($hashref) eq 'HASH') {
+ my $esc_key = &escape($cdom.'_'.$cnum);
+ if (exists($hashref->{$esc_key})) {
+ $iscourse = 1;
+ } else {
+ $iscourse = 0;
+ }
+ &Apache::lonnet::do_cache_new('iscourse',$hashid,$iscourse,3600);
+ unless (&untie_domain_hash($hashref)) {
+ &logthis("Failed to untie tied hash for nohist_courseids.db for $cdom");
+ }
+ } else {
+ &logthis("Failed to tie hash for nohist_courseids.db for $cdom");
+ }
+ }
+ return $iscourse;
+}
1;
More information about the LON-CAPA-cvs
mailing list