MDL-39846 fix name of property for record snapshots
MDL-39846 improve docs and fix use of deprecated classes
MDL-39846 prevent adding of snapshots after event trigger
MDL-39846 prevent use of snapshots in restored events
MDL-39846 improve validation and enable hardcoding of system context
MDL-39846 simplify context parameter when creating new evetns
MDL-39846 fix comment typos

Thanks Fred!
MDL-39846 remove contextlevel validation

Do this in new validate_data() instead, thanks Fred.
MDL-39846 improve docs
MDL-39846 rename object property to target

Credit goes to Fred, this should be easier to understand.
MDL-39846 rename the $object var to match the property name

Thanks Fred again.
MDL-39846 use new special value -1 in $CFG->loglifetime to prevent legacy logging
MDL-39846 prevent data modification from event init() method
MDL-39846 fix forgotten object event property

Thanks Dan!
MDL-39846 lock down snapshot handling in event
MDL-39846 make all legacy info protected so that it is not used accidentally outside of trigger()
MDL-40468 libraries: deprecated get_related_contexts_string()
MDL-40468 libraries: removed usages of get_related_contexts_string() in core

Also tidied up the functions by removing unused parameters.
MDL-40642 set more restrictive umask and use proper permission for new dirs and files
MDL-40642 use this->cfg in local file store when fixing permissions