Adds a simple way to count queries over a piece of code
Fixes #6024: Adds support for ":before" and ":after" events
After events cannot be cancelled, all handlers always run.

Conflicts:
	engine/lib/elgglib.php
Improved inline docs
Clearer logic
RST docs for before/after events
More reliable event deprecation (notice only if handlers registered)
Switch login to before/after events
Switch logout event to before/after
Corrects testUnstoppableEventsCantBeStoppedAndReturnTrue test
Bug fix in elgg_trigger_deprecated_event
Merge branch 'pr/6026'
Merge pull request #6239 from mrclay/query_counter

Adds a simple way to count queries over a piece of code
Fixes #6241 - Handles the owner_guid parameter correctly

The owner_guid parameter is now used correctly to define the owner of the content that is being commented.