[LON-CAPA-cvs] cvs: loncom /interface loncoursedata.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Fri, 04 Jun 2004 17:46:10 -0000
matthew Fri Jun 4 13:46:10 2004 EDT
Modified files:
/loncom/interface loncoursedata.pm
Log:
&init_dbs now takes a parameter, $drop, which indicates if the system
should drop all the cache tables before trying to recreate them. Modified
&populate_student_table to call &init_dbs with $drop = 0. Modified
&ensure_tables_are_set_up to call &init_dbs with $drop = 1. This means that
additions to the student table will not cause the caches to be cleared, but
the lack of any single table in a cache set will cause all the remaining
tables to be dropped and recreated.
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.133 loncom/interface/loncoursedata.pm:1.134
--- loncom/interface/loncoursedata.pm:1.133 Thu May 13 09:55:35 2004
+++ loncom/interface/loncoursedata.pm Fri Jun 4 13:46:10 2004
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: loncoursedata.pm,v 1.133 2004/05/13 13:55:35 matthew Exp $
+# $Id: loncoursedata.pm,v 1.134 2004/06/04 17:46:10 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -547,12 +547,14 @@
################################################
################################################
sub init_dbs {
- my $courseid = shift;
+ my ($courseid,$drop) = @_;
&setup_table_names($courseid);
#
# Drop any of the existing tables
- foreach my $table (@Tables) {
- &Apache::lonmysql::drop_table($table);
+ if ($drop) {
+ foreach my $table (@Tables) {
+ &Apache::lonmysql::drop_table($table);
+ }
}
#
# Note - changes to this table must be reflected in the code that
@@ -1081,6 +1083,7 @@
}
#
&setup_table_names($courseid);
+ &init_dbs($courseid,0);
my $dbh = &Apache::lonmysql::get_dbh();
my $request = 'INSERT IGNORE INTO '.$student_table.
"(student,section,status) VALUES ";
@@ -1594,7 +1597,7 @@
!$found_performance || !$found_parameters ||
!$found_fulldump_part || !$found_fulldump_response ||
!$found_fulldump_timestamp || !$found_weight ) {
- if (&init_dbs($courseid)) {
+ if (&init_dbs($courseid,1)) {
return 'error';
}
}