Generally I like the new approach, to disable the old one to avoid the latter conflict.
By not existing early the new one would be enabled as intended.
A few questions:
Improved wording
"Disabling $PHP_MODULE" -> "Disabling old $PHP_MODULE"
If you insist on being perfect since this would also trigger on downgrades you can version-compare and say "old/new" but downgrades are nonono anyway, so a static "old" will do as well.
"failed to enable $PHP_MODULE"
That should now better be something like:
"failed to disable old $PHP_MODULE module"
In some of the SRUs backports the php version in the message needs to change at "favor of using PHP 7.4".
If you want you might use @PHP_VERSION@ to get code that is the same for all releases.
Generally I like the new approach, to disable the old one to avoid the latter conflict.
By not existing early the new one would be enabled as intended.
A few questions:
Improved wording
"Disabling $PHP_MODULE" -> "Disabling old $PHP_MODULE"
If you insist on being perfect since this would also trigger on downgrades you can version-compare and say "old/new" but downgrades are nonono anyway, so a static "old" will do as well.
"failed to enable $PHP_MODULE"
That should now better be something like:
"failed to disable old $PHP_MODULE module"
In some of the SRUs backports the php version in the message needs to change at "favor of using PHP 7.4".
If you want you might use @PHP_VERSION@ to get code that is the same for all releases.