Bug 25672: Prevent uninstall when plugin browser upload disabled

When plugin browser upload is disabled, also prevent plugin browser
uninstall.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
David Cook 2023-07-24 06:17:13 +00:00 committed by Tomas Cohen Arazi
parent 678b84c740
commit aa8c26ae52
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 6 additions and 1 deletions

View file

@ -220,7 +220,9 @@
[% END %]
[% END %]
[% IF ( CAN_user_plugins_manage ) %]
[% IF ( enable_browser_upload ) %]
<li><a class="uninstall_plugin" data-plugin-name="[% plugin.metadata.name | html %]" href="/cgi-bin/koha/plugins/plugins-uninstall.pl?class=[% plugin.class | html %]"><i class="fa fa-trash-can fa-fw"></i> Uninstall</a></li>
[% END %]
[% IF ( plugin.is_enabled ) %]
<li><a class="enable_plugin" data-plugin-name="[% plugin.metadata.name | html %]" href="/cgi-bin/koha/plugins/plugins-enable.pl?class=[% plugin.class | html %]&method=disable"><i class="fa fa-pause fa-fw"></i> Disable</a></li>
[% ELSE %]

View file

@ -38,8 +38,11 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
}
);
my $browser_upload_enabled = C4::Context->config('enable_plugin_browser_upload');
my $class = $input->param('class');
Koha::Plugins::Handler->delete( { class => $class } );
if ( $browser_upload_enabled && $class ) {
Koha::Plugins::Handler->delete( { class => $class } );
}
print $input->redirect("/cgi-bin/koha/plugins/plugins-home.pl");