Parent Directory
|
Revision Log
forward-port from rel-2-2-dev: (update copyright date range -- 2000-2006. this is probably overkill, since there are some files that were created after 2000 and some files that were last modified before 2006.)
1 #!/usr/bin/env perl 2 ################################################################################ 3 # WeBWorK Online Homework Delivery System 4 # Copyright © 2000-2006 The WeBWorK Project, http://openwebwork.sf.net/ 5 # $CVSHeader: webwork2/bin/ww1hash_reindex,v 1.2 2004/10/10 17:04:47 sh002i Exp $ 6 # 7 # This program is free software; you can redistribute it and/or modify it under 8 # the terms of either: (a) the GNU General Public License as published by the 9 # Free Software Foundation; either version 2, or (at your option) any later 10 # version, or (b) the "Artistic License" which comes with this package. 11 # 12 # This program is distributed in the hope that it will be useful, but WITHOUT 13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 # FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the 15 # Artistic License for more details. 16 ################################################################################ 17 18 =head1 NAME 19 20 ww1hash_reindex - regenerate indices for WW1Hash databases. 21 22 =head1 SYNOPSIS 23 24 ww1hash_reindex course 25 26 =head1 DESCRIPTION 27 28 C<ww1hash_reindex> will remove and regenerate the embedded indices in the 29 WW1Hash database of a course using the C<gdbm> database layout. 30 31 This is necessary if there are inconsistencies between the PSVNs indexed and 32 those actually existing in the database. 33 34 =cut 35 36 use strict; 37 use warnings; 38 39 BEGIN { 40 die "WEBWORK_ROOT not found in environment.\n" 41 unless exists $ENV{WEBWORK_ROOT}; 42 } 43 44 use lib "$ENV{WEBWORK_ROOT}/lib"; 45 use WeBWorK::CourseEnvironment; 46 use WeBWorK::DB; 47 48 sub usage { 49 print STDERR "usage: $0 course\n"; 50 exit 1; 51 } 52 53 my ($course) = @ARGV; 54 55 usage() unless $course; 56 57 my $ce = WeBWorK::CourseEnvironment->new({ 58 webwork_dir => $ENV{WEBWORK_ROOT}, 59 courseName => $course, 60 }); 61 62 # bring up database 63 my $db = WeBWorK::DB->new($ce->{dbLayout}); 64 65 # check to make sure set_user and problem_user are using WW1Hash 66 die "'set_user' table not using WeBWorK::DB::Schema::WW1Hash.\n" 67 unless ref $db->{set_user} eq "WeBWorK::DB::Schema::WW1Hash"; 68 die "'problem_user' table not using WeBWorK::DB::Schema::WW1Hash.\n" 69 unless ref $db->{problem_user} eq "WeBWorK::DB::Schema::WW1Hash"; 70 71 # call WW1Hash::reindex() 72 print "Reindexing database...\n"; 73 my @results = $db->{set_user}->reindex(); 74 75 # display results 76 print "Results:\n\n"; 77 print map "$_\n", @results;
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |