From 37eafbb6dcc3aa0beebc73dd6fa2c3ebbbd025db Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Thu, 23 Jun 2016 08:37:23 +0800 Subject: [PATCH] MDL-54948 core_files: return false if theres no output from unoconv --- lib/filestorage/file_storage.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/filestorage/file_storage.php b/lib/filestorage/file_storage.php index bc4ce79df38..18e357003b7 100644 --- a/lib/filestorage/file_storage.php +++ b/lib/filestorage/file_storage.php @@ -238,23 +238,24 @@ class file_storage { */ public static function can_convert_documents() { global $CFG; + $currentversion = 0; + $supportedversion = 0.7; $unoconvbin = \escapeshellarg($CFG->pathtounoconv); $command = "$unoconvbin --version"; exec($command, $output); + // If the command execution returned some output, then get the unoconv version. 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) { return false; } - return true; } + return false; } /**