Is it possible to add a custom scheduledTask to a custom OJS plugin that extends on the functionality of scheduledTasks.xml and adds a new one such as the following:
<task class="classes.tasks.EmailArticlePublished">
<descr>Send automated email to all article authors and editors once the article has been published</descr>
<frequency hour="0"/>
</task>
Let me know if this is possible to do with a plugin?
Yes, that is possible. See for example the book for review plugin: it has a scheduledTasks.xml. For it to be considered/run, there should be a cron job executing this:
Thus, you could do the same in your plugin: add the scheduledTasks.xml and an appropriate line in your cron job.
You could also take a look in the crossref export plugin. It uses AcronPlugin::parseCronTab hook, in order for its scheduled task to be considered when the acron plugin is used.
Hey @bozana. Thank you so much! You wouldn’t by any chance have an example that I could look at or a git repo? Also would I need to configure anything for the default cronjob in order to run that or?
We aren’t using Acron so I think your first approach sounds best, just wondering about the above, thanks!
Hey sorry to digress but I was wondering if I add a new method to a DAO. Can I just extend that DAO in a plugin or? If so then how would I call it? Sorry I am new to OJS but really liking it.