Batch actions
Since Tiki6, and extended in Tiki9.This feature allows you to do some actions in batch. You still need to set up a cron job or other tools to activate the features described here.
Table of contents
Features with batch actions
Email sending from Daily reports
Using tiki-user_send_reports.phpSee Daily reports and Token access
Email sending from Newslettters
Using tiki-bach_send_newsletter.phpSee Newsletters, Token access and
http://doc.tiki.org/Newsletter+User#Sending_newsletters_with_a_cron_batch_job
Change status of Tracker items & email notification in advance
It is possible to specify automatic item status change for a tracker after a certain period of inactivity. Moreover, some emails can be sent to warn the user about that change at some predefined time before the status item change is planned to happen.The task that must be run is
cron command
cd /path_to_tiki_root; php tiki-batch_todo.php
In the modification/creation panel of a tracker, you can specify a change of status from one status (optional) to another after a certain time from the creation or last modification of an item. You can also specify if you wish to send a notification to the item creator. The subject of the message is a string. The body of the message is a smarty resource, either a wiki page or a template, which can use a few variables inside:
- {$todo_itemId}
- {$todo_tostatus}
- {$todo_fromstatus}
- {$todo_after}
- {$todo_desc} , which is fed with the first "isMain" type of field from that tracker, which could be the "title" or "name" assigned to that tracker item at item creation, etc.
Example in Tiki6:
wiki page changeStatus
In about {$todo_after|duration}, the item {$todo_itemId} ("{$todo_desc}") will change
from the status {$todo_fromstatus} to {$todo_tostatus}In this example open items older than one day will have their status changed to pending. The item creator will receive a notification 23 hours before the change.
The status change is done before considering to send notification.
The time the event is approximate as it depends of the frequency of the cron
Since Tiki9, it can be run by means of Token Access, and the interface for the status change based on the batch job has changed:
Updating advanced rating
Using a custom php script as described inhttp://doc.tiki.org/Advanced+Rating#Appendix
See Advanced Rating
Setting up cron jobs
You can set a cron to launch batch actions at a specific time and frequency. In some case, you will be able to set a cron job in the same server where you tiki is hosted, but in some cases, like in most shared hosting environments, you will have to find other way to handle it, since you don't have access to set a cron job in the server.
Since Tiki9 some of these batch action can be launched from a cron job in an external server in a controlled way by means of token access control.
To do so:
- browse the url http://yourserver/tiki-admin_tokens.php (there is a link also at tiki-admin.php?page=security#cookietab=5 )
- click at "Add new token" and fill in the from
- Once the token is created, copy it's value from the table.
Let's assume that your token value is "3e18afe286c9a9639fabc40932497fd3", and that the URL that you want to call from the crontab is http://yourserver/tiki-send_batch_newsletter.php?editionId=2
In this case, the record in the crontab of the external server has to be like:
curl 'http://path_to_tiki/tiki-send_batch_newsletter.php?editionId=2&TOKEN=3e18afe286c9a9639fabc40932497fd3'
Some links to set up a cron:
- Quick reference: http://adminschoice.com/crontab-quick-reference
- CPanel: http://www.siteground.com/tutorials/cpanel/cron_jobs.htm
- GNU/Linux: http://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses
See also Cron for more information on how to set a cron job throgh the crontab.
batch job | batch process | Cron job | Cron tab | Cron | Scheduled Task
