Skip to content

Commit

Permalink
Merge branch 'MDL-55513-master' of https://github.com/lucisgit/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Aug 15, 2016
2 parents c470716 + 2ee668e commit 40cc0ba
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/filestorage/file_storage.php
Expand Up @@ -365,7 +365,7 @@ protected function create_converted_document(stored_file $file, $format) {
throw new file_exception('storedfileproblem', 'Could not copy file contents to temp file.');
}
} catch (file_exception $fe) {
remove_dir($uniqdir);
remove_dir($tmp);
throw $fe;
}

Expand All @@ -386,8 +386,9 @@ protected function create_converted_document(stored_file $file, $format) {
chdir($tmp);
$result = exec($cmd, $output);
chdir($currentdir);
if (!file_exists($newtmpfile)) {
remove_dir($uniqdir);
touch($newtmpfile);
if (filesize($newtmpfile) === 0) {
remove_dir($tmp);
// Cleanup.
return false;
}
Expand All @@ -404,7 +405,7 @@ protected function create_converted_document(stored_file $file, $format) {

$convertedfile = $this->create_file_from_pathname($record, $newtmpfile);
// Cleanup.
remove_dir($uniqdir);
remove_dir($tmp);
return $convertedfile;
}

Expand Down

0 comments on commit 40cc0ba

Please sign in to comment.