--- foxridge-archiver/changemeta.pl 2006/06/27 18:06:41 1.1 +++ foxridge-archiver/changemeta.pl 2006/06/27 18:18:05 1.2 @@ -10,13 +10,13 @@ use MPIWGStor; $|=1; # program version -my $version = "0.1 (27.6.2006 ROC)"; +my $version = "0.2 (27.6.2006 ROC)"; my $help = "use: checkmeta [options] dir options: -debug show debugging info -dry-run simulate, dont'do anything - -access=free adds free access tag (use access=mpiwg for restricted access) + -access=free set free access tag (use access=mpiwg for restricted access) "; logger("INFO", "checkmeta $version"); @@ -81,6 +81,7 @@ sub change_access { my $parent_tag = $index_root->findnodes('//meta/access-conditions')->get_node(1); if ($parent_tag) { my $access_tag = $parent_tag->findnodes('access')->get_node(1); + # remove access tag if it exists if ($access_tag) { $parent_tag->removeChild($access_tag); } @@ -88,6 +89,7 @@ sub change_access { $parent_tag = create_element_path('meta/access-conditions', $index_root, $namespace); } + # add new access tag (if $access_Type is not empty) if ($access_type eq "free") { create_element_path('access@type=free', $parent_tag, $namespace); } elsif (length $access_type > 0) { @@ -119,7 +121,7 @@ if (-f "$docdir/index.meta") { } if ($access_type) { - change_access($index_root); + change_access($access_type, $index_root); } @@ -134,7 +136,7 @@ if ($errcnt > 0) { logger('DEBUG', "would write $docdir/index.meta"); logger('DEBUG', $index_doc->toString(1)); } else { - #write_xml($index_doc, "$docdir/index.meta"); + write_xml($index_doc, "$docdir/index.meta"); } logger("DONE", "changed index file successfully!"); } else {