Jump to content
Sign in to follow this  
spoetnik

Background proces (shell_exec)

Recommended Posts

A "Batch" function, or "background" function would be nice given the following use-case.

Process the files from an upload field, and index the processed values in your indexing server. There is no need for the webuser to waith for this processing, it could perfectly happen in the background using 

shell_exec

Share this post


Link to post
Share on other sites

It would be possible to add such a function with a custom module. It hooks after the Upload and then hands over the files to the shell. Disregarding any security concerns from the shell_exec which you should be avoided.

You could try LazyCron (part of ProcessWire) for longer tasks in the background or use normal Cronjob to perform those tasks. There is cron.pw which is super cool to run functions regulary.

Another idea, avoiding the shell_exec: A module that writes the files into a queue (database or file or directory) and then a Cronjob runs your programm that will search for jobs in this queue.

EDIT: As we're here in the Wishlist section of the forum: I disagree to put something like this into the core of ProcessWire. Beside security concerns, this can be easily solved with the methods described above.

  • Like 1

Share this post


Link to post
Share on other sites

Going to agree with Philipp there. Especially in the light of some of the "high profile" vulnerabilities uncovered lately, I believe that security is one of the true strengths of ProcessWire. While exec(), shell_exec(), system(), passthru(), etc. are powerful and very useful in controlled environments, they also introduce a whole new set of risks, and IMHO are rarely something you'd want to include in the core of an open source platform.

That being said, there's nothing stopping you from using them in your own modules :)

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...