Skip to content

Commit

Permalink
Merge branch 'w32_MDL-40815_m26_deprevent' of https://github.com/skod…
Browse files Browse the repository at this point in the history
…ak/moodle

Conflicts:
	lib/deprecatedlib.php
  • Loading branch information
Sam Hemelryk committed Aug 6, 2013
2 parents f0655ec + f0f0e1f commit 17440b2
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/classes/event/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ public final function trigger() {
$this->dispatched = true;

if ($legacyeventname = $this->get_legacy_eventname()) {
events_trigger($legacyeventname, $this->get_legacy_eventdata());
events_trigger_legacy($legacyeventname, $this->get_legacy_eventdata());
}
}

Expand Down
15 changes: 15 additions & 0 deletions lib/deprecatedlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ function css_minify_css($files) {
return core_minify::css_files($files);
}

/**
* Function to call all event handlers when triggering an event
*
* @deprecated since 2.6
*
* @param string $eventname name of the event
* @param mixed $eventdata event data object
* @return int number of failed events
*/
function events_trigger($eventname, $eventdata) {
// TODO: uncomment after conversion of all events in standard distribution
// debugging('events_trigger() is deprecated, please use new events instead', DEBUG_DEVELOPER);
return events_trigger_legacy($eventname, $eventdata);
}

/**
* List all core subsystems and their location
*
Expand Down
11 changes: 4 additions & 7 deletions lib/eventslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,18 +473,15 @@ function events_cron($eventname='') {
return $processed;
}


/**
* Function to call all event handlers when triggering an event
* Do not call directly, this is intended to be used from new event base only.
*
* @access public Part of the public API.
* @category event
* @private
* @param string $eventname name of the event
* @param string $eventdata event data object. This should contain any data the
* event wants to share and should really be documented by the event publisher
* @param mixed $eventdata event data object
* @return int number of failed events
*/
function events_trigger($eventname, $eventdata) {
function events_trigger_legacy($eventname, $eventdata) {
global $CFG, $USER, $DB;

$failedcount = 0; // number of failed events.
Expand Down
5 changes: 5 additions & 0 deletions lib/upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ YUI:
* exception
* ajaxexception

Event triggering and event handlers:
* All existing events and event handlers should be replaced by new
event classes and matching new event observers.
* See http://docs.moodle.org/dev/Event_2 for more information.

=== 2.5.1 ===

* New get_course() function for use when obtaining the course record from database. Will
Expand Down

0 comments on commit 17440b2

Please sign in to comment.