/**
  * Dispatches a list of event handlers.
  *
  * @param AcsfEvent $event
  *   The AcsfEvent that is being executed.
  */
 public function dispatch(AcsfEvent $event)
 {
     $this->running = TRUE;
     while ($this->running && ($handler = $event->popHandler('incomplete'))) {
         try {
             // Capture some information about the handler.
             $handler->started = microtime(TRUE);
             $handler->handle();
             $handler->completed = microtime(TRUE);
             $event->pushHandler($handler, 'complete');
         } catch (\Exception $e) {
             $handler->message = sprintf('Class %s handler failed for event %s: %s', get_class($handler), $event->type, $e->getMessage());
             $event->pushHandler($handler, 'failed');
         }
     }
 }
Beispiel #2
0
 /**
  * Saves the internal state of this site.
  */
 public function save()
 {
     $context = $this->info;
     $event = AcsfEvent::create('acsf_site_data_save', $context);
     $event->run();
     $this->info = $event->context;
     acsf_vset('acsf_site_info', $this->info, 'site_info');
 }