• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Run code only on last page with Cron

Brent W

Well-known member
#4
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);