MDL-42400 modlib: include module file when it's used

- changed the place where module file is included to make sure that add_moduleinfo() can be called independently from create_module()
- removed permission check from add_moduleinfo() because this function is not supposed to check permissions. Besides it's only half-check. See can_add_moduleinfo()
- added phpdocs to some functions to indicate that they can throw an exception
MDL-42400 generator: module generators call add_moduleinfo instead of direct inserts
MDL-42400 generator: Add function testing_module_generator::create_content()

also implement it for mod_book and mod_forum to call existing create_page, create_discussion/post functions
MDL-42400 tool_generator: save db query in module generation
MDL-42400 modlib: speed up add_moduleinfo, remove unnecessary queries

removed code that was causing unnecessary DB queries, this significantly speeds up data generators
MDL-42400 mod_glossary: data generator for glossary
MDL-42400 mod_lesson: data generator for lesson
MDL-42400 mod_survey: data generator for survey
MDL-42400 mod_url: data generator for url
MDL-42400 mod_wiki: data generator for wiki
MDL-42400 mod_workshop: data generator for workshop
MDL-42400 generator: unittest for module generator