MDL-53923 mod_assign: Movement of functions to file_storage.
[moodle.git] / lib / upgradelib.php
index d80f6c0..969eeb7 100644 (file)
@@ -2288,12 +2288,17 @@ function upgrade_install_plugins(array $installable, $confirmed, $heading='', $c
  * @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;