I noticed the Ad-Expiration Email is not always received. So I decided to find out what happened. And I would like to share what I found.
- Built-In Cron - from OSClass Settings
- Logic behind cron.php
Keep in mind that cron.php checks each posts for expiration.
- If Built-In Cron is enabled, the cron.php will be triggered on visits to OSclass landing page (osclass/index.php). That means, there won't be any email notifications until some user visits my classifieds site.
- Moreover, that 'lucky' user who visits my homepage could experience long delay in opening my landing page. The cron.php could be busy sending out notification emails.
- So I decided to schedule Linux cron job to perform the work instead of using built-in cron. And I choose to use 'wget' to make a HTTP request for cron.php, instead of command-line php (CLI) environment. This way, I only have to maintain one php configuration.
- At this point, I still notice some email notifications not being sent. So I study the code a bit more. The condition of deciding whether to check for Ad Expiration is pretty tight. OSclass schedule the target 'next-checking-time' in database. The condition fails if the cron job is run SLIGHTLY before the scheduled 'next-checking-time'. And by the time cron runs again the next hour, conditions imposed by function call findByHourExpiration(24*osc_warn_expiration()) would fail to find the ad. This is something to keep in mind.
Building EEClassifieds