Beispiel #1
0
 public static function cron()
 {
     $now = date('Y-m-d H:i:s', strtotime('-1 second', strtotime(date('Y-m-d H:i:s'))));
     $lastDatetime = cache::byKey('sarah::lastRetrievalInternalEvent', $now);
     foreach (internalEvent::getNewInternalEvent('sarah') as $internalEvent) {
         if (in_array($internalEvent->getEvent(), array('update::interactQuery'))) {
             foreach (sarah::byType('sarah') as $sarah) {
                 if ($sarah->ping()) {
                     log::add('sarah', 'info', 'Mise à jour de la grammaire de Sarah');
                     $sarah->updateSrvSarah();
                 } else {
                     cache::save('sarah::lastRetrievalInternalEvent', $lastDatetime, 0);
                 }
             }
         }
     }
 }
Beispiel #2
0
 public static function pull()
 {
     $events = internalEvent::getNewInternalEvent('alarm');
     foreach ($events as $event) {
         if ($event->getEvent() == 'event::cmd') {
             $trigger_id = $event->getOptions('id');
             if (is_numeric($trigger_id)) {
                 $eqLogics = eqLogic::byTypeAndSearhConfiguration('alarm', '#' . $trigger_id . '#');
                 if (is_array($eqLogics) && count($eqLogics) != 0) {
                     foreach ($eqLogics as $eqLogic) {
                         $eqLogic->launch($trigger_id, $event->getOptions('value'));
                     }
                 }
             }
         }
     }
 }