Forward port 7.0 until 856f3881aba

The actual conflict resultion commit is cf4c5bf0a0932700b92ee13ad159cfc94cfcf811, best viewed in gitk

Preparing 8.0 migration.