Koha-clms/misc/maintenance
Tomas Cohen Arazi 3669cb0eed
Bug 36365: Add a way for compare_es_to_db.pl to fix problems
This patch adds a new option switch `--fix` (or `-f`) to make the script
try to fix the problems it found.

Bonus: `--help` option switch added.

To test:
1. Apply this patch
2. Run:
   $ ktd --shell
  k$ perl -MKoha::SearchEngine -MKoha::SearchEngine::Indexer -e 'my $i = Koha::SearchEngine::Indexer->new({index => $Koha::SearchEngine::BIBLIOS_INDEX}); $i->delete_index([1]);'
=> SUCCESS: Bibliographic record #deleted from ES index
3. Run:
  k$ koha-mysql kohadev
   > DELETE FROM biblio WHERE biblionumber=2 OR biblionumber=3;
=> SUCCESS: Bibliographic records 2 and 3 deleted directly from the
database, no reindex triggered by Koha.
4. Run:
  k$ perl misc/maintenance/compare_es_to_db.pl
=> SUCCESS: The results from (2) and (3) are explained. [1]
5. Run:
  k$ perl misc/maintenance/compare_es_to_db.pl --fix
=> SUCCESS: It says it is gonna fix things
6. Repeat 4
=> SUCCESS: The problems we generated are no longer reported! They've
been fixed!
7. Sign off :-D

[1] Note KTD ships some broken records on purpose so devs need to deal
with a not-perfect DB everyday, and catch misses in the code.

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Signed-off-by: Thomas Klausner <domm@plix.at>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
2025-04-14 08:51:16 +02:00
..
UNIMARC_fix_collectiontitle.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
UNIMARC_sync_date_created_with_marc_biblio.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
acq_cancel_obsolete_orders.pl Bug 36068: (QA follow-up) Add OPTIONS section in POD 2024-04-19 18:06:31 +02:00
audit_database.pl Bug 36039: (QA follow-up): Improve audit messages 2024-12-27 15:19:05 +01:00
auth_show_hidden_data.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
borrowers-force-messaging-defaults.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
check_syspref_cache.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
check_sysprefs.sh
…
cmp_sysprefs.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
compare_es_to_db.pl Bug 36365: Add a way for compare_es_to_db.pl to fix problems 2025-04-14 08:51:16 +02:00
dedup_authorities.pl Bug 13706: Minor tidy/spelling issues 2024-04-26 14:14:54 +02:00
fix_accountlines_date.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
fix_accountlines_rmdupfines_bug8253.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
fix_invalid_dates.pl Bug 38857: Update cronjobs to log run before processing parameters 2025-01-10 19:19:23 +01:00
fix_mysql_constraints.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
fix_tags_weight.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
generate_MARC21Languages.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
make_zebra_dom_cfg_from_record_abs Bug 22600: Set 'commandline' interface appropriately 2019-04-10 19:43:11 +00:00
process_record_through_filter.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
pseudonymize_statistics.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
remove_items_from_biblioitems.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
sanitize_records.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
search_for_data_inconsistencies.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
sync_db_comments.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
touch_all_biblios.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
touch_all_items.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
update_authorities.pl Bug 38664: Tidy the whole codebase 2025-02-11 14:58:24 +01:00
update_localuse_from_statistics.pl Bug 37790: Add skip indexing and holds queue options and verbosity to update localuse script 2024-11-18 17:04:32 +01:00