EPrints Technical Mailing List Archive

Message: #05054


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

[EP-tech] Re: Plugins: enabled by default?


Already been in there… Looks like I might be hitting this:

https://github.com/eprints/eprints/issues/223

- which was fixed/merged in May 2014.

Can anyone with an install of 3.3.13/14 check this issue for me?

- and check it in a two-archive setup:

~/archives/a/

~/archives/b/

 

Cheers,

John

 

From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Adam Field
Sent: 02 November 2015 14:45
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Re: Plugins: enabled by default?

 

I agree with everything you've said.  My suggestion was more of a short-term thing.

 

Github issue?

 

--
Adam Field
Business Relationship Manager and Community Lead
EPrints Services

 

 

 

On 2 Nov 2015, at 13:51, John Salter <J.Salter@leeds.ac.uk> wrote:



> I would suggest disabling the plugin in its 'new' function

This isn’t a good option. When installing extensions from the Bazaar, people often forget to do this – which means installing anything on a multiple-archive setup is *dangerous*...

 

I’ve tried to trace the ‘disable’ param through EPrints::PluginFactory – but nothing looks out of place.

 

I’d suggest that this is a priority to get fixed in EPrints core.

 

Cheers,

John

 

 

From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Adam Field
Sent: 02 November 2015 13:22
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Re: Plugins: enabled by default?

 

Hi

 

            Yes, I've noticed this too, recently.  It used to be the case but doesn't seem to be any more.  I would suggest disabling the plugin in its 'new' function, and enabling it in the local configuration.  See http://bazaar.eprints.org/393/1/plugins/EPrints/Plugin/Export/Hello.pm and             http://bazaar.eprints.org/393/1/epm/hello_test/cfg/cfg.d/z_hello.pl (the bazaar package I wrote for a training video).

 

 

--
Adam Field
Business Relationship Manager and Community Lead
EPrints Services

 

 

 

On 2 Nov 2015, at 12:39, John Salter <J.Salter@leeds.ac.uk> wrote:




Hi,
Just trying to verify (or otherwise) my understanding of plugins and disabling/enabling them.
From: http://wiki.eprints.org/w/New_Features_in_EPrints_3.3#EPrints_Bazaar
"By default plugins installed in lib/plugins will be disabled and hence can be enabled on a per-repository basis."

On our test repository (3.3.10), we're not seeing this - things in ~/lib/plugins/... seem to be enabled for all archives.
This causes a problem when a plugin references a field that doesn't exist for a dataobj.

Can anyone verify that their install works as expected:
Is a plugin in ~/lib/plugins/... available without being specifically enabled in the archive's cfg.d?



From the code below, you can create two screen plugins:

PluginTestA:  should be disabled by default, but appears to be active when visiting: http://your_repo/cgi/users/home?screen=PluginTestA
PluginTestB: should also be disabled - and seems to work correctly: http://your_repo/cgi/users/home?screen=PluginTestB gives an error.

PluginTestA can be disabled by adding archive-level config (e.g. to ~/archives/ARCHIVEID/cfg/cfg.d/z_plugin_test.pl):
$c->{plugins}->{"Screen::PluginTestA"}->{params}->{disable} = 1;
but my understanding is that it should be disabled by default, and explicitly enabled when needed.

If you can test this, I'd appreciate it. Might be worth including the version of EPrints you're running too.
Cheers,
John


~/lib/plugins/EPrints/Plugin/Screen/PluginTestA.pm
####################################################################
package EPrints::Plugin::Screen::PluginTestA;

our @ISA = ( 'EPrints::Plugin::Screen' );

use strict;

sub new
{
       my( $class, %params ) = @_;
       my $self = $class->SUPER::new(%params);
       return $self;
}

sub render
{
       my( $self ) = @_;
       my $repo = $self->{repository};
       my $page = $repo->xml->create_element( "div" );
       $page->appendChild( $repo->xml->create_text_node( "This should be disabled by default" ) );
       return $page;
}

sub render_title
{
       my( $self ) = @_;
       my $f = $self->{repository}->make_doc_fragment;
       $f->appendChild( $self->{repository}->xml->create_text_node( "This is: PluginTestA" ) );
       return $f;
}
1;
####################################################################

~/lib/plugins/EPrints/Plugin/Screen/PluginTestB.pm
####################################################################
package EPrints::Plugin::Screen::PluginTestB;

our @ISA = ( 'EPrints::Plugin::Screen' );

use strict;

sub new
{
       my( $class, %params ) = @_;
       my $self = $class->SUPER::new(%params);
       $self->{disable} = 1;
       return $self;
}

sub render
{
       my( $self ) = @_;
       my $repo = $self->{repository};
       my $page = $repo->xml->create_element( "div" );
       $page->appendChild( $repo->xml->create_text_node( "This is explicitly disabled" ) );
       return $page;
}

sub render_title
{
       my( $self ) = @_;

       my $f = $self->{repository}->make_doc_fragment;
       $f->appendChild( $self->{repository}->xml->create_text_node( "This is: PluginTestB" ) );

       return $f;
}
1;
####################################################################


*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/

 

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/