version 1.1, 2006/06/05 23:18:45
|
version 1.6, 2024/07/08 22:06:15
|
Line 1
|
Line 1
|
<!DOCTYPE piml PUBLIC "-//TUX/DTD piml 1.0 Final//EN" |
<!DOCTYPE piml PUBLIC "-//TUX/DTD piml 1.0 Final//EN" |
"http://lpml.sourceforge.net/DTD/piml.dtd"> |
"http://lpml.sourceforge.net/DTD/piml.dtd"> |
<!-- accesscount_seed.piml --> |
<!-- update_queue_slots.piml --> |
<!-- Matthew Hall --> |
<!-- Matthew Hall --> |
|
|
<!-- $Id$ --> |
<!-- $Id$ --> |
Line 54 sub update_value {
|
Line 54 sub update_value {
|
return $value; |
return $value; |
} |
} |
|
|
my $updated; |
my $updated=0; |
|
my %dirs; |
|
my $last; |
|
my $total; |
sub process_gradingqueue_file { |
sub process_gradingqueue_file { |
|
my $which = (split('/',$_))[5]; |
|
$dirs{$which} = 1; |
|
my $count2 = length("$last"); |
|
my $count = length("$updated"); |
|
my $backup = "\b"x(8+$count2+14+$count+6); |
|
if (scalar(keys(%dirs)) > $last) { |
|
$last = scalar(keys(%dirs)); |
|
print($backup."Updated $last directories, $updated files"); |
|
} |
return if ($_!~m/(gradingqueue|reviewqueue|slots|slot_reservations)\.db$/); |
return if ($_!~m/(gradingqueue|reviewqueue|slots|slot_reservations)\.db$/); |
my $type='queue'; |
my $type='queue'; |
if ($1 eq 'slots') { |
if ($1 eq 'slots') { |
Line 63 sub process_gradingqueue_file {
|
Line 75 sub process_gradingqueue_file {
|
} elsif ($1 eq 'slot_reservations') { |
} elsif ($1 eq 'slot_reservations') { |
$type = 'reservation'; |
$type = 'reservation'; |
} |
} |
|
my $count2 = length("$last"); |
my $count = length("$updated"); |
my $count = length("$updated"); |
|
my $backup = "\b"x(8+$count2+14+$count+6); |
$updated++; |
$updated++; |
print("\b"x(14+$count)); |
print($backup."Updated $last directories, $updated files"); |
print("Updated $updated files"); |
my $db = &LONCAPA::locking_hash_tie($_,&GDBM_WRCREAT()); |
my $prefix = $_; |
|
$prefix =~s/\.db$//; |
|
my $db = &LONCAPA::_locking_hash_tie($prefix,'nohist_',&GDBM_WRCREAT()); |
|
if ($type eq 'queue') { |
if ($type eq 'queue') { |
foreach my $key (keys(%{$db})) { |
foreach my $key (keys(%{$db})) { |
my $real_key = &unescape($key); |
my $real_key = &unescape($key); |
Line 115 sub process_gradingqueue_file {
|
Line 126 sub process_gradingqueue_file {
|
} else { |
} else { |
print("$type unsupported\n"); |
print("$type unsupported\n"); |
} |
} |
&untie_user_hash($db); |
&LONCAPA::locking_hash_untie($db); |
|
|
} |
} |
|
|
|
|
sub main { |
sub main { |
print("Updating grading queue and slot definitions\n"); |
my $doupdate; |
my $perlvar=LONCAPA::Configuration::read_conf('loncapa.conf'); |
if (-e '/etc/loncapa-release') { |
find( |
if (open(PIPE,"cat /etc/loncapa-release.prev |grep '^LON-CAPA release' |")) { |
{ |
if (<PIPE> =~ /^\QLON-CAPA release \E(CVS_HEAD|\d+\.\d+\.\d+\.?\w*)\-\d+$/) { |
no_chdir => 1, |
my $previous = $1; |
wanted => \&process_gradingqueue_file, |
unless ($previous eq 'CVS_HEAD') { |
}, |
my ($major,$minor) = ($previous =~ /^(\d+)\.(\d+)\./); |
'/home/www/lonUsers/'); |
if (($major ne '') && ($minor ne '')) { |
print("\n"); |
if (($major == 2) && ($minor < 10)) { |
|
$doupdate = 1; |
|
} |
|
} |
|
} |
|
} |
|
close(PIPE); |
|
} |
|
} |
|
|
|
if ($doupdate) { |
|
print("Updating grading queue and slot definitions\n"); |
|
my $perlvar=LONCAPA::Configuration::read_conf('loncapa.conf'); |
|
find( |
|
{ |
|
no_chdir => 1, |
|
wanted => \&process_gradingqueue_file, |
|
}, |
|
$perlvar->{'lonUsersDir'}); |
|
print("\n"); |
|
} else { |
|
print("Update of grading queue and slot definitions not required.\n"); |
|
} |
} |
} |
|
|
&main(); |
&main(); |