Added internal function 'local_webhooks_insert_event'
Signed-off-by: Valentin Popov <info@valentineus.link>
This commit is contained in:
		
							
								
								
									
										16
									
								
								locallib.php
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								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));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user