Skip to content

Instantly share code, notes, and snippets.

@jesusbagpuss
jesusbagpuss / delete_user
Created Mar 24, 2022
Script to delete EPrint users
View delete_user
#!/usr/bin/perl -w
# NB This file is designed to be saved as [EPRINTS_ROOT]/bin/local/delete_user
# If you want to save it elsewhere, the 'FindBin' on line 52 may need altering.
=pod
=head1 NAME
B<delete_user> - Removes an EPrints user account
@jesusbagpuss
jesusbagpuss / z_url_rewrite_redir.pl
Last active Mar 14, 2022
EPrints redirect specific URLs
View z_url_rewrite_redir.pl
use EPrints::Const;
my %rewrite_map = (
123 => 'https://other.site/321',
456 => 'https://else.where/stuff-999',
);
$c->add_trigger( EP_TRIGGER_URL_REWRITE, sub {
my( %o ) = @_;
View csl-data.json
{
"type": "thesis",
"title": "This is a test thesis",
"publisher": "University of Leeds",
"publisher-place": "Leeds, UK",
"genre": "Doctoral thesis",
"source": "test.repository.leeds.ac.uk",
"abstract": "The abstract of the thesis.",
"URL": "https://test.repository.leeds.ac.uk/123456/",
"language": "en",
@jesusbagpuss
jesusbagpuss / WRRecaptcha.pm
Created Sep 15, 2021
EPrints - using Recaptcha.net
View WRRecaptcha.pm
package EPrints::Plugin::WRRecaptcha;
use strict;
our @ISA = qw/ EPrints::Plugin /;
######################################################################
#
# Use recaptcha.net instead of Google, so people in China can add their stuff
#
######################################################################
#
@jesusbagpuss
jesusbagpuss / z_epscript_additions.pl
Created May 20, 2021
Custom EPScript additions - render specific contributor type
View z_epscript_additions.pl
# Open block
{
# Write into EPrints::Script::Compiled
package EPrints::Script::Compiled;
use strict;
# Example usage in citation file:
#
@jesusbagpuss
jesusbagpuss / zz_export_item_issues.pl
Last active Jul 30, 2020
Possible fix for eprint item_issues not being exported in v3.4
View zz_export_item_issues.pl
# this is the block from EPrints::DataObj::EPrint, but with:
# export_as_xml => 1
# and
# replace_core => 1 (to overwrite the default field)
push @{ $c->{fields}->{eprint} },
{ name=>"item_issues", type=>"compound", multiple=>1,
fields => [
{
sub_name => "id",
@jesusbagpuss
jesusbagpuss / eprints_to_reindex
Created Feb 18, 2020
Find EPrints which have a non-public document who's indexcodes have been added to the full-text index
View eprints_to_reindex
#!/usr/bin/perl -w
### SAVE FILE TO ~/bin/local/eprints_to_reindex, or edit the FindBin path below according to where you've saved it.
use FindBin;
use lib "$FindBin::Bin/../../perl_lib";
use EPrints;
use strict;
@jesusbagpuss
jesusbagpuss / get_user_preference_screen_items_ep_status
Created Jul 23, 2019
EPrints User preference for Screen::Items/eprint_status (file to be saved in EPRINTS_ROOT/bin/local/)
View get_user_preference_screen_items_ep_status
#!/usr/bin/perl -w
# Usage: ~/bin/local/get_user_preferences ARCHIVEID USERID
# NOTE: If you save this to a location other that EPRINTS_ROOT/bin/local/ the 'use lib' statement
# below will need to be adjusted accordingly
use FindBin;
use lib "$FindBin::Bin/../../perl_lib";
@jesusbagpuss
jesusbagpuss / z_wrro_epscript_additions.pl
Created May 16, 2019
EPScript to limit authors in citation
View z_wrro_epscript_additions.pl
{
package EPrints::Script::Compiled;
use strict;
sub run_wrro_people_limited
{
my( $self, $state, $value, $limit ) = @_;
my $session = $state->{session};
@jesusbagpuss
jesusbagpuss / README
Created May 16, 2019
Symplectic merge items fix for mangled documents
View README
################################################################################
#
# This fix was submitted to Symplectic April 2018
# As yet they haven't made a new release of the connector with it included :o\
#
#
# The changes below consist of:
# - new method in Symplectic::RepoProcess::MergeManager
# - replace two method calls with calls to the new method
#