Skip to content

Commit

Permalink
MDL-54948 core_upgrade: fix unoconv check on the environment page
Browse files Browse the repository at this point in the history
  • Loading branch information
lameze committed Jun 21, 2016
1 parent 9254ba0 commit 6937d89
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions lib/upgradelib.php
Expand Up @@ -2297,13 +2297,19 @@ function check_unoconv_version(environment_results $result) {
$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;
if ($output) {
$currentversion = 0;
foreach ($output as $response) {
if (preg_match('/unoconv (\\d+\\.\\d+)/', $response, $matches)) {
$currentversion = (float)$matches[1];
}
}
$supportedversion = 0.7;
if ($currentversion < $supportedversion) {
$result->setInfo('unoconv version not supported');
$result->setStatus(false);
return $result;
}
}
}
return null;
Expand Down

0 comments on commit 6937d89

Please sign in to comment.