Added a service search function that contains the specified event
This commit is contained in:
parent
ebf76795da
commit
29bdbc7456
19
lib.php
19
lib.php
@ -44,6 +44,25 @@ function local_webhooks_change_status($serviceid) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for services that contain the specified event.
|
||||
*
|
||||
* @param string $eventname
|
||||
* @return array
|
||||
*/
|
||||
function local_webhooks_search_services_by_event($eventname) {
|
||||
$recordlist = local_webhooks_get_list_records();
|
||||
$result = array();
|
||||
|
||||
foreach ($recordlist as $record) {
|
||||
if (boolval($record->enable) && !empty($record->events[$eventname])) {
|
||||
$result[] = $record;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the record from the database.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user