MDL-41245 fix multiple install, upgrade and uninstallation issues

Includes rework of cache parameter detection on admin/index.php.

Another problem is that uninstall does not leave system in consistent state,
we need to force users to go through upgrade after any type of uninstall.

This fixes also add-on installation redirect and other issues.