The function 'local_webhooks_insert_event' is replaced by the function 'local_webhooks_insert_events'
Signed-off-by: Valentin Popov <info@valentineus.link>
This commit is contained in:
parent
2b7e419f8f
commit
0d9fe62ec6
21
locallib.php
21
locallib.php
@ -72,14 +72,25 @@ function local_webhooks_cache_reset() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adding an event to the database.
|
* Adds all events to the database.
|
||||||
*
|
*
|
||||||
* @param object $event
|
* @param number $serviceid
|
||||||
|
* @param array $events
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function local_webhooks_insert_event($event) {
|
function local_webhooks_insert_events($serviceid, $events) {
|
||||||
global $DB;
|
$records = array();
|
||||||
return $DB->insert_record(LOCAL_WEBHOOKS_TABLE_EVENTS, $event, true, false);
|
|
||||||
|
foreach ($events as $eventname => $eventstatus) {
|
||||||
|
$event = new stdClass();
|
||||||
|
$event->name = $eventname;
|
||||||
|
$event->status = $eventstatus;
|
||||||
|
$event->serviceid = $serviceid;
|
||||||
|
$records[] = $event;
|
||||||
|
}
|
||||||
|
|
||||||
|
local_webhooks_delete_events($serviceid);
|
||||||
|
return $DB->insert_records(LOCAL_WEBHOOKS_TABLE_EVENTS, $records);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user