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

Portfolio incorrectly using stored_file instead of file id

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3
    • Fix Version/s: 3.3
    • Component/s: Files API, Portfolio
    • Labels:
    • Testing Instructions:
      Hide

      This test requires the following:

      • Portfolios and the File download and Mahara portfolio plugins enabled for the site
      • Enable Leap2A portfolio support in Mahara portfolio settings must be set to "Yes".
      • A course containing a forum activity.
      • A Mahara site for use in testing (see here and here for help)

      File download export test:

      1. Login as a student, and access the forum activity.
      2. Try exporting one of your forum posts, selecting file download as the portfolio.
      3. Save the file locally then open it and check that all data has been exported correctly.
      4. Repeat the process for a post with an attachment and confirm you can see the files inside the generated zip file. Open the zip and check this.
      5. View a forum post made by another student and check that you are unable to export it.

      Mahara export test:

      1. Set up mahara sso, as per the links above. Stop at the end of page 30!! Don't bother testing SSO the other way around - we don't need that here.
      2. In Mahara, make sure your institution's auth module (XMLRPC) settings have been set up to receive imports. The field 'We import content' must be set to 'Yes'.
      3. Now, from Moodle, try exporting one of your forum posts (you should see Mahara ePortfolio as a destination during the export process) using the 'HTML' option.
      4. Confirm that the export was successful and that you can see the exported file in Mahara - it'll be under the 'Content' -> 'Journals' in the upper right menu.
      5. Try again, this time using the Leap2a format and confirm that works.
      6. Repeat for a post with an attachment and confirm it works too.

      Upgrade test:

      1. Revert this patch
      2. Delete all records from portfolio_tempdata
      3. Now, as a student, begin an export to mahara but when asked to confirm it, simply click on course home in the nav. (or some other page). Don't formally cancel it.
      4. Do the same for a file download export.
      5. Confirm that you see 2 records in the portfolio_tempdata table
      6. Now, apply the patch and run the upgrade.
      7. Confirm that you see no records in the portfolio_tempdata table now.
      8. Run cron and confirm that:
        • You see the portfolio cron task run.
        • You don't see any errors or warnings in the portfolio cron task output.
      9. Now, run through steps 1 to 5 to create a couple of stale export records.
      10. Run the cron, and confirm that:
        • You see the portfolio task run.
        • The records are still present.
      11. Now, expire the records by setting their 'expirytime' to the current unixtimestamp.
      12. Repeat the cron and confirm that:
        • You see the portfolio task run.
        • The records are removed without any warnings.
      Show
      This test requires the following: Portfolios and the File download and Mahara portfolio plugins enabled for the site Enable Leap2A portfolio support in Mahara portfolio settings must be set to "Yes". A course containing a forum activity. A Mahara site for use in testing (see  here and here  for help) File download export test: Login as a student, and access the forum activity. Try exporting one of your forum posts, selecting file download as the portfolio. Save the file locally then open it and check that all data has been exported correctly. Repeat the process for a post with an attachment and confirm you can see the files inside the generated zip file. Open the zip and check this. View a forum post made by another student and check that you are unable to export it. Mahara export test: Set up mahara sso, as per the links above. Stop at the end of page 30!! Don't bother testing SSO the other way around - we don't need that here. In Mahara, make sure your institution's auth module (XMLRPC) settings have been set up to receive imports. The field 'We import content' must be set to 'Yes'. Now, from Moodle, try exporting one of your forum posts (you should see Mahara ePortfolio as a destination during the export process) using the 'HTML' option. Confirm that the export was successful and that you can see the exported file in Mahara - it'll be under the 'Content' -> 'Journals' in the upper right menu. Try again, this time using the Leap2a format and confirm that works. Repeat for a post with an attachment and confirm it works too. Upgrade test: Revert this patch Delete all records from portfolio_tempdata Now, as a student, begin an export to mahara but when asked to confirm it, simply click on course home in the nav. (or some other page). Don't formally cancel it. Do the same for a file download export. Confirm that you see 2 records in the portfolio_tempdata table Now, apply the patch and run the upgrade. Confirm that you see no records in the portfolio_tempdata  table now. Run cron and confirm that: You see the portfolio cron task run. You don't see any errors or warnings in the portfolio cron task output. Now, run through steps 1 to 5 to create a couple of stale export records. Run the cron, and confirm that: You see the portfolio task run. The records are still present. Now, expire the records by setting their 'expirytime' to the current unixtimestamp. Repeat the cron and confirm that: You see the portfolio task run. The records are removed without any warnings.
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-58684-master-2

      Description

      Discovered by MDLQA-10726 and MDLQA-10504. Basically, portfolio tries to serialize the stored_file class, which contains the file_system_filedir instance - which itself cannot be serialized any more (__wakeup is final in the file_system superclass). Portfolio should use file ids instead. This behaviour was changed in MDL-46375.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jaked Jake Dallimore
                Reporter:
                jaked Jake Dallimore
                Peer reviewer:
                Dan Poltawski
                Integrator:
                Andrew Nicols
                Tester:
                David Mudrák (@mudrd8mz)
                Participants:
                Component watchers:
                Matteo Scaramuccia, Jake Dallimore, Jun Pataleta, Ryan Wyllie, Amaia Anabitarte, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  15/May/17