Extend reindex.pl so that if it's asked to set UDB in a record with no
databaseInfo, it makes that section. This can now be used to fix up
the 35 records in the master IRSpy database that still hgave no UDBs.
print " $i/$n (", int($i*100/$n), "%)\n" if $i % 50 == 0;
my $rec = $rs->record($i-1);
my $xml = $rec->render();
print " $i/$n (", int($i*100/$n), "%)\n" if $i % 50 == 0;
my $rec = $rs->record($i-1);
my $xml = $rec->render();
- if ($xml !~ /<(e:)?databaseInfo.*?>/) {
- # There is an undeletable phantom record: ignore it
- next;
- }
- my $udb = qq[<i:udb xmlns:i="http://indexdata.com/irspy/1.0">irspy-$i</i:udb>];
- $xml =~ s/<(e:)?databaseInfo.*?>/$&$udb/;
+ my $udb;
+ if ($xml !~ /<(e:)?databaseInfo.*?>/) {
+ $udb = qq[<i:udb xmlns:i="http://indexdata.com/irspy/1.0">irspy-a$i</i:udb>];
+ $xml =~ s/\/serverInfo>/$&<databaseInfo>$udb<\/databaseInfo>/;
+ print "x";
+ } else {
+ $udb = qq[<i:udb xmlns:i="http://indexdata.com/irspy/1.0">irspy-$i</i:udb>];
+ $xml =~ s/<(e:)?databaseInfo.*?>/$&$udb/;
+ }