https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43029

            Bug ID: 43029
           Summary: Guard maintenance scripts against biblios with corrupt
                    metadata
   Initiative type: ---
        Sponsorship ---
            status:
           Product: Koha
           Version: Main
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Tools
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
        Depends on: 35104
  Target Milestone: ---

Bug 35104 makes Koha::Biblio::Metadata->record()/store() throw
Koha::Exceptions::Metadata::Invalid for a record whose MARCXML cannot
be decoded. misc/maintenance/sanitize_records.pl and
misc/maintenance/touch_all_biblios.pl both read a biblio's metadata
record and unconditionally re-save it across every biblio in the
database, so a single already-corrupt record (which could exist from
before bug 35104, or from a source outside Koha's own validation)
would abort the whole run.

This patch wraps the read (and, for touch_all_biblios.pl, the
resulting ModBiblio) so one such biblio is skipped and reported rather
than aborting the whole maintenance run.

Depends on bug 35104.

Test plan:
1. Apply this patch on top of bug 35104.
2. Create a biblio with metadata that is already corrupt, bypassing
   Koha::Biblio::Metadata's validation (e.g. write invalid MARCXML
   directly to the biblio_metadata row via the DBIC schema result, not
   through ->store()), alongside several normal biblios.
3. Run misc/maintenance/sanitize_records.pl --verbose across all
   biblios. Confirm the corrupt one is skipped with a clear
   "ERROR: Invalid record" message and the script completes for every
   other biblio without dying.
4. Run misc/maintenance/touch_all_biblios.pl similarly. Confirm the
   corrupt record is counted/logged as an error and the other records
   are still touched successfully.


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35104
[Bug 35104] We should warn when attempting to save MARC records that contain
characters invalid in XML
-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to