* @param environment_results $result object to update, if relevant.
* @return environment_results|null updated results or null if unoconv path is not executable.
*/
-function check_unoconv_version(environment_results $result){
+function check_unoconv_version(environment_results $result) {
global $CFG;
- if (!during_initial_install() && !empty($CFG->pathtounoconv) && is_executable(trim($CFG->pathtounoconv))) {
-
- if (assignfeedback_editpdf\pdf::check_unoconv_version_support() === false) {
+ if (!during_initial_install() && !empty($CFG->pathtounoconv) && file_is_executable(trim($CFG->pathtounoconv))) {
+ $unoconvbin = \escapeshellarg($CFG->pathtounoconv);
+ $command = "$unoconvbin --version";
+ exec($command, $output);
+ preg_match('/([0-9]+\.[0-9]+)/', $output[0], $matches);
+ $currentversion = (float)$matches[0];
+ $supportedversion = 0.7;
+ if ($currentversion < $supportedversion) {
$result->setInfo('unoconv version not supported');
$result->setStatus(false);
return $result;