Daily Maintenance

Table of Contents:


Overview
Who uses it?
For Developers
  • Overview

    Daily Maintenance is a routine that is run once per day by your Jamroom site.

    Modules listen tap into this process via the Events and Listeners system to perform tasks that need doing once a day.
  • Who uses it?

    Many of the modules from The Jamroom Network rely on Daily Maintenance to perform task that need doing to keep the site in order.
    For Example:
    * The DB and System Backup uses Daily Maintenance to fire the backup mechanism.
    * The Advanced Charts module uses Daily Maintenance to record the movements of the Audio, Video and other modules being charted to the datastore.
    * The Kickbox Email Validation module uses the Daily Maintenance cycle as a chance to check email accounts are valid.
    There are many modules who use this system. There is nothing the system admin user needs to do, its all automatic.


  • For Developers

    If you want to tap into the Daily Maintenance routine, the simplest module only requires an include.php file which would look like this:
    <?php
    /**
     * @copyright You at wherever
     */
    
    // make sure we are not being called directly
    
    defined('APP_DIR') or exit();
    
    /**
     * meta
     */
    function xxSomething_meta()
    {
        $_tmp = array(
            'name'        => 'Something',
            'url'         => 'something',
            'version'     => '1.0.0',
            'developer'   => 'Nobody, ©' . strftime('%Y'),
            'description' => 'A module created to do somthing',
            'license'     => 'mpl',
            'category'    => 'site'
        );
        return $_tmp;
    }
    
    /**
     * init
     */
    function xxSomething_init()
    {
        jrCore_register_event_listener('jrCore', 'daily_maintenance', 'xxSomething_daily_maintenance_listener');
        return true;
    }
    
    
    /**
     * xxSomething_daily_maintenance_listener
     * @param $_data array incoming data array from jrCore_save_media_file()
     * @param $_user array current user info
     * @param $_conf array Global config
     * @param $_args array additional info about the module
     * @param $event string Event Trigger name
     * @return array
     */
    function xxSomething_daily_maintenance_listener($_data, $_user, $_conf, $_args, $event)
    {
        // do whatever you want to here......
    
        return $_data;
    }

Tags