scheduled-events
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| scheduled-events [2023/11/20 15:36] – created access19 | scheduled-events [2023/12/10 16:23] (current) – [Send out email updates (processEmailUpdates)] access19 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Scheduled Events ====== | ====== Scheduled Events ====== | ||
| + | |||
| + | ===== What are Scheduled Events? ===== | ||
| + | |||
| + | There are two types of Scheduled Event in MCM. 1) Checking Offers with expiry/ | ||
| + | |||
| + | ===== Triggering Scheduled Events ===== | ||
| + | There are two ways Scheduled Events can be triggered. | ||
| + | |||
| + | ==== 1. CRON ==== | ||
| + | You can set up a system CRON if your server or CPanel account allows for this. The CRON would then ensure that the RunScheduledEvents script is executed regularly at the specified time. Setting it to run once a day in the early hours of morning is suggested. | ||
| + | |||
| + | Here is an example line of code you could use for your CRON, which uses curl on the server to execute the script (be sure to replace YOUR-WEBSITE-URL with your domain, and PASSWORD with the ' | ||
| + | |||
| + | < | ||
| + | |||
| + | ==== 2. No CRON ==== | ||
| + | If you prefer not to use a CRON, the system will decide when is the next appropriate time to execute the RunScheduledEvents script. Each time a page is requested a check is performed to see if the script was last run more than 24 hours ago; if it was then the system runs it and updates the timestamp accordingly. | ||
| + | |||
| + | You can tell the system you are not using a CRON and therefore instruct it to perform this check by setting the following in your config file < | ||
| + | |||
| + | Not using a Cron is the simpler option but comes with the disadvantages of a) putting a small additional load on the server for each page request, and b) not guaranteeing the RunScheduledEvents script will be run within a particular timeframe (that is, if no-one visits your site for a day, the script will not get triggered until the next page request). | ||
| + | |||
| + | ===== Scheduled Events Script ===== | ||
| + | |||
| + | The RunScheduledEvents Script first verifies the Unattended password passed to it (note; if not using a cron, the system will take care of passing the unattended password for you). Then it checks if you have the Admin setting ' | ||
| + | |||
| + | Here are the ' | ||
| + | |||
| + | ==== Send out email updates (processEmailUpdates) ==== | ||
| + | |||
| + | - Get all Members who are not set to ' | ||
| + | - IF Members are found: | ||
| + | - Loop through list of Members, and for each one: | ||
| + | - Get the timestamp of the last Update Email they were sent | ||
| + | - Calculate the number of days that have elapsed since the last Update Email, and if this is higher than or equal to their Email Update Frequency preference: | ||
| + | - Fetch all Offers and Wants that were added or updated since their last Update Email, and use these to build the content of the Update Email | ||
| + | - If at least 1 Offer/Want is found, proceed to send the Email Update and adjust the timestamp of their last sent email accordingly | ||
| + | |||
| + | ==== Deactivate offers scheduled to expire (processExpiringOffers) ==== | ||
| + | |||
| + | - Fetch all Offers/ | ||
| + | - Loop through the Offers/ | ||
| + | - Deactivate the Offer/Want | ||
| + | |||
| + | ==== Activate offers scheduled to reactivate (processOfferReactivations) ==== | ||
| + | |||
| + | - Fetch all currently inactive Offers/ | ||
| + | - Loop through the Offers/ | ||
| + | - Activate the Offer/Want | ||
scheduled-events.1700494617.txt.gz · Last modified: 2023/11/20 15:36 by access19