diff --git a/files/classes/converter.php b/files/classes/converter.php index 7923908ca3c85..32793d3485e0c 100644 --- a/files/classes/converter.php +++ b/files/classes/converter.php @@ -118,8 +118,8 @@ public function poll_conversion(conversion $conversion) { // Unable to fetch the converter instance. // Reset the status back to PENDING so that it may be picked up again. $conversion->set('status', conversion::STATUS_PENDING); - $conversion->update(); } + $conversion->update(); } // Refresh the status. @@ -134,6 +134,7 @@ public function poll_conversion(conversion $conversion) { if (!$currentconverter) { // No more converters available. $conversion->set('status', conversion::STATUS_FAILED); + $conversion->update(); return $this; } diff --git a/files/converter/unoconv/classes/converter.php b/files/converter/unoconv/classes/converter.php index a8679e293ad04..bbcedf0e73b30 100644 --- a/files/converter/unoconv/classes/converter.php +++ b/files/converter/unoconv/classes/converter.php @@ -105,10 +105,6 @@ public function start_document_conversion(\core_files\conversion $conversion) { return $this; } - // Update the status to IN_PROGRESS. - $conversion->set('status', \core_files\conversion::STATUS_IN_PROGRESS); - $conversion->update(); - // Copy the file to the tmp dir. $uniqdir = make_unique_writable_directory(make_temp_directory('core_file/conversions')); \core_shutdown_manager::register_function('remove_dir', array($uniqdir)); diff --git a/files/tests/converter_test.php b/files/tests/converter_test.php index 6f182c6777db3..950d5932df054 100644 --- a/files/tests/converter_test.php +++ b/files/tests/converter_test.php @@ -417,6 +417,7 @@ public function test_poll_conversion_in_progress() { $conversion->set_sourcefile($file); $conversion->set('targetformat', 'target'); $conversion->set('status', conversion::STATUS_IN_PROGRESS); + $conversion->create(); $converterinstance = $this->get_mocked_converter([ 'poll_conversion_status', @@ -484,6 +485,7 @@ public function test_poll_conversion_none_supported() { 'sourcefileid' => $file->get_id(), 'targetformat' => 'target', ]); + $conversion->create(); $converter->poll_conversion($conversion);