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

Duplicated files from activity duplication should have current timestamps

    XMLWordPrintable

Details

    • MOODLE_401_STABLE
    • MDL-71198-master
    • Hide

      Prerequisite: Have an active Database connection to execute SQL in.

      1) Create a blank test course

      2) Enable editing mode inside the newly created test course.

      3) Click 'Add an activity or resource', and select a label activity.

      4) Inside the new label form, name the label 'test'.

      5) Inside the label form content field, insert an image, by clicking the 'Insert Image' button inside the Editor toolbar, and upload an image using the filepicker.

      6) In your database shell, execute the following:

      SELECT id, contextid, component, filename, timecreated, timemodified FROM mdl_files ORDER BY id DESC;
      

      7) Find the file entry for the file you uploaded to the label by matching the filename to the uploaded file. The component will be mod_label. Take note of the timemodified and created.

      8) On the course page, click the edit menu next to the activity created, and click on 'duplicate'.

      9) Run the same SQL command in your database shell.

      10) Verify that the latest entry for the file uploaded is more recent than the previous entry from step 7.

       

      Upgrade is covered by unit tests.

      Show
      Prerequisite: Have an active Database connection to execute SQL in. 1) Create a blank test course 2) Enable editing mode inside the newly created test course. 3) Click 'Add an activity or resource', and select a label activity. 4) Inside the new label form, name the label 'test'. 5) Inside the label form content field, insert an image, by clicking the 'Insert Image' button inside the Editor toolbar, and upload an image using the filepicker. 6) In your database shell, execute the following: SELECT id, contextid, component, filename, timecreated, timemodified FROM mdl_files ORDER BY id DESC; 7) Find the file entry for the file you uploaded to the label by matching the filename to the uploaded file. The component will be mod_label. Take note of the timemodified and created. 8) On the course page, click the edit menu next to the activity created, and click on 'duplicate' . 9) Run the same SQL command in your database shell. 10) Verify that the latest entry for the file uploaded is more recent than the previous entry from step 7.   Upgrade is covered by unit tests.

    Description

      When duplicating an activity (such as a label) inside a course, the files record for attached files is duplicated  but the timestamps for the file are not updated, even though the context for the file has changed. This is even more misleading because the directory created for the new context DOES have a new timestamp, when they should be in lockstep, as the records were both created at the same time.

      Files table after a video label duplication:

        id   | contextid |        filename         | timecreated | timemodified
      -------+-----------+-------------------------+-------------+--------------
       20621 |       263 | .                       |  1616718908 |   1616718908
       20620 |       263 | JSONpost.mp4            |  1616645767 |   1616645773
      ...
       20593 |       257 | .                       |  1616645767 |   1616645773
       20592 |       257 | JSONpost.mp4            |  1616645767 |   1616645773
      

       

       

      Attachments

        Issue Links

          Activity

            People

              peterburnett Peter Burnett
              peterburnett Peter Burnett
              Kevin Pham Kevin Pham
              Jun Pataleta Jun Pataleta
              Angelia Dela Cruz Angelia Dela Cruz
              Adrian Greeve, David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo, Matteo Scaramuccia, David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                28/Nov/22

                Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours
                  3h