Changeset 10417
- Timestamp:
- 2005-08-04T15:25:24+12:00 (19 years ago)
- Location:
- trunk/gsdl/bin/script
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/bin/script/buildcol.pl
r10349 r10417 41 41 use colcfg; 42 42 use util; 43 use scriptutil; 43 44 use FileHandle; 44 45 use gsprintf; … … 109 110 'reqd' => "no", 110 111 'modegli' => "3" }, 112 { 'name' => "removeold", 113 'desc' => "{import.removeold}", 114 'type' => "flag", 115 'reqd' => "no", 116 'modegli' => "3" }, 111 117 { 'name' => "keepold", 112 118 'desc' => "{buildcol.keepold}", … … 189 195 # command line args 190 196 my ($verbosity, $archivedir, $cachedir, $builddir, $maxdocs, 191 $debug, $mode, $indexname, $ keepold, $remove_empty_classifications,197 $debug, $mode, $indexname, $removeold, $keepold, $remove_empty_classifications, 192 198 $create_images, $collectdir, $build, $type, $textindex, 193 199 $no_strip_html, $no_text, $faillog, $gli, $index, $language); … … 327 333 } 328 334 } 329 if (defined $collectcfg->{'keepold'} && $collectcfg->{'keepold'} =~ /^true$/i) { 330 $keepold = 1; 331 } 335 332 336 if (defined $collectcfg->{'create_images'} && $collectcfg->{'create_images'} =~ /^true$/i) { 333 337 $create_images = 1; … … 344 348 } 345 349 350 ($removeold, $keepold) = &scriptutil::check_removeold_and_keepold($removeold, $keepold, "building", $collectcfg); 351 346 352 $gli = 0 unless defined $gli; 347 353 -
trunk/gsdl/bin/script/export.pl
r10340 r10417 50 50 use docprint; 51 51 use util; 52 use scriptutil; 52 53 use FileHandle; 53 54 use gsprintf; … … 225 226 my $explicit_exportdir = (defined $exportdir) ? 1 : 0; 226 227 228 # save these command line settings. don't want config file settings in one 229 # coll used for other colls 230 # does this apply to other vars??? 231 my $global_removeold = $removeold; 232 my $global_keepold = $keepold; 227 233 # If $language has been specified, load the appropriate resource bundle 228 234 # (Otherwise, the default resource bundle will be loaded automatically) … … 263 269 $out->autoflush(1); 264 270 265 # set removeold to false if it has been defined266 $removeold = 0 if ($keepold);267 268 271 while (scalar(@ARGV)>0) { 269 272 my $collect_name = shift @ARGV; 270 271 273 $ENV{'GSDLCOLLECTION'} = $collect_name; 272 274 … … 308 310 309 311 $configfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc", "collect.cfg"); 310 if (-e $configfilename) { 311 my $collectcfg = &colcfg::read_collect_cfg ($configfilename); 312 if (defined $collectcfg->{'plugin'}) { 313 $plugins = $collectcfg->{'plugin'}; 314 } 315 316 if ($verbosity !~ /\d+/) { 317 if (defined $collectcfg->{'verbosity'} && $collectcfg->{'verbosity'} =~ /\d+/) { 318 $verbosity = $collectcfg->{'verbosity'}; 319 } else { 320 $verbosity = 2; # the default 321 } 322 } 323 if (defined $collectcfg->{'importdir'} && $importdir eq "") { 324 $importdir = $collectcfg->{'importdir'}; 325 } 326 if (defined $collectcfg->{'exportdir'} && $exportdir eq "") { 327 $exportdir = $collectcfg->{'exportdir'}; 328 } 329 if (defined $collectcfg->{'removeold'}) { 330 if ($collectcfg->{'removeold'} =~ /^true$/i && !$keepold) { 331 $removeold = 1; 332 } 333 if ($collectcfg->{'removeold'} =~ /^false$/i && !$removeold) { 334 $removeold = 0; 335 } 336 } 337 if (defined $collectcfg->{'keepold'}) { 338 if ($collectcfg->{'keepold'} =~ /^false$/i && !$keepold) { 339 $removeold = 1; 340 } 341 } 342 if (defined $collectcfg->{'gzip'} && !$gzip) { 343 if ($collectcfg->{'gzip'} =~ /^true$/i) { 344 $gzip = 1; 345 } 346 } 347 if ($maxdocs !~ /\-?\d+/) { 348 if (defined $collectcfg->{'maxdocs'} && $collectcfg->{'maxdocs'} =~ /\-?\d+/) { 349 $maxdocs = $collectcfg->{'maxdocs'}; 350 } else { 351 $maxdocs = -1; # the default 352 } 353 } 354 if ($groupsize == 1) { 355 if (defined $collectcfg->{'groupsize'} && $collectcfg->{'groupsize'} =~ /\d+/) { 356 $groupsize = $collectcfg->{'groupsize'}; 357 } 358 } 359 if (!defined $OIDtype || ($OIDtype !~ /^(hash|incremental)$/)) { 360 if (defined $collectcfg->{'OIDtype'} && $collectcfg->{'OIDtype'} =~ /^(hash|incremental)$/) { 361 $OIDtype = $collectcfg->{'OIDtype'}; 362 } else { 363 $OIDtype = "hash"; # the default 364 } 365 } 366 if (defined $collectcfg->{'sortmeta'} && $sortmeta eq "") { 367 $sortmeta = $collectcfg->{'sortmeta'}; 368 } 369 if (defined $collectcfg->{'debug'} && $collectcfg->{'debug'} =~ /^true$/i) { 370 $debug = 1; 371 } 372 if (defined $collectcfg->{'gli'} && $collectcfg->{'gli'} =~ /^true$/i) { 373 $gli = 1; 374 } 375 376 # global plugin stuff 377 if (defined $collectcfg->{'separate_cjk'}&& $collectcfg->{'separate_cjk'} =~ /^true$/i) { 378 push @global_opts, "-separate_cjk"; 379 } 380 } else { 312 if (!-e $configfilename) { 381 313 (&gsprintf($out, "{common.cannot_find_cfg_file}\n", $configfilename) && die); 382 314 } 383 315 316 my $collectcfg = &colcfg::read_collect_cfg ($configfilename); 317 if (defined $collectcfg->{'plugin'}) { 318 $plugins = $collectcfg->{'plugin'}; 319 } 320 321 if ($verbosity !~ /\d+/) { 322 if (defined $collectcfg->{'verbosity'} && $collectcfg->{'verbosity'} =~ /\d+/) { 323 $verbosity = $collectcfg->{'verbosity'}; 324 } else { 325 $verbosity = 2; # the default 326 } 327 } 328 if (defined $collectcfg->{'importdir'} && $importdir eq "") { 329 $importdir = $collectcfg->{'importdir'}; 330 } 331 if (defined $collectcfg->{'exportdir'} && $exportdir eq "") { 332 $exportdir = $collectcfg->{'exportdir'}; 333 } 334 335 if (defined $collectcfg->{'gzip'} && !$gzip) { 336 if ($collectcfg->{'gzip'} =~ /^true$/i) { 337 $gzip = 1; 338 } 339 } 340 if ($maxdocs !~ /\-?\d+/) { 341 if (defined $collectcfg->{'maxdocs'} && $collectcfg->{'maxdocs'} =~ /\-?\d+/) { 342 $maxdocs = $collectcfg->{'maxdocs'}; 343 } else { 344 $maxdocs = -1; # the default 345 } 346 } 347 if ($groupsize == 1) { 348 if (defined $collectcfg->{'groupsize'} && $collectcfg->{'groupsize'} =~ /\d+/) { 349 $groupsize = $collectcfg->{'groupsize'}; 350 } 351 } 352 if (!defined $OIDtype || ($OIDtype !~ /^(hash|incremental)$/)) { 353 if (defined $collectcfg->{'OIDtype'} && $collectcfg->{'OIDtype'} =~ /^(hash|incremental)$/) { 354 $OIDtype = $collectcfg->{'OIDtype'}; 355 } else { 356 $OIDtype = "hash"; # the default 357 } 358 } 359 if (defined $collectcfg->{'sortmeta'} && $sortmeta eq "") { 360 $sortmeta = $collectcfg->{'sortmeta'}; 361 } 362 if (defined $collectcfg->{'debug'} && $collectcfg->{'debug'} =~ /^true$/i) { 363 $debug = 1; 364 } 365 if (defined $collectcfg->{'gli'} && $collectcfg->{'gli'} =~ /^true$/i) { 366 $gli = 1; 367 } 368 369 # global plugin stuff 370 if (defined $collectcfg->{'separate_cjk'}&& $collectcfg->{'separate_cjk'} =~ /^true$/i) { 371 push @global_opts, "-separate_cjk"; 372 } 373 374 ($removeold, $keepold) = &scriptutil::check_removeold_and_keepold($global_removeold, $global_keepold, "export", $collectcfg); 375 384 376 $gli = 0 unless defined $gli; 385 377 -
trunk/gsdl/bin/script/import.pl
r10349 r10417 45 45 use docprint; 46 46 use util; 47 use scriptutil; 47 48 use FileHandle; 48 49 use gsprintf 'gsprintf'; … … 128 129 'reqd' => "no", 129 130 'hiddengli' => "yes" }, 131 { 'name' => "removeold", 132 'desc' => "{import.removeold}", 133 'type' => "flag", 134 'reqd' => "no", 135 'modegli' => "3" }, 130 136 { 'name' => "language", 131 137 'desc' => "{scripts.language}", … … 155 161 'reqd' => "no", 156 162 'hiddengli' => "yes" }, 157 { 'name' => "removeold",158 'desc' => "{import.removeold}",159 'type' => "flag",160 'reqd' => "no",161 'modegli' => "3" },162 163 { 'name' => "saveas", 163 164 'desc' => "{import.saveas}", … … 271 272 $out->autoflush(1); 272 273 273 # set removeold to false if it has been defined274 $removeold = 0 if ($keepold);275 276 274 # get and check the collection name 277 275 if (($collection = &util::use_collection(@ARGV, $collectdir)) eq "") { … … 311 309 312 310 $configfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc", "collect.cfg"); 313 if (-e $configfilename) { 314 $collectcfg = &colcfg::read_collect_cfg ($configfilename); 315 if (defined $collectcfg->{'plugin'}) { 316 $plugins = $collectcfg->{'plugin'}; 317 } 318 319 if ($verbosity !~ /\d+/) { 320 if (defined $collectcfg->{'verbosity'} && $collectcfg->{'verbosity'} =~ /\d+/) { 321 $verbosity = $collectcfg->{'verbosity'}; 322 } else { 323 $verbosity = 2; # the default 324 } 325 } 326 if (defined $collectcfg->{'importdir'} && $importdir eq "") { 327 $importdir = $collectcfg->{'importdir'}; 328 } 329 if (defined $collectcfg->{'archivedir'} && $archivedir eq "") { 330 $archivedir = $collectcfg->{'archivedir'}; 331 } 332 if (defined $collectcfg->{'removeold'}) { 333 if ($collectcfg->{'removeold'} =~ /^true$/i && !$keepold) { 334 $removeold = 1; 335 } 336 if ($collectcfg->{'removeold'} =~ /^false$/i && !$removeold) { 337 $removeold = 0; 338 } 339 } 340 if (defined $collectcfg->{'keepold'}) { 341 if ($collectcfg->{'keepold'} =~ /^false$/i && !$keepold) { 342 $removeold = 1; 343 } 344 } 345 if (defined $collectcfg->{'gzip'} && !$gzip) { 346 if ($collectcfg->{'gzip'} =~ /^true$/i) { 347 $gzip = 1; 348 } 349 } 350 if ($maxdocs !~ /\-?\d+/) { 351 if (defined $collectcfg->{'maxdocs'} && $collectcfg->{'maxdocs'} =~ /\-?\d+/) { 352 $maxdocs = $collectcfg->{'maxdocs'}; 353 } else { 354 $maxdocs = -1; # the default 355 } 356 } 357 if ($groupsize == 1) { 358 if (defined $collectcfg->{'groupsize'} && $collectcfg->{'groupsize'} =~ /\d+/) { 359 $groupsize = $collectcfg->{'groupsize'}; 360 } 361 } 362 if ($OIDtype !~ /^(hash|incremental|assigned|dirname)$/) { 363 if (defined $collectcfg->{'OIDtype'} && $collectcfg->{'OIDtype'} =~ /^(hash|incremental|assigned|dirname)$/) { 364 $OIDtype = $collectcfg->{'OIDtype'}; 365 } else { 366 $OIDtype = "hash"; # the default 367 } 368 } 369 if ($saveas !~ /^(GA|METS)$/) { 370 if (defined $collectcfg->{'saveas'} && $collectcfg->{'saveas'} =~ /^(GA|METS)$/) { 371 $saveas = $collectcfg->{'saveas'}; 372 } else { 373 $saveas ="GA"; 374 } 375 } 376 if (defined $collectcfg->{'sortmeta'} && (!defined$sortmeta || $sortmeta eq "")) { 377 $sortmeta = $collectcfg->{'sortmeta'}; 378 } 379 380 if (defined $collectcfg->{'removeprefix'} && $removeprefix eq "") { 381 $removeprefix = $collectcfg->{'removeprefix'}; 382 } 383 384 if (defined $collectcfg->{'removesuffix'} && $removesuffix eq "") { 385 $removesuffix = $collectcfg->{'removesuffix'}; 386 } 387 if (defined $collectcfg->{'debug'} && $collectcfg->{'debug'} =~ /^true$/i) { 388 $debug = 1; 389 } 390 if (defined $collectcfg->{'gli'} && $collectcfg->{'gli'} =~ /^true$/i) { 391 $gli = 1; 392 } 393 394 395 # global plugin stuff 396 if (defined $collectcfg->{'separate_cjk'} && $collectcfg->{'separate_cjk'} =~ /^true$/i) { 397 push @global_opts, "-separate_cjk"; 398 } 399 400 } else { 311 if (!-e $configfilename) { 401 312 (&gsprintf($out, "{common.cannot_find_cfg_file}\n", $configfilename) && die); 402 313 } 403 314 315 $collectcfg = &colcfg::read_collect_cfg ($configfilename); 316 if (defined $collectcfg->{'plugin'}) { 317 $plugins = $collectcfg->{'plugin'}; 318 } 319 320 if ($verbosity !~ /\d+/) { 321 if (defined $collectcfg->{'verbosity'} && $collectcfg->{'verbosity'} =~ /\d+/) { 322 $verbosity = $collectcfg->{'verbosity'}; 323 } else { 324 $verbosity = 2; # the default 325 } 326 } 327 if (defined $collectcfg->{'importdir'} && $importdir eq "") { 328 $importdir = $collectcfg->{'importdir'}; 329 } 330 if (defined $collectcfg->{'archivedir'} && $archivedir eq "") { 331 $archivedir = $collectcfg->{'archivedir'}; 332 } 333 334 if (defined $collectcfg->{'gzip'} && !$gzip) { 335 if ($collectcfg->{'gzip'} =~ /^true$/i) { 336 $gzip = 1; 337 } 338 } 339 if ($maxdocs !~ /\-?\d+/) { 340 if (defined $collectcfg->{'maxdocs'} && $collectcfg->{'maxdocs'} =~ /\-?\d+/) { 341 $maxdocs = $collectcfg->{'maxdocs'}; 342 } else { 343 $maxdocs = -1; # the default 344 } 345 } 346 if ($groupsize == 1) { 347 if (defined $collectcfg->{'groupsize'} && $collectcfg->{'groupsize'} =~ /\d+/) { 348 $groupsize = $collectcfg->{'groupsize'}; 349 } 350 } 351 if ($OIDtype !~ /^(hash|incremental|assigned|dirname)$/) { 352 if (defined $collectcfg->{'OIDtype'} && $collectcfg->{'OIDtype'} =~ /^(hash|incremental|assigned|dirname)$/) { 353 $OIDtype = $collectcfg->{'OIDtype'}; 354 } else { 355 $OIDtype = "hash"; # the default 356 } 357 } 358 if ($saveas !~ /^(GA|METS)$/) { 359 if (defined $collectcfg->{'saveas'} && $collectcfg->{'saveas'} =~ /^(GA|METS)$/) { 360 $saveas = $collectcfg->{'saveas'}; 361 } else { 362 $saveas ="GA"; 363 } 364 } 365 if (defined $collectcfg->{'sortmeta'} && (!defined $sortmeta || $sortmeta eq "")) { 366 $sortmeta = $collectcfg->{'sortmeta'}; 367 } 368 369 if (defined $collectcfg->{'removeprefix'} && $removeprefix eq "") { 370 $removeprefix = $collectcfg->{'removeprefix'}; 371 } 372 373 if (defined $collectcfg->{'removesuffix'} && $removesuffix eq "") { 374 $removesuffix = $collectcfg->{'removesuffix'}; 375 } 376 if (defined $collectcfg->{'debug'} && $collectcfg->{'debug'} =~ /^true$/i) { 377 $debug = 1; 378 } 379 if (defined $collectcfg->{'gli'} && $collectcfg->{'gli'} =~ /^true$/i) { 380 $gli = 1; 381 } 382 383 384 # global plugin stuff 385 if (defined $collectcfg->{'separate_cjk'} && $collectcfg->{'separate_cjk'} =~ /^true$/i) { 386 push @global_opts, "-separate_cjk"; 387 } 388 389 # check keepold and removeold 390 ($removeold, $keepold) = &scriptutil::check_removeold_and_keepold($removeold, $keepold, "archives", $collectcfg); 391 404 392 $gli = 0 unless defined $gli; 405 393
Note:
See TracChangeset
for help on using the changeset viewer.