projects
/
irspy-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add $deleteXPath and useful sample command-line.
[irspy-moved-to-github.git]
/
bin
/
irspy-delete-broken-records.pl
diff --git
a/bin/irspy-delete-broken-records.pl
b/bin/irspy-delete-broken-records.pl
index
38d772a
..
f6d5a67
100755
(executable)
--- a/
bin/irspy-delete-broken-records.pl
+++ b/
bin/irspy-delete-broken-records.pl
@@
-1,6
+1,6
@@
#!/opt/local/bin/perl
#
#!/opt/local/bin/perl
#
-# ./irspy-delete-broken-records.pl user=admin,password=fruitbat,localhost:8018/IR-Explain---1 'concat(count(irspy:status/irspy:probe[@ok=1]), "/", count(irspy:status/irspy:probe))'
+# ./irspy-delete-broken-records.pl user=admin,password=fruitbat,localhost:8018/IR-Explain---1 'concat(count(irspy:status/irspy:probe[@ok=1]), "/", count(irspy:status/irspy:probe))' 'count(irspy:status/irspy:probe[@ok=1]) = 0 and count(irspy:status/irspy:probe) >= 10'
use lib '../lib';
use XML::LibXML;
use lib '../lib';
use XML::LibXML;
@@
-8,8
+8,8
@@
use ZOOM;
use strict;
use warnings;
use strict;
use warnings;
-die "Usage: $0 <database> <xpath>\n" if @ARGV != 2;
-my($dbname, $xpath) = @ARGV;
+die "Usage: $0 <database> <displayXPath> <deleteXPath>\n" if @ARGV != 3;
+my($dbname, $displayXPath, $deleteXPath) = @ARGV;
my $libxml = new XML::LibXML;
my $conn = new ZOOM::Connection($dbname);
my $libxml = new XML::LibXML;
my $conn = new ZOOM::Connection($dbname);
@@
-23,6
+23,9
@@
foreach my $i (1 .. $n) {
my $xc = XML::LibXML::XPathContext->new($rec);
$xc->registerNs(zeerex => "http://explain.z3950.org/dtd/2.0/");
$xc->registerNs(irspy => "http://indexdata.com/irspy/1.0");
my $xc = XML::LibXML::XPathContext->new($rec);
$xc->registerNs(zeerex => "http://explain.z3950.org/dtd/2.0/");
$xc->registerNs(irspy => "http://indexdata.com/irspy/1.0");
- my $val = $xc->findvalue($xpath);
- print "Record $i/$n: $val\n";
+ my $val = $xc->findvalue($displayXPath);
+ print "Record $i/$n: $val";
+ $val = $xc->findvalue($deleteXPath);
+ print " DELETE" if $val eq "true";
+ print "\n";
}
}