Пример #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);
                 }
             }
         }
     }
 }