--- loncom/publisher/lonpublisher.pm 2008/08/27 13:07:41 1.247 +++ loncom/publisher/lonpublisher.pm 2009/11/24 01:01:28 1.249.2.3 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Publication Handler # -# $Id: lonpublisher.pm,v 1.247 2008/08/27 13:07:41 raeburn Exp $ +# $Id: lonpublisher.pm,v 1.249.2.3 2009/11/24 01:01:28 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -695,6 +695,7 @@ sub fix_ids_and_indices { $responsecounter=0; } if ($lctag=~/response$/) { $responsecounter++; } + if ($lctag eq 'import') { $responsecounter++; } my %parms=%{$token->[2]}; $counter=$addid{$tag}; if (!$counter) { $counter=$addid{$lctag}; } @@ -873,7 +874,7 @@ sub store_metadata { } if (defined($status) && $status ne '') { $error='' - .&mt('Error occured saving new values in metadata table in LON-CAPA database!') + .&mt('Error occurred saving new values in metadata table in LON-CAPA database!') .''; &Apache::lonnet::logthis($error); &Apache::lonnet::logthis($status); @@ -947,7 +948,7 @@ backup copies, performs any automatic pr especially for rat and ssi files), Returns a 2 element array, the first is the string to be shown to the -user, the second is an error code, either 1 (an error occured) or 0 +user, the second is an error code, either 1 (an error occurred) or 0 (no error occurred) I @@ -1639,7 +1640,8 @@ sub phasetwo { my $srcf=$2; my $srct=$3; my $srcd=$1; - unless ($srcd=~/^\/home\/httpd\/html\/res/) { + my $docroot = $Apache::lonnet::perlvar{'lonDocRoot'}; + unless ($srcd=~/^\Q$docroot\E\/res/) { print $logfile "\nPANIC: Target dir is ".$srcd; $r->print( "".&mt('Invalid target directory, FAIL').""); @@ -1651,7 +1653,7 @@ sub phasetwo { unlink($srcd.'/'.$filename); unlink($srcd.'/'.$filename.'.meta'); } else { - if ($filename=~/\Q$srcf\E\.(\d+)\.\Q$srct\E$/) { + if ($filename=~/^\Q$srcf\E\.(\d+)\.\Q$srct\E$/) { $maxversion=($1>$maxversion)?$1:$maxversion; } } @@ -1740,7 +1742,8 @@ sub phasetwo { # ------------------------------------------------------------- Trigger updates push(@{$modified_urls},[$target,$source]); unless ($registered_cleanup) { - $r->register_cleanup(\¬ify); + my $handlers = $r->get_handlers('PerlCleanupHandler'); + $r->set_handlers('PerlCleanupHandler' => [\¬ify,@{$handlers}]); $registered_cleanup=1; }