onepaperlink: fix handling of multiple changes

This change removes two recently added hooks. No deprecation cycle
because they have only existed for a week, so it's extremely unlikely
that anyone's using them.
This commit is contained in:
Juerd Waalboer 2025-01-05 00:19:27 +01:00
parent 614c612ec9
commit e16d76b758
3 changed files with 31 additions and 32 deletions

View file

@ -183,6 +183,8 @@ sub read_products($filename = "revbank.products", $default_contra = "+sales/prod
$product->{total_price} = $tag_price + $hidden;
}
my @changes;
if (%$cache) {
for my $new (values %products) {
next if $new->{is_alias};
@ -190,16 +192,19 @@ sub read_products($filename = "revbank.products", $default_contra = "+sales/prod
my $id = $new->{id};
my $old = $cache->{$id};
call_hooks("product_changed", $old, $new, $$mtime)
if not defined $old or $new->{config} ne $old->{config};
if (not defined $old or $new->{config} ne $old->{config}) {
push @changes, [$old, $new];
}
delete $cache->{$id};
}
for my $p (values %$cache) {
next if $p->{is_alias};
call_hooks("product_deleted", $p, $$mtime);
push @changes, [$p, undef];
}
call_hooks("products_changed", \@changes, $$mtime);
}
%$cache = %products;