Skip to content

Commit

Permalink
SOme small changes from the meeting today
Browse files Browse the repository at this point in the history
  • Loading branch information
moodler committed Apr 30, 2007
1 parent b3f1116 commit de0bc10
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/eventslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ function events_cleanup($component, $cachedevents) {
*/
function queue_handler($handler, $eventdata, $failed=false) {
global $USER;

// adds a record to events_queue (if not exist)
if (!$existing_event = get_record('events_queue', 'eventdata', serialize($eventdata))) {
// add it
Expand Down Expand Up @@ -200,16 +201,16 @@ function queue_handler($handler, $eventdata, $failed=false) {
* @param eventdata - event data object
* @return number of failed events
*/
function trigger_events($eventname, $eventdata) {
function trigger_event($eventname, $eventdata) {
$failedevent = 0; // number of failed events.
// pull out all registered event handlers
if ($handlers = get_records('events_handlers', 'eventname', $eventname)) {
foreach ($handlers as $handler) {
// either excute it now

// if event type is
if ($eventdata->schedule == "instant") {
if (trigger_event($handler, $eventdata)) {
if ($handler->schedule == 'instant') {
if (dispatch_event($handler, $eventdata)) {
continue;
} else {
// update the failed flag
Expand All @@ -231,7 +232,7 @@ function trigger_events($eventname, $eventdata) {
* @param eventdata - event dataobject
* @return bool - success or fail
*/
function trigger_event($handler, $eventdata) {
function dispatch_event($handler, $eventdata) {

global $CFG;
// checks for handler validity
Expand Down Expand Up @@ -306,4 +307,4 @@ function events_dequeue($handler) {
return false;
}
}
?>
?>

0 comments on commit de0bc10

Please sign in to comment.