mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 14:03:52 +01:00
MDL-54948 core_files: return false if theres no output from unoconv
This commit is contained in:
parent
797b7efc0b
commit
37eafbb6dc
@ -238,23 +238,24 @@ class file_storage {
|
|||||||
*/
|
*/
|
||||||
public static function can_convert_documents() {
|
public static function can_convert_documents() {
|
||||||
global $CFG;
|
global $CFG;
|
||||||
|
$currentversion = 0;
|
||||||
|
$supportedversion = 0.7;
|
||||||
$unoconvbin = \escapeshellarg($CFG->pathtounoconv);
|
$unoconvbin = \escapeshellarg($CFG->pathtounoconv);
|
||||||
$command = "$unoconvbin --version";
|
$command = "$unoconvbin --version";
|
||||||
exec($command, $output);
|
exec($command, $output);
|
||||||
|
// If the command execution returned some output, then get the unoconv version.
|
||||||
if ($output) {
|
if ($output) {
|
||||||
$currentversion = 0;
|
|
||||||
foreach ($output as $response) {
|
foreach ($output as $response) {
|
||||||
if (preg_match('/unoconv (\\d+\\.\\d+)/', $response, $matches)) {
|
if (preg_match('/unoconv (\\d+\\.\\d+)/', $response, $matches)) {
|
||||||
$currentversion = (float)$matches[1];
|
$currentversion = (float)$matches[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$supportedversion = 0.7;
|
|
||||||
if ($currentversion < $supportedversion) {
|
if ($currentversion < $supportedversion) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user