Nico Knoll Posted September 19, 2012 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
ryan Posted September 19, 2012 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.
Nico Knoll Posted September 19, 2012 Author 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
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