Annotation of loncom/debugging_tools/find_bad_problem_metadata.pl, revision 1.1
1.1 ! albertel 1: use strict;
! 2: use warnings;
! 3: use lib '/home/httpd/lib/perl';
! 4: use File::Find;
! 5: use LONCAPA::Configuration;
! 6:
! 7: my $perlvar= &LONCAPA::Configuration::read_conf('loncapa.conf');
! 8:
! 9: sub validate_parameter {
! 10: my ($contents) = @_;
! 11: foreach my $line (@{ $contents }) {
! 12: return 1 if ($line =~ m/<parameter /);
! 13: }
! 14: return 0;
! 15: }
! 16:
! 17:
! 18: sub validate_meta {
! 19: # only want to check problem metadata
! 20: return if ($_!~m/\.problem\.meta$/);
! 21: # can't do anything about old ones
! 22: return if ($_=~m/\.\d+\.problem\.meta$/);
! 23: # don't worry about the templates
! 24: return if ($_=~m{/templates/});
! 25: open(FILE,$_);
! 26: my @contents = <FILE>;
! 27: if (!&validate_parameter(\@contents)) {
! 28: print("$_ parameters missing\n");
! 29: }
! 30: }
! 31:
! 32: sub main {
! 33: find(
! 34: {
! 35: no_chdir => 1,
! 36: wanted => \&validate_meta,
! 37: },
! 38: $perlvar->{'lonDocRoot'}
! 39: );
! 40: }
! 41:
! 42: &main();
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>