Fixes #5202 defining the global $CONFIG in upgrade_code()