Nico Knoll Posted September 19, 2012 Share Posted September 19, 2012 Hey, it would be nice if you could add something like 'php_version_required' => '5.3' to the modules config and the module managment section of PW would show something like "You have to update to PHP 5.3 to use this module" or so. That would prevent that modules which need a newer version of PHP or PW would disturb the running system. / Nico Link to comment Share on other sites More sharing options...
ryan Posted September 19, 2012 Share Posted September 19, 2012 Do any modules need a newer version of PHP than ProcessWire itself? Guess it's never come up before, but I suppose it could. PHP actually has a very handy function that you can use from your modules to compare against the PHP version or ProcessWire version: if(version_compare(PHP_VERSION, '5.3.0', '<')) { throw new WireException("You must have PHP 5.3 or newer to install this module"); } if(version_compare(wire('config')->version, '2.2.7', '<')) { throw new WireException("You must have ProcessWire 2.2.7 or newer to install this module"); } I was thinking about making the PW version designation part of the getModuleInfo array so that PW would enforce it internally. Link to comment Share on other sites More sharing options...
Nico Knoll Posted September 19, 2012 Author Share Posted September 19, 2012 getModuleInfo - that's what i meant with "modules config". I guess it's much handier than include the code you posted Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now