MDL-40908 test: added function to generate a tag
MDL-40908 core: updated the 'tag_instance' table to store the component, contextid and timecreated
MDL-40908 core_tag: replaced 'update' add_to_log calls with an event
MDL-40908 core_tag: replaced 'add' add_to_log call with an event
MDL-40908 core_tag: replaced 'flag' add_to_log call with an event

Also introduced a tag_unflagged event.
MDL-40908 core_tag: created a 'tag_deleted' event
MDL-40908 core_tag: created a 'tag_created' event
MDL-40908 core_tag: created a 'item_untagged' event