Module - How to handle dependency during upgrade?

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
rw
Forum Members
Forum Members
Posts: 28
Joined: Thu Nov 08, 2007 7:09 am

Module - How to handle dependency during upgrade?

Post by rw »

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?
NaN

Re: Module - How to handle dependency during upgrade?

Post by NaN »

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.
Last edited by NaN on Wed Apr 22, 2009 9:27 pm, edited 1 time in total.
Post Reply

Return to “Developers Discussion”