From 874908d81350cd9048e934b14416a0498df76cff Mon Sep 17 00:00:00 2001 From: wr2f25 Date: Mon, 15 Sep 2025 08:29:06 +0000 Subject: [PATCH] Insert 'epm:' text via triggers rather than in core For eprints/eprints3.5#219 we are adding a trigger to the bottom of `cgi/counter` (`EP_TRIGGER_CGI_COUNTER`) so bazaar can use this rather than its old hardcoded core section of `cgi/counter`. This acts the same as it did previously in `cgi/counter` with some extra hassle on the start and end to deal with `content` being a string-ref. NB: This won't work until the related core PR is merged (eprints/eprints3.5#220). --- cfg.d/epm.pl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/cfg.d/epm.pl b/cfg.d/epm.pl index e66a735..1c2caff 100644 --- a/cfg.d/epm.pl +++ b/cfg.d/epm.pl @@ -18,6 +18,27 @@ base_url => "https://bazaar.eprints.org", }; +$c->add_trigger(EP_TRIGGER_CGI_COUNTER, sub { + my( %params ) = @_; + my $repo = $params{repository}; + my $content = ${$params{content}}; + + if( $repo->dataset( 'epm' ) ) { + $content .= "epm: "; + my $first = 1; + $repo->dataset( 'epm' )->dataobj_class->map($repo, sub + { + my( undef, undef, $epm ) = @_; + $content .= "; " if !$first; + $first = 0; + $content .= $epm->value( "epmid" ) . "=" . $epm->value( "version" ); + }); + $content .= "\n"; + } + + ${$params{content}} = $content; +}); + =head1 COPYRIGHT =for COPYRIGHT BEGIN