Cron jobs for extensions

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The next feature release of phpBB 3 will be 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.2.x. If you need support for phpBB 3.2.x please visit the 3.2.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
Post Reply
aleha
Registered User
Posts: 143
Joined: Tue Mar 26, 2013 2:19 am

Cron jobs for extensions

Post by aleha »

Suppose the following scenario:
I create an extension that allows me to store in a table the topic_id and an expiration date for a topic that I mark as sticky/announcement/etc.
Now, when the expiration date comes, I want to unsticky/etc the topic. If my extension could be able create a cron job file that could be most useful.

Reading the wiki on Modular_cron I can't see a way to do this from within an extension, since extensions live in the ext/ directory. A solution would be to place the cron file by hand separately from the extension installation process. Is there another solution?

Should we allow extensions to create cron jobs, say somehow in their namespace?
Last edited by aleha on Fri Mar 28, 2014 1:25 pm, edited 1 time in total.

User avatar
Pico88
Registered User
Posts: 73
Joined: Tue Apr 12, 2011 2:32 pm

Re: Cron jobs for extensions

Post by Pico88 »

Have a look on my Auto Backup extension - it uses phpbb cron job.

User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: Cron jobs for extensions

Post by nickvergessen »

aleha: it should be possible to live in the ext/ dir without a problem.
Just a note, unstickify and changing topic types after x days is already a core feature (just in case thats what you plan to do and didnt only use as an example)
Member of the Development-TeamNo Support via PM

aleha
Registered User
Posts: 143
Joined: Tue Mar 26, 2013 2:19 am

Re: Cron jobs for extensions

Post by aleha »

Thanks pico88, I looked at your ext and then snooping around I found the core cron jobs.

nickvergessen, I had totally forgotten that but I see now that this core feature counts time relative to the topic creation time but I'd prefer this to be 00:00am.
I understand that I must declare my cron job as one in file cron_tasks.yml of my ext, but what triggers cron manager and therefore how often does it run if you don't use system cron?

User avatar
nickvergessen
Former Team Member
Posts: 733
Joined: Sun Oct 07, 2007 11:54 am
Location: Stuttgart, Germany
Contact:

Re: Cron jobs for extensions

Post by nickvergessen »

its included as a little image in the overall_footer.html So its called on every page view.
Member of the Development-TeamNo Support via PM

Post Reply