/ /home/httpd/lonUsers my $cleanup; if (-e '/etc/loncapa-release') { 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+$/) { my $previous = $1; unless ($previous eq 'CVS_HEAD') { my ($major,$minor) = ($previous =~ /^(\d+)\.(\d+)\./); if (($major ne '') && ($minor ne '')) { if (($major == 2) && ($minor < 10)) { $docleanup = 1; } } } } close(PIPE); } } if ($docleanup) { print "\nCleaning up file_permissions.db\n"; my $logfile = '/tmp/clean_file_permissions_log.txt'; # get a list of all user directories print "Getting directory listing.\n"; my @dirs=`find -type d `; my @userdirs=grep(m|/[^/]*/[^/]*/[^/]*/[^/]*/[^/]*/[^/]*/[^/]*/[^/]*|, @dirs); my $count = 0; my $countby = 100; print "Updating ".scalar(@userdirs)." files.\n"; my $char_count=0; foreach my $udir (@userdirs) { if (++$count % $countby == 0) { print("\b" x $char_count); print($count."/".scalar(@userdirs)); $char_count = length($count."/".scalar(@userdirs)); } chomp($udir); my $file = $udir.'/file_permissions.db'; next if (! -e $file); system('/home/httpd/perl/debug/clean_db.pl '.$file. ' "error%3a%202%20tie%28GDBM%29%20Failed%20while%20attempting%20dump" 2>>'.$logfile); } print("\b" x $char_count); print($count."/".scalar(@userdirs)); print "\nCompleted!\n"; } else { print("Clean up of file_permissions.db files not required.\n"); }