Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-34086 META: Increase robustness of upgrade from 1.9 to 2.2
  3. MDL-33652

mdl_resource upgrade bug: Data too long for column 'mainfile'

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.2.3
    • Fix Version/s: 2.2.8
    • Component/s: Resource
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a Moodle 1.9 site and ensure debugging is turned on.
      2. Visit a course and choose to add a file resource.
      3. Create a file that has a file name with the length of 255 characters (including the extension).
      4. Upgrade to 2.2 and ensure the resource module upgrades successfully.
      5. Browse to the course and click to view it.
      Show
      Create a Moodle 1.9 site and ensure debugging is turned on. Visit a course and choose to add a file resource. Create a file that has a file name with the length of 255 characters (including the extension). Upgrade to 2.2 and ensure the resource module upgrades successfully. Browse to the course and click to view it.
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE

      Description

      This has been previously reported in MDL-32851 and incorrectly marked as "not a bug". The issue is quite simple:
      during upgrade of resources, the value from mdl_resource_old.reference is copied into mdl_resource.mainfile but with additional character - "/" (slash) at the beginning. Both fields are varchar(255) so if mdl_resource_old.reference has length of 255, the total length of the string for mdl_resource.mainfile will be 256 - hence the error.
      During an upgrade to the latest version the field mdl_resource.mainfile is dropped - so you won't see it in that table once upgrade is successfully finished.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              markn Mark Nelson
              Reporter:
              tmuras Tomasz Muras
              Peer reviewer:
              Petr Skoda
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Frédéric Massart
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Mar/13