Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-32999 META: Files UI Stage 2 polishing in master
  3. MDL-33409

Newly copied files should take on the userid of the current user, and dates reset

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.3
    • Fix Version/s: 2.3
    • Component/s: Files API
    • Labels:
    • Testing Instructions:
      Hide

      1. Login as admin/teacher USER1
      2. Create a file/folder resource and add files there
      3. Login as admin/teacher USER2
      4. Create a file/folder resource
      5. Add files created in #2 from Server files repository using filepicker (change the name when adding them so you don't confuse them with those from #2 later)
      6. Make sure the files from #5 have timecreated and timemodified as of now
      7. Save changes and start editing again
      8. Make sure that you can see files from #5 in your Recent files (which means that you are the owner)
      9. You can also login as USER1 and make sure you DO NOT see files from #5 in your Recent files (because you are not the owner)

      Show
      1. Login as admin/teacher USER1 2. Create a file/folder resource and add files there 3. Login as admin/teacher USER2 4. Create a file/folder resource 5. Add files created in #2 from Server files repository using filepicker (change the name when adding them so you don't confuse them with those from #2 later) 6. Make sure the files from #5 have timecreated and timemodified as of now 7. Save changes and start editing again 8. Make sure that you can see files from #5 in your Recent files (which means that you are the owner) 9. You can also login as USER1 and make sure you DO NOT see files from #5 in your Recent files (because you are not the owner)
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:
      wip-MDL-33409-master

      Description

      The userid field generally should mean "the person who created this file record".

      When a file is copied from another existing file in Moodle, the new copy should have the userid of the current user, and all timestamps reset to the current time.

      Apparently this is not currently the case - the userid and timestamps are blindly copied.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            skodak Petr Skoda added a comment -

            Look for $file_info->copy_to_storage() and $fs->create_file_from_storedfile() in repository code, it will probably require new parameter in file_browser abstraction layer.

            Show
            skodak Petr Skoda added a comment - Look for $file_info->copy_to_storage() and $fs->create_file_from_storedfile() in repository code, it will probably require new parameter in file_browser abstraction layer.
            Hide
            marina Marina Glancy added a comment -

            also has fixes for MDL-33445 because I noticed it while working on this issue

            Show
            marina Marina Glancy added a comment - also has fixes for MDL-33445 because I noticed it while working on this issue
            Hide
            poltawski Dan Poltawski added a comment -

            The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

            TIA and ciao

            Show
            poltawski Dan Poltawski added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
            Hide
            poltawski Dan Poltawski added a comment -

            Hi Marina,

            Changing the parameters of these public methods makes me nervous. Nowhere else is going to be using them?

            Show
            poltawski Dan Poltawski added a comment - Hi Marina, Changing the parameters of these public methods makes me nervous. Nowhere else is going to be using them?
            Hide
            marina Marina Glancy added a comment -

            Dan, those functions are used only in this context. I actually made their parameters more unified with how file_storage pass information about files.

            For example, repository/recent/lib.php overwrite copy_to_area (because it can't use file_info, and there is another issue for that: MDL-33297) and instead of using file_info accesses directly
            file_storage::create_file_from_storedfile passing $filerecord

            Show
            marina Marina Glancy added a comment - Dan, those functions are used only in this context. I actually made their parameters more unified with how file_storage pass information about files. For example, repository/recent/lib.php overwrite copy_to_area (because it can't use file_info, and there is another issue for that: MDL-33297 ) and instead of using file_info accesses directly file_storage::create_file_from_storedfile passing $filerecord
            Hide
            poltawski Dan Poltawski added a comment -

            OK. I've integrated this now.

            I don't like the two newly introduced variable names with underscores, but its inconsistent around there already. Please avoid in future. Its a shame you didn't get rid of that double ; too!

            Show
            poltawski Dan Poltawski added a comment - OK. I've integrated this now. I don't like the two newly introduced variable names with underscores, but its inconsistent around there already. Please avoid in future. Its a shame you didn't get rid of that double ; too!
            Hide
            poltawski Dan Poltawski added a comment -

            I pulled in the other commit you provided, thanks

            Show
            poltawski Dan Poltawski added a comment - I pulled in the other commit you provided, thanks
            Hide
            ankit_frenz Ankit Agarwal added a comment -

            Hi,
            This works perfectly.
            Passing
            Thanks!

            Show
            ankit_frenz Ankit Agarwal added a comment - Hi, This works perfectly. Passing Thanks!
            Hide
            ankit_frenz Ankit Agarwal added a comment - - edited

            Hi Marina,

            After the recent commit that Dan pulled in , I was able to add files larger than the size limit on the course as an alias.

            So MDL-33445 is failing. leaving this open for Marina to comment.
            Thanks

            Show
            ankit_frenz Ankit Agarwal added a comment - - edited Hi Marina, After the recent commit that Dan pulled in , I was able to add files larger than the size limit on the course as an alias. So MDL-33445 is failing. leaving this open for Marina to comment. Thanks
            Hide
            marina Marina Glancy added a comment -

            Ankit, forgot to exclude MDL-33445 from testing instructions. It was decided that maxbytes should not affect inserting files by reference, that issue is closed. Actually, the third commit is the rollback of these changes.

            Show
            marina Marina Glancy added a comment - Ankit, forgot to exclude MDL-33445 from testing instructions. It was decided that maxbytes should not affect inserting files by reference, that issue is closed. Actually, the third commit is the rollback of these changes.
            Hide
            ankit_frenz Ankit Agarwal added a comment -

            Thanks for the clarification.

            Show
            ankit_frenz Ankit Agarwal added a comment - Thanks for the clarification.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            We could celebrate it today... but better if we perform a bigger party after releasing Moodle 2.3.

            Print this message and come to Perth that day, it's valid for one beer, wine, coke or... water, as you wish.

            Many thanks for your collaboration!

            Ciao

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - We could celebrate it today... but better if we perform a bigger party after releasing Moodle 2.3. Print this message and come to Perth that day, it's valid for one beer, wine, coke or... water, as you wish. Many thanks for your collaboration! Ciao

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  25/Jun/12