upgrade mode is handled elsewhere. And yes, there is huge duplication of code ... but I need to investigate it more deeply.

In fact, this code is not accessed during upgrade.