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

Clean up temporary H5P editor files

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Requirements

      1. Access to DB (to run some SQL queries).

      Setup. IMPORTANT: It should be run before applying the patch!!

      1. Login as admin.
      2. Access to the Content bank.
      3. Upload the attached file.
      4. Access to the main page of the Content bank
      5. Add a new "Greeting card" content.
      6. Fill in all the form fields. In the "Card image" section, upload an image.
      7. Save the content.
      8. Check the greeting card is displayed and contains the uploaded image.
      9. Check the result of the following SQL query is higher than 0: 

        SELECT count(*)
        FROM mdl_files
        WHERE component='core_h5p' AND filearea='editor'

      10. Apply this patch to the branch (or checkout the branch to the latest integration commit).

      Testing scenario 1: Upgrade process removes unused 'editor' files

      1.  Login as admin.
      2. Run the upgrade process.
      3. Check the upgrade process finishes without errors.
      4. Check the result of the following SQL query is 0: 

        SELECT count(*)
        FROM mdl_files
        WHERE component='core_h5p' AND filearea='editor'

      Testing scenario 2: Edit H5P content with images

      1. Access to the "greeting-card.h5p" H5P content in the content bank.
      2. Click the "Edit" button.
      3. Check the "Card image" is displayed (is should show the Earth).
      4. Remove this image and upload a new one.
      5. Check the new image is displayed properly in the "Card image" section.
      6. Save.
      7. Check now the greeting card contains the uploaded image (instead of the Earth).
      8. Click the "Edit" button again.
      9. Check the "Card image" is displayed (it should show the new image uploaded).
      10. Check the result of the following SQL query is 0: 

        SELECT count(*)
        FROM mdl_files
        WHERE component='core_h5p' AND filearea='editor'

       

      Testing scenario 3: Create new H5P content with images

      1. Access to the content bank
      2. Add a new "Greeting card" content.
      3. Fill in all the form fields.
      4. In the "Card image" section, upload an image.
      5. Check the new image is displayed properly in the "Card image" section.
      6. Save the content.
      7. Check the greeting card contains the uploaded image.
      8. Click the "Edit" button.
      9. Check the "Card image" is displayed as expected.
      10. Check the result of the following SQL query is still 0: 

        SELECT count(*)
        FROM mdl_files
        WHERE component='core_h5p' AND filearea='editor'

       
       

      Show
      Requirements Access to DB (to run some SQL queries). Setup. IMPORTANT: It should be run before applying the patch!! Login as admin. Access to the Content bank. Upload the attached file. Access to the main page of the Content bank Add a new "Greeting card" content. Fill in all the form fields. In the "Card image" section, upload an image. Save the content. Check the greeting card is displayed and contains the uploaded image. Check the result of the following SQL query is higher than 0:  SELECT count(*) FROM mdl_files WHERE component='core_h5p' AND filearea='editor' Apply this patch to the branch (or checkout the branch to the latest integration commit). Testing scenario 1: Upgrade process removes unused 'editor' files  Login as admin. Run the upgrade process. Check the upgrade process finishes without errors. Check the result of the following SQL query is 0:  SELECT count(*) FROM mdl_files WHERE component='core_h5p' AND filearea='editor' Testing scenario 2: Edit H5P content with images Access to the "greeting-card.h5p" H5P content in the content bank. Click the "Edit" button. Check the "Card image" is displayed (is should show the Earth). Remove this image and upload a new one. Check the new image is displayed properly in the "Card image" section. Save. Check  now the greeting card contains the uploaded image (instead of the Earth). Click the "Edit" button again. Check the "Card image" is displayed (it should show the new image uploaded). Check the result of the following SQL query is 0:  SELECT count(*) FROM mdl_files WHERE component='core_h5p' AND filearea='editor'   Testing scenario 3: Create new H5P content with images Access to the content bank Add a new "Greeting card" content. Fill in all the form fields. In the "Card image" section, upload an image. Check the new image is displayed properly in the "Card image" section. Save the content. Check the greeting card contains the uploaded image. Click the "Edit" button. Check the "Card image" is displayed as expected. Check the result of the following SQL query is still 0:  SELECT count(*) FROM mdl_files WHERE component='core_h5p' AND filearea='editor'    
    • Affected Branches:
      MOODLE_310_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • Fixed Branches:
      MOODLE_310_STABLE
    • Pull from Repository:
    • Pull 3.10 Branch:
      MDL-68909-310
    • Pull Master Branch:
      MDL-68909-master
    • Sprint:
      Moppies Kanban

      Description

      When accessing the H5P editor (for instance, via the content bank), all the files are temporarily uploaded to the component='core_h5p' and filearea='editor'. Although these files are copied to the correct component/filearea&friends once the content is saved, these temporary files are never removed.

      There are several approaches/things to look at here (not necessarily all they should be done... it will depend on the findings):

      1. Create a clean task for removing the files with component='core_h5p' and filearea='editor' older than 1 day (or so).
      2. Check if these temporary files can be removed once they are moved to the content.
      3. Check if draft files might replace this component/filearea.

       

      Although this issue has been created as an improvement, if these files are not removed at any point they may collision with existing (but unused) files... so if this issue is not fixed soon, it might become a bug  

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sarjona Sara Arjona (@sarjona)
              Reporter:
              sarjona Sara Arjona (@sarjona)
              Peer reviewer:
              Amaia Anabitarte
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Anna Carissa Sadia
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Nov/20

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 days, 3 hours
                  2d 3h