From 439d98c65289f19662459106de1cc1a40ee2c5f4 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 9 Oct 2015 21:30:04 +0200 Subject: first checks for showids diff --git a/lib/RHRD/rddb.pm b/lib/RHRD/rddb.pm index 67b431f..3a6bf21 100755 --- a/lib/RHRD/rddb.pm +++ b/lib/RHRD/rddb.pm @@ -952,6 +952,27 @@ sub list_shows return @show_dbs; } +sub list_showids +{ + my ($ctx, $groupname) = @_; + + my $sql = qq{select NUMBER from CART where GROUP_NAME = ? order by NUMBER}; + + my $sth = $ctx->{'dbh'}->prepare($sql) + or return (undef, 'ERROR', "Database Error: " . $ctx->{'dbh'}->errstr); + + $sth->execute($ctx->{'config'}{'specialgroups'}{'shows'}) + or return (undef, 'ERROR', "Database Error: " . $sth->errstr); + + my @showids; + while(my ($showid) = $sth->fetchrow_array()) { + push @showids, $showid; + } + $sth->finish(); + + return @showids; +} + sub create_show_group { my ($ctx, $groupname) = @_; diff --git a/utils/rhrd-sanity-check b/utils/rhrd-sanity-check index 6cfb2d7..13b2b45 100755 --- a/utils/rhrd-sanity-check +++ b/utils/rhrd-sanity-check @@ -281,9 +281,31 @@ sub check_showids my ($ctx) = @_; my $errors = 0, - print "logs:\n"; - print " ... checks not yet implemtned!!\n"; + print "showids:\n"; + + my @show_ids = RHRD::rddb::list_showids($ctx); + if(!defined $show_ids[0] && defined $show_ids[1]) { + print STDERR "$show_ids[1]: $show_ids[2]"; + return -1; + } + for my $show_id (@show_ids) { + my @carts = RHRD::rddb::get_show_carts($ctx, $show_id); + if(!defined $carts[0] && defined $carts[1]) { + print " showid '" . $show_id . "': $carts[2]\n"; + $errors++; + } + if(scalar @carts == 0) { + print " showid '" . $show_id . "': has no log assigned or log is empty\n"; + $errors++; + } + my ($group, $status, $errorstring) = RHRD::rddb::get_show_group($ctx, $show_id); + unless(defined($group)) { + print " showid '" . $show_id . "': has no dropbox assigned\n"; + $errors++; + } else { + } + } print "\n " . $errors . " errors found\n"; return $errors; @@ -296,7 +318,6 @@ sub check_logs my $errors = 0, print "logs:\n"; - print " ... checks not yet implemtned!!\n"; print "\n " . $errors . " errors found\n"; @@ -306,13 +327,13 @@ sub check_logs my ($ctx, $status, $errorstring) = RHRD::rddb::init(); if(defined $ctx) { - check_groups($ctx); - print "\n"; - check_dropboxes($ctx); - print "\n"; check_showids($ctx); print "\n"; check_logs($ctx); + print "\n"; + check_groups($ctx); + print "\n"; + check_dropboxes($ctx); RHRD::rddb::destroy($ctx); } else { -- cgit v0.10.2