--- loncom/configuration/Checksumming.pm 2013/02/04 15:05:23 1.3 +++ loncom/configuration/Checksumming.pm 2017/06/30 14:53:39 1.8 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Checksum installed LON-CAPA modules and some configuration files # -# $Id: Checksumming.pm,v 1.3 2013/02/04 15:05:23 raeburn Exp $ +# $Id: Checksumming.pm,v 1.8 2017/06/30 14:53:39 raeburn Exp $ # # The LearningOnline Network with CAPA # @@ -34,6 +34,7 @@ use strict; use lib '/home/httpd/lib/perl/'; use Apache::lonlocal(); use Apache::loncommon(); +use Digest::SHA; sub get_checksums { my ($distro,$londaemons,$lonlib,$lonincludes,$lontabdir) = @_; @@ -62,12 +63,8 @@ sub get_checksums { } push(@paths,('/home/httpd/cgi-bin/*.pl','/home/httpd/cgi-bin/*.png')); my $confdir = '/etc/httpd/conf'; - my $sha = 'SHA1'; if ($distro =~ /^(ubuntu|debian)(\d+)$/) { $confdir = '/etc/apache2'; - if (($1 eq 'ubuntu') && ($2 >= 12)) { - $sha = 'SHA'; - } } elsif ($distro =~ /^sles(\d+)$/) { if ($1 >= 10) { $confdir = '/etc/apache2'; @@ -78,14 +75,12 @@ sub get_checksums { } } push(@paths,("$confdir/loncapa_apache.conf","$confdir/startup.pl")); - if ($sha eq 'SHA1') { - require Digest::SHA1; - } else { - require Digest::SHA; + if ($lontabdir) { + push(@paths,$lontabdir.'/mydesk.tab'); } if (@paths) { my $pathstr = join (' ',@paths); - if (open($dirh,"grep '$revtag' $pathstr |")) { + if (open($dirh,"grep '$revtag' $pathstr 2>&1 |")) { while (my $line=<$dirh>) { if ($line =~ m{^([^#]+):#\s\\s[\w.]+,v\s([\d.]+)\s}) { $versions{$1} = $2; @@ -98,12 +93,7 @@ sub get_checksums { my $sum; if (open(my $fh,"<$key")) { binmode $fh; - my $sha_obj; - if ($sha eq 'SHA') { - $sha_obj = Digest::SHA->new(); - } else { - $sha_obj = Digest::SHA1->new(); - } + my $sha_obj = Digest::SHA->new(); $sha_obj->addfile($fh); $sum = $sha_obj->hexdigest; close($fh); @@ -130,6 +120,9 @@ sub compare_checksums { } else { $linefeed = "\n"; } + if (!$Apache::lonlocal::lh) { + &Apache::lonlocal::get_language_handle(); + } if ((ref($serversums) eq 'HASH') && (keys(%{$serversums}))) { my $checksums = &Apache::lonnet::fetch_dns_checksums(); my (%extra,%missing,%diffs,%stdsums,%stdversions); @@ -148,8 +141,10 @@ sub compare_checksums { $numchg ++; } } else { - $missing{$key} = 1; - $numchg ++; + unless ((-e $key) && (-B $key)) { + $missing{$key} = 1; + $numchg ++; + } } } foreach my $key (keys(%{$serversums})) { @@ -272,7 +267,8 @@ sub compare_checksums { foreach my $file (sort(keys(%missing))) { my $revnum = $stdversions{$file}; if ($target eq 'web') { - $message .= ''.$file.''."\n". + $message .= &Apache::loncommon::start_data_table_row()."\n". + ''.$file.''."\n". ''.$revnum.''."\n". &Apache::loncommon::end_data_table_row()."\n"; } else { @@ -308,7 +304,8 @@ sub compare_checksums { } foreach my $file (sort(keys(%extra))) { if ($target eq 'web') { - $message .= ''.$file.''."\n". + $message .= &Apache::loncommon::start_data_table_row()."\n". + ''.$file.''."\n". ''.$serverversions->{$file}.''."\n". &Apache::loncommon::end_data_table_row()."\n"; } else {