OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Callback every time a submission file is uploaded

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

Re: Callback every time a submission file is uploaded

Postby Damion » Fri Apr 26, 2013 3:01 pm

Ah yes, I do want to avoid nix-only solution. I did read though that pcntl_fork should not be used within web server environment? Plus a few pages of caviats about it. I will look at windows version + php folder location issue.

One issue for me with ProcessDAO was no ability to pass parameters via the call/url. And since the ProcessDAO pid of a just involked process call is hidden (no returned value), there's no way to use that as a key. So it seems one must set up a queue of tasks (database driven), then launch the ProcessDAO on it, making sure each individual process lassoos and locks a particular item in the queue. More complicated!
Damion
 
Posts: 14
Joined: Tue Mar 19, 2013 12:09 pm

Re: Callback every time a submission file is uploaded

Postby asmecher » Fri Apr 26, 2013 3:28 pm

Hi Damion,

Do you have a reference for problems using pcntl_fork in a web environment? I remember doing some research about this a few years back but unfortunately it's long gone.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Re: Callback every time a submission file is uploaded

Postby Damion » Fri Apr 26, 2013 10:09 pm

In php notes, there was an albeit 8 year old comment about not using with apache - but user may have been speaking of WAMP context; But in tech notes I do see: "By default pcntl library is not enabled on web server installation. In order to use pcntl_fork() function you need to compile and enable pcntl.so module. That is pretty easy on Ubuntu." (http://in.php.net/manual/en/ref.pcntl.php#91224) . So definitely a technical barrier for various OJS installs?

Also that it is very nonstandard to get it to work with windows and apache ;( http://stackoverflow.com/questions/4879 ... pcntl-fork) also there's this comment about how it copies the entire php process; and another comment about how database connections are still shared with parent & child processes, such that if one ends a connection the other would have to reopen it. Not sure of the impact on OJS classes but it all sounded scary!
Damion
 
Posts: 14
Joined: Tue Mar 19, 2013 12:09 pm

Re: Callback every time a submission file is uploaded

Postby Damion » Tue May 07, 2013 8:54 pm

Having a devil of a time tracing why my plugin that I moved over to a "gateways" type from a "generic" type , no longer fires the hooks. I installed it via the .tar.gz from scratch; did reinstall etc. Checked "versions" table etc. I can see in my main plugin file that HookRegistry gets hooks set up as a result of its settings form submission. But over on the article edit/view as a layout editor no plugin hooks exist. I see 5 core hooks only: Installer::postInstall, JournalSiteSettingsForm::execute, TemplateManager::display, LoadHandler, PluginRegistry::loadCategory

So one other question is - do all the hooks get re-established in the hook registry on every url request to server ojs code?

And what does the versions table lazy_load setting basically do?

And what is the sitewide setting about?

Thanks for the info...
Damion
 
Posts: 14
Joined: Tue Mar 19, 2013 12:09 pm

Re: Callback every time a submission file is uploaded

Postby asmecher » Tue May 07, 2013 9:38 pm

Hi Damion,

Each plugin category is loaded under different circumstances. The "generic" category is most flexible as plugins will be loaded early in every request; others, like gateway plugins, are only loaded in specific circumstances. Look for calls to PluginRegistry::loadCategory; in the case of the gateway plugin category, it appears in pages/gateway/GatewayHandler.inc.php. Gateway plugins won't be loaded unless that code is invoked.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Re: Callback every time a submission file is uploaded

Postby Damion » Tue May 07, 2013 10:25 pm

Ah, that explains alot! I see what you mean by each category having different loading circumstances. I'll switch the plugin back to being primarily generic with a gateway splice.

d.
Damion
 
Posts: 14
Joined: Tue Mar 19, 2013 12:09 pm

Re: Callback every time a submission file is uploaded

Postby Damion » Thu May 09, 2013 11:57 am

Quick question to rule out a possibility which would be nice in theory.

I'm setting it up so that user can get a markup version of their article via url like:

http://ubie/ojs/index.php/chaos/gateway/plugin/markup/[article id]/document.pdf
http://ubie/ojs/index.php/chaos/gateway/plugin/markup/[article id]/document.xml
http://ubie/ojs/index.php/chaos/gateway/plugin/markup/[article id]/document.html

and similar urls for the other graphics and css.

I was planning on uncompressing each needed file into a subfolder of the article supplementary file folder, and delivering them back to user via php. That's plan A.

But Plan B: It occurred to me that on the server we could potentially leave all of these files in a single tar ball, uncompressed, if file extraction was really fast? Since we're already handling access to these files via php file read, using a tar wouldn't be that much slower? Or is that impractical? This would be a cleaner solution.
Damion
 
Posts: 14
Joined: Tue Mar 19, 2013 12:09 pm

Re: Callback every time a submission file is uploaded

Postby asmecher » Thu May 09, 2013 12:01 pm

Hi Damion,

Off the top of my head, tar files are slow to seek through for a particular file, since I don't think there's a central index to look through to find file offsets. We have a rich directory structure for article-related files, so there wouldn't be much benefit to keeping everything in a tarball anyway.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Re: Callback every time a submission file is uploaded

Postby Damion » Thu May 09, 2013 12:52 pm

Ok. I see from online notes that zip files have much better performance in terms of extraction, but still requires the decompression work that a tar itself doesn't have, so still slower than direct file system access. I'll stick with plan A. Thanks.
Damion
 
Posts: 14
Joined: Tue Mar 19, 2013 12:09 pm

Previous

Return to OJS Development

Who is online

Users browsing this forum: No registered users and 1 guest