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