=cut
@@ -795,8 +809,7 @@ sub publish {
my %allow=();
unless ($logfile=Apache::File->new('>>'.$source.'.log')) {
- return
- 'No write permission to user directory, FAIL';
+ return ('No write permission to user directory, FAIL',1);
}
print $logfile
"\n\n================= Publish ".localtime()." Phase One ================\n";
@@ -810,12 +823,14 @@ sub publish {
print $logfile "Copied original file to ".$copyfile."\n";
} else {
print $logfile "Unable to write backup ".$copyfile.':'.$!."\n";
- return "Failed to write backup copy, $!,FAIL";
+ return ("Failed to write backup copy, $!,FAIL",1);
}
# ------------------------------------------------------------- IDs and indices
- my $outstring;
- ($outstring,%allow)=&fix_ids_and_indices($logfile,$source,$target);
+ my ($outstring,$error);
+ ($outstring,$error,%allow)=&fix_ids_and_indices($logfile,$source,
+ $target);
+ if ($error) { return ($outstring,$error); }
# ------------------------------------------------------------ Construct Allows
$scrout.='Dependencies
';
@@ -860,9 +875,8 @@ sub publish {
my $org;
unless ($org=Apache::File->new('>'.$source)) {
print $logfile "No write permit to $source\n";
- return
- 'No write permission to '.$source.
- ', FAIL';
+ return ('No write permission to '.$source.
+ ', FAIL',1);
}
print($org $outstring);
}
@@ -943,90 +957,87 @@ sub publish {
}
# ---------------- Find and document discrepancies in the parameters and stores
- my $chparms='';
- foreach (sort keys %metadatafields) {
- if (($_=~/^parameter/) || ($_=~/^stores/)) {
- unless ($_=~/\.\w+$/) {
- unless ($oldparmstores{$_}) {
- print $logfile 'New: '.$_."\n";
- $chparms.=$_.' ';
- }
- }
- }
- }
- if ($chparms) {
- $scrout.='New parameters or stored values: '.
- $chparms;
- }
+ my $chparms='';
+ foreach (sort keys %metadatafields) {
+ if (($_=~/^parameter/) || ($_=~/^stores/)) {
+ unless ($_=~/\.\w+$/) {
+ unless ($oldparmstores{$_}) {
+ print $logfile 'New: '.$_."\n";
+ $chparms.=$_.' ';
+ }
+ }
+ }
+ }
+ if ($chparms) {
+ $scrout.='
New parameters or stored values: '.$chparms;
+ }
- $chparms='';
- foreach (sort keys %oldparmstores) {
- if (($_=~/^parameter/) || ($_=~/^stores/)) {
- unless (($metadatafields{$_.'.name'}) ||
- ($metadatafields{$_.'.package'}) || ($_=~/\.\w+$/)) {
- print $logfile 'Obsolete: '.$_."\n";
- $chparms.=$_.' ';
- }
- }
- }
- if ($chparms) {
- $scrout.='
Obsolete parameters or stored values: '.
- $chparms;
- }
+ $chparms='';
+ foreach (sort keys %oldparmstores) {
+ if (($_=~/^parameter/) || ($_=~/^stores/)) {
+ unless (($metadatafields{$_.'.name'}) ||
+ ($metadatafields{$_.'.package'}) || ($_=~/\.\w+$/)) {
+ print $logfile 'Obsolete: '.$_."\n";
+ $chparms.=$_.' ';
+ }
+ }
+ }
+ if ($chparms) {
+ $scrout.='
Obsolete parameters or stored values: '.
+ $chparms;
+ }
# ------------------------------------------------------- Now have all metadata
- my %keywords=();
+ my %keywords=();
- if (length($content)<500000) {
- my $textonly=$content;
- $textonly=~s/\