[Koha-devel] Mojolicious controllers for Koha plugins

dcook at prosentient.com.au dcook at prosentient.com.au
Tue Aug 16 09:41:54 CEST 2022


Hi all,

 

I was just writing a Koha plugin to do a big data export, but I realize that
it's probably going to timeout, because Koha plugins run under
Plack::App::CGIBin which buffers the entire response before it returns it to
Apache to return to the client browser. It's the reason Koha uses CGI
instead of Plack for export.pl

 

While we can use Mojolicious controllers with Koha plugins when it adds REST
API endpoints, we can't do that for Koha plugins themselves. 

 

This is a topic that I've touched on before, and there are challenges when
it comes to Authentication and Templates, but they're solvable challenges:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26791 "Build
Mojolicious controller replacement for export.pl"

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28325 "Build
Mojolicious controller replacement for tools-home.pl"

 

We could just start by supporting "tool" and "report" with the Mojolicious
controllers, and that would just mean plugins-home.pl detecting that there
is Mojolicious support in that plugin, and then building a URL to
"/staff/plugins/run" instead of "/cgi-bin/koha/plugins/run.pl" for instance.

 

That Mojolicious controller would really just need to check
authentication/authorization, which is very doable with a fairly minor
refactor. 

 

If I could get the support of just a couple other people, I'd be happy to do
a lot of the authoring (or testing or whatever needs to be done just to get
it done).

 

By using Mojolicious controllers for select plugins, we'd also be able to
shake out any issues without causing any regressions in core Koha, and then
hopefully be able to start refactoring core Koha too.

 

Anyways, please give it some consideration, and ask me if you have any
questions. 

 

I'll be looking more into export problems tomorrow, so I might end up going
a different route for the sake of time in the short-term, but I think we
should still be looking at shifting away from CGI and Plack::App::CGIBin due
to their limitations.

 

David Cook

Senior Software Engineer

Prosentient Systems

Suite 7.03

6a Glen St

Milsons Point NSW 2061

Australia

 

Office: 02 9212 0899

Online: 02 8005 0595

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20220816/4dd2b24b/attachment.htm>


More information about the Koha-devel mailing list