solved How daily maintenance execute

sbhadauria
@sbhadauria
10 years ago
129 posts
Daily maintenance execute on client side or server side?
Can I execute cron jobs by daily maintenance?
updated by @sbhadauria: 07/14/14 04:15:42AM
michael
@michael
10 years ago
7,748 posts
It fires when the site is opened after the period has expired. So you can fire it by having cron open the webpage once per day.

The code for it is at the bottom of router.php which controls the routing system if you want to see whats happening.

/modules/jrCore/router.php
sbhadauria
@sbhadauria
10 years ago
129 posts
Thanks michael
michael
@michael
10 years ago
7,748 posts
If you want to fire off a function from your module when the daily maintenance is run, use the 'daily_maintenance' listener.

You can see examples of modules registering to listen for it in the _init() function of these modules.
/modules/jrBackup/include.php
/modules/jrCharts/include.php
/modules/jrCore/include.php
/modules/jrImage/include.php

It will look like this:

    // Once a day we cleanup old cache entries
    jrCore_register_event_listener('jrCore', 'daily_maintenance', 'jrImage_daily_maintenance_listener');

What that piece of code reads is:
"When the daily maintenance is run, also fire off my function jrImage_daily_maintenance_listener()"

Then in jrImage_daily_maintenance_listener() the jrImage module cleans up cached files that have not been used lately.

Tags