HomeHelpTrac

Changeset 11293


Ignore:
Timestamp:
07/08/09 04:00:53 (3 years ago)
Author:
Alexey Penskikh
Message:

Add description

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/periodic/cron.php

    r10891 r11293  
    2626require_once(BX_DIRECTORY_PATH_CLASSES . 'BxDolDb.php'); 
    2727 
     28/* 
     29 * This file is used for cron jobs. He is started system cron every minute. 
     30 * The file runs jobs at regular intervals. These jobs are listed in `sys_cron_jobs` table. 
     31 *  
     32 * Fields shark_cron_jobs table: 
     33 *  id - key for the table 
     34 *  name - job name to be executed 
     35 *  time - format of entries are five fields of numbers specifying the minute,  
     36 *              hour, day of the month, month and day of the week that a task must be executed. 
     37 *  
     38 *              * * * * * 
     39 *              | | | | | 
     40 *              | | | | +--- day of week(0-6 with 0=Sunday) 
     41 *              | | | +----- month(1-12) 
     42 *              | | +------- day of month(1-31) 
     43 *              | +--------- hour(0-23) 
     44 *              +----------- minute(0-59) 
     45 *  
     46 *  class - class name which will run 
     47 *  file - path to class file 
     48 *  eval - source code which will run 
     49 *  
     50 * The time numbers can be given as a comma separated list of simple numbers,  
     51 * ranges("2-5" is the same as "2,3,4,5"). A single "*" can be used in a field to indicate all  
     52 * valid numbers in that field, so it translates to "always". If a given time is valid in all five  
     53 * fields then a module function is executed. Here are a few examples that illustrate the possibilities: 
     54 *   
     55 *  will run at 16:10: 
     56 *  10 16 
     57 *  will run at 2:00 on saturday: 
     58 *  0 2 * * 6 
     59 *  will run at midnight on new years: 
     60 *  0 0 1 1 0 
     61 *  will run every 15 minutes: 
     62 *  *\/15 
     63 *  will run at 22:00 on work weekdays: 
     64 *  0 22 * * 1-5 
     65 *  will run each 23 minutes, 2:00, 4:00 ..., everyday 
     66 *  23 0-23/2 
     67 *  
     68 * Example add new cron job: 
     69 *  
     70 * 1. Create new class inherited from "BxDolCron" and add method "processing" 
     71 *  
     72 *      class BxDolCronMy extends BxDolCron { 
     73 *       
     74 *          function processing() 
     75 *          { 
     76 *              // insert code 
     77 *          } 
     78 *      } 
     79 *  
     80 * 2. Add record in `sys_cron_jobs` table 
     81 *  
     82 * @see an example of BxDolCronNotifies, BxDolCronCupid, BxDolCronCmd. 
     83 * 
     84 * 
     85 * Memberships/ACL: 
     86 * Doesn't depend on user's membership. 
     87 * 
     88 * 
     89 * Alerts: 
     90 * no alerts available 
     91 *  
     92 */ 
    2893function getRange($iLow, $iHigh, $iStep) 
    2994{ 
     
    133198        if(!class_exists($aJob['class'])) 
    134199            require_once(BX_DIRECTORY_PATH_ROOT . $aJob['file']); 
    135              
     200         
    136201        $oHandler = new $aJob['class'](); 
    137202        $oHandler->processing(); 
Note: See TracChangeset for help on using the changeset viewer.