aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--classes/task/process_events_task.php20
1 files changed, 11 insertions, 9 deletions
diff --git a/classes/task/process_events_task.php b/classes/task/process_events_task.php
index d2d1ca9..84b5c88 100644
--- a/classes/task/process_events_task.php
+++ b/classes/task/process_events_task.php
@@ -45,18 +45,20 @@ class process_events_task extends \core\task\adhoc_task {
$services = \local_webhooks_api::get_services_by_event( $this->get_custom_data()->eventname );
foreach ( $services as $service ) {
- if ( !empty( $service->status ) ) {
- $curl = new \curl();
+ if ( empty( $service->status ) ) {
+ return;
+ }
- $event = (array) $this->get_custom_data();
- $event[ "token" ] = $service->token;
+ $curl = new \curl();
- $curl->setHeader( array( "Content-Type: " . $service->header ) );
- $curl->post( $service->point, json_encode( $event ) );
+ $event = (array) $this->get_custom_data();
+ $event[ "token" ] = $service->token;
- // TODO: Mark the log
- $curl->getResponse();
- }
+ $curl->setHeader( array( "Content-Type: " . $service->header ) );
+ $curl->post( $service->point, json_encode( $event ) );
+
+ // TODO: Mark the log
+ $curl->getResponse();
}
}
} \ No newline at end of file