From 2b7e419f8faa7b8fd55b5bf7c9867f794e36e774 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Mon, 12 Mar 2018 23:29:02 +0400 Subject: Added internal function 'local_webhooks_insert_event' Signed-off-by: Valentin Popov --- locallib.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/locallib.php b/locallib.php index d02898b..43eddae 100644 --- a/locallib.php +++ b/locallib.php @@ -71,14 +71,26 @@ function local_webhooks_cache_reset() { return $cache->purge(); } +/** + * Adding an event to the database. + * + * @param object $event + * @return boolean + */ +function local_webhooks_insert_event($event) { + global $DB; + return $DB->insert_record(LOCAL_WEBHOOKS_TABLE_EVENTS, $event, true, false); +} + /** * Deleting all the events linked to the given service. * - * @param number $serviceid + * @param number $serviceid + * @return boolean */ function local_webhooks_delete_events($serviceid) { global $DB; - $DB->delete_records(LOCAL_WEBHOOKS_TABLE_EVENTS, array("serviceid" => $serviceid)); + return $DB->delete_records(LOCAL_WEBHOOKS_TABLE_EVENTS, array("serviceid" => $serviceid)); } /** -- cgit v1.2.3