Run code only on last page with Cron

Brent W

Well-known member
I want to setup a cron that runs code only on the last page of a thread. What would the code look like for this?
 
I don't understand your use-case for this?

What is it you are trying to achieve?
 
I don't understand your use-case for this?

What is it you are trying to achieve?
Cloudflare Edge Caching I guess :).

Correct. I want to essentially have a page rule like this: https://blog.cloudflare.com/caching-anonymous-page-views/

CloudFlare Business only lets you choose 30 minutes as the lowest value for their Edge Cache. That length is too long for certain pages (forum listing, last thread page etc).

So I want to simply run php code on the last page of the thread every x minute in a cron so that I can purge the last page url of each thread.

I currently have a cron setup in crontab that does this forum homepage and forum listing every two minutes:

PHP:
$identifier = $api->identifier('christianforums.com');
$files = [
    'https://www.christianforums.com/',
    'https://www.christianforums.com/forums/'
];
$result = $api->purge_files($identifier,$files);
 
Top Bottom