version 1.1, 2006/06/27 18:06:41
|
version 1.3, 2006/06/29 07:42:46
|
Line 10 use MPIWGStor;
|
Line 10 use MPIWGStor;
|
$|=1; |
$|=1; |
|
|
# program version |
# program version |
my $version = "0.1 (27.6.2006 ROC)"; |
my $version = "0.2 (27.6.2006 ROC)"; |
my $help = |
my $help = |
"use: checkmeta [options] dir |
"use: changemeta [options] dir |
options: |
options: |
-debug show debugging info |
-debug show debugging info |
-dry-run simulate, dont'do anything |
-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"); |
logger("INFO", "changemeta $version"); |
|
|
|
|
####################################################### |
####################################################### |
Line 81 sub change_access {
|
Line 81 sub change_access {
|
my $parent_tag = $index_root->findnodes('//meta/access-conditions')->get_node(1); |
my $parent_tag = $index_root->findnodes('//meta/access-conditions')->get_node(1); |
if ($parent_tag) { |
if ($parent_tag) { |
my $access_tag = $parent_tag->findnodes('access')->get_node(1); |
my $access_tag = $parent_tag->findnodes('access')->get_node(1); |
|
# remove access tag if it exists |
if ($access_tag) { |
if ($access_tag) { |
$parent_tag->removeChild($access_tag); |
$parent_tag->removeChild($access_tag); |
} |
} |
Line 88 sub change_access {
|
Line 89 sub change_access {
|
$parent_tag = create_element_path('meta/access-conditions', $index_root, $namespace); |
$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") { |
if ($access_type eq "free") { |
create_element_path('access@type=free', $parent_tag, $namespace); |
create_element_path('access@type=free', $parent_tag, $namespace); |
} elsif (length $access_type > 0) { |
} elsif (length $access_type > 0) { |
Line 119 if (-f "$docdir/index.meta") {
|
Line 121 if (-f "$docdir/index.meta") {
|
} |
} |
|
|
if ($access_type) { |
if ($access_type) { |
change_access($index_root); |
change_access($access_type, $index_root); |
} |
} |
|
|
|
|
Line 134 if ($errcnt > 0) {
|
Line 136 if ($errcnt > 0) {
|
logger('DEBUG', "would write $docdir/index.meta"); |
logger('DEBUG', "would write $docdir/index.meta"); |
logger('DEBUG', $index_doc->toString(1)); |
logger('DEBUG', $index_doc->toString(1)); |
} else { |
} else { |
#write_xml($index_doc, "$docdir/index.meta"); |
write_xml($index_doc, "$docdir/index.meta"); |
} |
} |
logger("DONE", "changed index file successfully!"); |
logger("DONE", "changed index file successfully!"); |
} else { |
} else { |