[RFC][WIP]Bundle management

refs #1614, #1528

also possibly refs several tickets related to "ClassNotFoundException" errors
maybe refs #1829, #1428, #1557

Purpose of this PR:
1. clear cache on module install/uninstall/update
2. update bundles table if bundle json definition changes (e.g. psr-4 -> psr-0)
3. do not set autoloaders for inactive modules in order to prevent unintentional event listeners from reacting, etc.
4. correct some typos I found

comments are requested before final submission. Please comment before 3 July
Please refactor the index field determination into a separate line for better understandability.