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?
Cron jobs for extensions
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.3.x. If you need support for phpBB 3.3.x please visit the 3.3.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.
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.3.x. If you need support for phpBB 3.3.x please visit the 3.3.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.
Cron jobs for extensions
Last edited by aleha on Fri Mar 28, 2014 1:25 pm, edited 1 time in total.
Re: Cron jobs for extensions
Have a look on my Auto Backup extension - it uses phpbb cron job.
My mods:
Auto Backup [MODDB] | Reputation System [RC]
Auto Backup [MODDB] | Reputation System [RC]
- nickvergessen
- Former Team Member
- Posts: 733
- Joined: Sun Oct 07, 2007 11:54 am
- Location: Stuttgart, Germany
- Contact:
Re: Cron jobs for extensions
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)
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-Team — No Support via PM
Re: Cron jobs for extensions
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?
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?
- nickvergessen
- Former Team Member
- Posts: 733
- Joined: Sun Oct 07, 2007 11:54 am
- Location: Stuttgart, Germany
- Contact:
Re: Cron jobs for extensions
its included as a little image in the overall_footer.html So its called on every page view.
Member of the Development-Team — No Support via PM