Added internal function 'local_webhooks_insert_event'

Signed-off-by: Valentin Popov <info@valentineus.link>
This commit is contained in:
Valentin Popov 2018-03-12 23:29:02 +04:00
parent adb9a1e69c
commit 2b7e419f8f
Signed by: Valentin Popov
GPG Key ID: 269A00ACA90A8EA3

View File

@ -71,14 +71,26 @@ function local_webhooks_cache_reset() {
return $cache->purge(); 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. * Deleting all the events linked to the given service.
* *
* @param number $serviceid * @param number $serviceid
* @return boolean
*/ */
function local_webhooks_delete_events($serviceid) { function local_webhooks_delete_events($serviceid) {
global $DB; global $DB;
$DB->delete_records(LOCAL_WEBHOOKS_TABLE_EVENTS, array("serviceid" => $serviceid)); return $DB->delete_records(LOCAL_WEBHOOKS_TABLE_EVENTS, array("serviceid" => $serviceid));
} }
/** /**