diff --git a/includes/plugins/event_processor/none.inc b/includes/plugins/event_processor/none.inc index 57d53e1..e3d7814 100644 --- a/includes/plugins/event_processor/none.inc +++ b/includes/plugins/event_processor/none.inc @@ -20,6 +20,4 @@ $plugin = array( 'file' => 'VersioncontrolEventProcessorNone.inc', 'path' => drupal_get_path('module', 'versioncontrol') . '/includes/plugins/event_processor', ), - - 'has_configuration_form' => TRUE, ); diff --git a/includes/worker.inc b/includes/worker.inc index d3cc9ed..6f936c9 100644 --- a/includes/worker.inc +++ b/includes/worker.inc @@ -107,6 +107,8 @@ function _versioncontrol_reposync_run_worker($data) { if ($repository->syncEvent($event, $sync_options)) { // Fire the notification hook on success: new code is here, parsed and // ready to go! + // @todo Passing the repository to the hook is redundant, the event already + // have it, remove it. module_invoke_all('versioncontrol_code_arrival', $repository, $event); } } @@ -115,10 +117,26 @@ function _versioncontrol_reposync_run_worker($data) { * Run a repository event processor plugin. */ function _versioncontrol_repository_event_processor_run_worker($data) { - $event = $data['event']; + $repository_id = $data['repo_id']; + if (empty($data['repo_id'])) { + watchdog('versioncontrol', 'event_processor: Cannot load a repository with empty repo_id.".', WATCHDOG_ERROR); + return; + } + if (!$repository = versioncontrol_repository_load($data['repo_id'])) { + watchdog('versioncontrol', 'event_processor: Cannot load a repository with repo_id "%repository_id".', array('%repository_id' => $data['repo_id']), WATCHDOG_ERROR); + return; + } + if (empty($data['elid'])) { + watchdog('versioncontrol', 'event_processor: Cannot load an event with empty elid.".', WATCHDOG_ERROR); + return; + } + if (!$event = $repository->loadEvent($data['elid'])) { + watchdog('versioncontrol', 'event_processor: Cannot load an event with elid "%elid" on repository "%repo_id".', array('%elid' => $data['elid'], '%repo_id' => $data['repo_id']), WATCHDOG_ERROR); + return; + } foreach($event->getRepository()->getEventProcessors() as $name => $event_processor) { try { - $event_processor->process($data['event']); + $event_processor->process($event); } catch (VersioncontrolSynchronizationEventProcessorException $exception) { watchdog('versioncontrol', 'Event processor using class "%class" aborted execution with message "%message".', array('%class' => get_class($event_processor), '%message' => $exception->getMessage()), WATCHDOG_WARNING); diff --git a/versioncontrol.module b/versioncontrol.module index 25c152d..4b12add 100644 --- a/versioncontrol.module +++ b/versioncontrol.module @@ -818,7 +818,8 @@ function versioncontrol_plugins_get_information() { */ function versioncontrol_versioncontrol_code_arrival(VersioncontrolRepository $repository, VersioncontrolEvent $event) { $payload = array( - 'event' => $event, + 'repo_id' => $repository->repo_id, + 'elid' => $event->elid, ); $queue = DrupalQueue::get('versioncontrol_repository_event_processor', TRUE); $queue->createItem($payload);