LazyCron class
Provides hooks that are automatically executed at various intervals.
===========================
It is called 'lazy' because it's triggered by a pageview, so it's accuracy executing at specific times will depend upon how may pageviews your site gets. So when a specified time is triggered, it's guaranteed to have been that length of time OR longer. This is fine for most cases. But here's how you make it NOT lazy:
Setup a real CRON job to pull a page from your site once per minute. Here is an example of a command that you could schedule to execute once per minute:
wget --quiet --no-cache -O - http://www.your-site.com > /dev/null
USAGE IN YOUR MODULES:
In your own module or template, add the function you want executed: public function myFunc(HookEvent $e) { echo "30 Minutes have passed!"; }
Then add the hook to it in your module's init() function:
$this->addHook('Lazy create your hook function
function myHook(HookEvent $e) { echo "30 Minutes have passed!"; } add a hook to it:
$wire->addHook('Lazy every30Seconds
everyMinute
every2Minutes
every3Minutes
every4Minutes
every5Minutes
every10Minutes
every15Minutes
every30Minutes
every45Minutes
everyHour
every2Hours
every4Hours
every6Hours
every12Hours
everyDay
every2Days
every4Days
everyWeek
every2Weeks
every4Weeks Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the In addition to the methods and properties above, LazyPROCEDURAL USAGE (i.e. in templates):
FUNCTIONS YOU CAN HOOK:
Lazy
class also inherits all the methods and properties of: WireData and Wire.Common
Additional methods and properties
API reference based on ProcessWire core version 3.0.251