Background proccess

Hi, I need to call a PHP function to process action(inserting / updating data to database, sending emails etc) in the background, allowing users to continue using the page without interruption. What is the simplest way to achieve this in the ConcreteCMS system? Im usingn concrete versio 9. Thanx in advance.

Create a table in the db (or a file on the site), add the necessary information for your functions to run, have a Task that checks the table and executes the functions using a CRON.

1 Like

Hi,
Thanx for your reply. The idea is to run function to process some action in the background, when customer reachs certain point in the game. Can task be called in that way (without CRON logic)?

Typically you would extend an event: Application Events :: Concrete CMS

The game itself - when it hits that score can have a php call to make whatever updates you want to the db - might not even need to extend anything directly in concrete depending on your need.

I wrote a set of similar functions to auto update mapping db information that is used to change/adjust what the mapping is displaying on the site.

The idea is that php function must proccess on the background, so player does not need to wait for proccess. The proccess on the background can take a while, so it is better to be done in that way.

Then you could also just (as previously suggested) have a cron job run a file every X mins. (I’ve done this for another use case where it needs to check and FTP some information for new changes every x mins.) In the PHP file you just need to either have it do the job you want or have it ping the “data” that determines to do the job. Again no specific concrete work needed here, but if updating any tables, make sure you get all your data points correct and don’t miss updating anything.