Module - How to handle dependency during upgrade?
Module - How to handle dependency during upgrade?
How do you handle dependencies during the upgrade? I would like to update a module, but for the new version a dependency is required. What should I add to the 'method.upgrade.php' file in order that check for the dependency? Or does CMSMS already check the dependency when I set for value for: GetDependencies during the upgrade?
Re: Module - How to handle dependency during upgrade?
To be honest, i don't know.
But it is an interesting question.
You just need to add this new dependency in the function GetDependencies() of YourModule.module.php.
But the module is already installed.
And therefore there might be no information about missing dependencies.
But since you check in your module for that dependency (i hope you do) it should print out your error message if some needed modules are not installed when you want to enter the admin panel of your module.
You can also insert information about that in your language files where the "upgrade post message" is defined.
But no matter what you do, the client sees what is also needed only after upgrading.
Another idea would be to check for the needed modules also in the method.upgrade.php and print out a message before upgrading.
So upgrade is only executed if everything is there.
But the client has already copied the new files to the server and this means, you need to upgrade to get this new version run properly.
In every case you should mention that new dependency in the documentation and the changelog.
But it is an interesting question.
You just need to add this new dependency in the function GetDependencies() of YourModule.module.php.
But the module is already installed.
And therefore there might be no information about missing dependencies.
But since you check in your module for that dependency (i hope you do) it should print out your error message if some needed modules are not installed when you want to enter the admin panel of your module.
You can also insert information about that in your language files where the "upgrade post message" is defined.
But no matter what you do, the client sees what is also needed only after upgrading.
Another idea would be to check for the needed modules also in the method.upgrade.php and print out a message before upgrading.
So upgrade is only executed if everything is there.
But the client has already copied the new files to the server and this means, you need to upgrade to get this new version run properly.
In every case you should mention that new dependency in the documentation and the changelog.
Last edited by NaN on Wed Apr 22, 2009 9:27 pm, edited 1 time in total.