Dependencies of Modules on PHP/MySQL

Dependencies of Modules on PHP/MySQL

Lloyd Stock -
回帖数:4
Hi,
I've a few questions which have to do with the ability of a particular PHP version or MySQL version to break my moodle module. This goes without saying that the Moodle version itself may break my module.

1. When developing a Moodle module what should be my approach to developing such that I avoid becoming dependant on PHP and MySQL?

2. Or am I being unnecessarily cautious. Is Moodle designed in such a way that as a developer of Moodle modules, all I have to worry about is the Moodle version. The next Moodle version will take care of PHP and MySQL changes etc. and ensure that my module functions normally?

Many thanks for a prompt reply on this.
lstocky
回复Lloyd Stock

Re: Dependencies of Modules on PHP/MySQL

Howard Miller -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像
Each version of Moodle has a minimum PHP version requirement. For lots of reasons you will need to decide the minimum Moodle version that your module will work with (you have to put it in version.php!). You should not use any features that are only in newer versions of PHP. Simple as that really.

MySQL is much less of an issue, as you should use the provided data access functions in the api. This will maximise your compatibility with all supported databases.

See also: http://docs.moodle.org/en/Installing_Moodle#Requirements
回复Howard Miller

Re: Dependencies of Modules on PHP/MySQL

Lloyd Stock -
Howard - thanks for this.
makes it a lot clearer.

where can I find information on version.php?




回复Lloyd Stock

Re: Dependencies of Modules on PHP/MySQL

Howard Miller -
Core developers的头像 Documentation writers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像
Well it's just one of the files that matters if you are writing your own module. There's not a lot of documentation for this unfortunately. I guess it's one of the more daunting tasks, but the best thing is to probably study the existing modules' code.