Ignore:
Timestamp:
Apr 30, 2016, 11:55:02 PM (8 years ago)
Author:
chronos
Message:
  • Modified: Notify background job is now needed to run separately by cmd.php notify.
  • Added: Catch exception thrown from scheduler jobs.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Notify/Notify.php

    r824 r830  
    66{
    77  var $Checks;
    8  
     8
    99  function __construct($System)
    1010  {
     
    3838      ),
    3939    ));
     40    $this->System->RegisterCommandLine('notify', array($this, 'RunCheck'));
    4041  }
    41  
     42
    4243  function RegisterCheck($Name, $Callback)
    4344  {
    44     if(array_key_exists($Name, $this->Checks)) 
     45    if(array_key_exists($Name, $this->Checks))
    4546      throw new Exception('Check function "'.$Name.'" already registered.');
    4647    $this->Checks[$Name] = array('Callback' => $Callback);
    4748  }
    48  
     49
    4950  function UnregisterCheck($Name)
    5051  {
    51     if(!array_key_exists($Name, $this->Checks)) 
     52    if(!array_key_exists($Name, $this->Checks))
    5253      throw new Exception('Check function "'.$Name.'" not registered.');
    5354    unset($this->Checks[$Name]);
     
    104105  }
    105106
     107  function RunCheck($Parameters)
     108  {
     109    RepeatFunction(30, array($this, 'Check'));
     110  }
     111
    106112  function DoInstall()
    107113  {
     
    142148  }
    143149}
    144 
    145 class ScheduleNotifyCheck extends SchedulerTask
    146 {
    147   function Execute()
    148   {
    149     $Output = $this->System->ModuleManager->Modules['Notify']->Check();
    150 
    151     return($Output);
    152   }
    153 }
Note: See TracChangeset for help on using the changeset viewer.