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

Create a task to clean up unused H5P content

    XMLWordPrintable

Details

    • MOODLE_38_STABLE
    • MOODLE_311_STABLE
    • MDL-66769-311
    • MDL-66769-master
    • Hide
      1. Create a label in a course
      2. Upload an H5P file using the Atto button
      3. Save the label
      4. Access to the course to view the H5P content inside the label.
      5. Remove the label.
      6. Run cron

        php admin cli/cron.php
        

      7. Ensure you can find H5PID of activity to be deleted by running

        SELECT h5p.id, h5p.pathnamehash FROM mdl_h5p h5p LEFT JOIN mdl_files f on f.pathnamehash = h5p.pathnamehash WHERE f.pathnamehash is null;

      8. Ensure you can find files that will be deleted by running (compose comma separated list COMMASEPARATEDIDLIST from result like 3,5,56 etc)

        SELECT id from mdl_files WHERE itemid = H5PID and filearea = 'content' AND component = 'core_h5p';
        

      9. Run cleanup cron task

        php admin/cli/scheduled_task.php --execute='\core\task\h5p_clean_orphaned_records_task'
        

      10. Ensure this sql returns no records:

        SELECT h5p.id, h5p.pathnamehash FROM mdl_h5p h5p LEFT JOIN mdl_files f on f.pathnamehash = h5p.pathnamehash WHERE f.pathnamehash is null;

      11. Ensure that files are actually deleted so the following query return empty set

        SELECT * FROM mdl_files WHERE id IN [COMMASEPARATEDIDLIST];
        

      12. Go to course recycle bin (click cog on course page, then Recycle bin)
      13. Restore your label
      14. Ensure restored label has h5p content
      15. Delete the course
      16. Run cron

        php admin cli/cron.php
        

      17. Run cleanup cron task

        php admin/cli/scheduled_task.php --execute='\core\task\h5p_clean_orphaned_records_task'
        

      18. Restore the course from recycle bin (in category administration)
      19. Ensure label is still available and shows h5p content

       
       

      Show
      Create a label in a course Upload an H5P file using the Atto button Save the label Access to the course to view the H5P content inside the label. Remove the label. Run cron php admin cli/cron.php Ensure you can find H5PID of activity to be deleted by running SELECT h5p.id, h5p.pathnamehash FROM mdl_h5p h5p LEFT JOIN mdl_files f on f.pathnamehash = h5p.pathnamehash WHERE f.pathnamehash is null ; Ensure you can find files that will be deleted by running (compose comma separated list COMMASEPARATEDIDLIST from result like 3,5,56 etc) SELECT id from mdl_files WHERE itemid = H5PID and filearea = 'content' AND component = 'core_h5p' ; Run cleanup cron task php admin/cli/scheduled_task.php --execute= '\core\task\h5p_clean_orphaned_records_task' Ensure this sql returns no records: SELECT h5p.id, h5p.pathnamehash FROM mdl_h5p h5p LEFT JOIN mdl_files f on f.pathnamehash = h5p.pathnamehash WHERE f.pathnamehash is null ; Ensure that files are actually deleted so the following query return empty set SELECT * FROM mdl_files WHERE id IN [COMMASEPARATEDIDLIST]; Go to course recycle bin (click cog on course page, then Recycle bin) Restore your label Ensure restored label has h5p content Delete the course Run cron php admin cli/cron.php Run cleanup cron task php admin/cli/scheduled_task.php --execute= '\core\task\h5p_clean_orphaned_records_task' Restore the course from recycle bin (in category administration) Ensure label is still available and shows h5p content    
    • Moppies Kanban, H5P Sprint 3, H5P Sprint Relase 3.8

    Description

      We need some clean up task to remove unused/removed H5P content.

      Possible scenario:

      1. Create a label in a course
      2. Upload an H5P file using the Atto button
      3. Save the label
      4. Access to the course to view the H5P content inside the label.
      5. Remove the label.

       
       

      Attachments

        Issue Links

          Activity

            People

              ilyatregubov Ilya Tregubov
              sarjona Sara Arjona (@sarjona)
              Carlos Escobedo Carlos Escobedo
              Sara Arjona (@sarjona) Sara Arjona (@sarjona)
              Janelle Barcega Janelle Barcega
              Votes:
              1 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                17/May/21

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 days, 50 minutes
                  3d 50m