Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-54554

Improve error handling for unoconv (Universal Office Converter)

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      • This test involves updating the code and checking the apache error log.

      Testing

      1. As an Admin go to Site administration > Plugins > Document converters > Manage document converters.
      2. Enable Unoconv
      3. Click on the Unoconv settings link.
      4. Click on the test unoconv path (ensure the unoconv path is properly configured).
      5. If not, configure unoconv following these documentation instructions.
      6. Go to a course and create an assignment.
        1. Make sure that the assignment takes file submissions.
      7. In files/converter/unoconv/classes/converter.php - start_document_conversion() edit the first if statement that contains an error log an set the if condition to true. You can do it by simply adding "true ||" immediately after the parenthesis. Example, for the first condition, change:

        if (!self::are_requirements_met()) {
        to
        if (true || !self::are_requirements_met()) {
        

      8. Log in as a student. Submit a file for the assignment.
      9. Log in as a teacher. Grade the assignment (must be through the grading interface that allows pdf annotation).
      10. View the error log.
      11. Ensure that the error message is shown.
      12. Repeat steps 7 - 10 (don't forget to remove the previous condition change or you will continue getting the previous message) for each if statement that contains an error_log() call in start_document_conversion(), checking that the appropriate message is displayed in the log.
      Show
      This test involves updating the code and checking the apache error log. Testing As an Admin go to Site administration > Plugins > Document converters > Manage document converters. Enable Unoconv Click on the Unoconv settings link. Click on the test unoconv path (ensure the unoconv path is properly configured). If not, configure unoconv following these documentation instructions. Go to a course and create an assignment. Make sure that the assignment takes file submissions. In files/converter/unoconv/classes/converter.php - start_document_conversion() edit the first if statement that contains an error log an set the if condition to true. You can do it by simply adding " true || " immediately after the parenthesis. Example, for the first condition, change: if (!self::are_requirements_met()) { to if (true || !self::are_requirements_met()) { Log in as a student. Submit a file for the assignment. Log in as a teacher. Grade the assignment (must be through the grading interface that allows pdf annotation). View the error log. Ensure that the error message is shown. Repeat steps 7 - 10 (don't forget to remove the previous condition change or you will continue getting the previous message) for each if statement that contains an error_log() call in start_document_conversion(), checking that the appropriate message is displayed in the log.
    • Affected Branches:
      MOODLE_31_STABLE, MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_39_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-54554-master
    • Story Points:
      5
    • Sprint:
      Activity Sprint 2

      Description

      In lib/filestorage/file_storage.php the function create_converted_document is used to call unoconv via a PHP exec() call. The return value is not checked and the $output array is set but never used.

      I don't know if the intention was to revisit this before release but as it stands any problem with unoconv is going to fail silently (nothing logged) which isn't a good thing.

      In order to avoid meltdown in the support forums, this needs to be as robust as it possibly can be.

        Attachments

        1. Confirmed fixed.PNG
          65 kB
          Gladys Basiana
        2. conversion_to_pdf_failed.png
          57 kB
          Eloy Lafuente (stronk7)

          Issue Links

            Activity

              People

              Assignee:
              abgreeve Adrian Greeve
              Reporter:
              howardsmiller Howard Miller
              Peer reviewer:
              Mathew May
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Gladys Basiana
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              71 Vote for this issue
              Watchers:
              61 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/Jun/20

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 6 hours, 5 minutes
                  6h 5m