Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.1.10, 2.2.7, 2.3.4, 2.4.1
    • Fix Version/s: 2.2.8, 2.3.5, 2.4.2
    • Component/s: Backup, Course
    • Labels:
    • Testing Instructions:
      Hide

      Testing difficulty: Easy, requires Moodle 1.9 available

      1. Create a new course at Moodle 1.9 site
      2. Edit Course files in the course. Create some folders, sub-folders and sub-sub-folders. Upload couple of files into various folders there (including the root)
      3. In the course, create at least two Resources of the type "Display a directory". In one of them, choose "Main files directory" as the displayed folder. In the other one, choose some folder or sub-folder to be displayed.
      4. Backup the course (no need to backup user data not roles assignments but it should not matter).
      5. Restore the course at patched Moodle 2.x
      6. TEST: Make sure the restore works well and all Resources are converted into the Folder modules with files (FYI the expected behaviour is that each Folder module creates its own copy of the original file in the Course files).
      Show
      Testing difficulty: Easy, requires Moodle 1.9 available Create a new course at Moodle 1.9 site Edit Course files in the course. Create some folders, sub-folders and sub-sub-folders. Upload couple of files into various folders there (including the root) In the course, create at least two Resources of the type "Display a directory". In one of them, choose "Main files directory" as the displayed folder. In the other one, choose some folder or sub-folder to be displayed. Backup the course (no need to backup user data not roles assignments but it should not matter). Restore the course at patched Moodle 2.x TEST: Make sure the restore works well and all Resources are converted into the Folder modules with files (FYI the expected behaviour is that each Folder module creates its own copy of the original file in the Course files).
    • Workaround:
      Hide

      Dance lambada for a while to see if it helps.

      Show
      Dance lambada for a while to see if it helps.
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-37774-folder-conversion

      Description

      One of our faculty has a course with a link to "Course Documents" in our 1.9 system. When they backup the course and attempt to restore to 2.x, they are given an error "error/moodle/file invalid path", with debug on, I can see that it having trouble with paths, as it has // in the path name for the debug error.

      It took me a while to find this, but, turning off this particular element in the backup allows for the restore to work.

      To test:
      In moodle 1.9 or prior, add a resource "Display a directory". Point to a directory in your course with files; in my case "Main files directory".

      Backup your course in 1.9
      Restore the course in 2.x

      Receive error message.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            poltawski Dan Poltawski added a comment -

            Verified.

            Show
            poltawski Dan Poltawski added a comment - Verified.
            Hide
            poltawski Dan Poltawski added a comment -

            Attaching a backup file which causes this problem.

            Show
            poltawski Dan Poltawski added a comment - Attaching a backup file which causes this problem.
            Hide
            poltawski Dan Poltawski added a comment -

            Adding David here. David, seems to me like the restore of directory of resource from 1.9 isn't working at all. Is very curious, would've thought we'd picked this up earlier. Wondering if its related to the recent changes from that security issue.

            Show
            poltawski Dan Poltawski added a comment - Adding David here. David, seems to me like the restore of directory of resource from 1.9 isn't working at all. Is very curious, would've thought we'd picked this up earlier. Wondering if its related to the recent changes from that security issue.
            Hide
            mudrd8mz David Mudrak added a comment -

            Radar contact established. Will look at this asap.

            Show
            mudrd8mz David Mudrak added a comment - Radar contact established. Will look at this asap.
            Hide
            mudrd8mz David Mudrak added a comment -

            Houston, we've got a problem. I am able to reproduce the error. It is thrown for resources pointing to the root of the Course files. If the resource in 1.9 is set to point to a subfolder of course files, it is converted into the Folder correctly.

            Show
            mudrd8mz David Mudrak added a comment - Houston, we've got a problem. I am able to reproduce the error. It is thrown for resources pointing to the root of the Course files. If the resource in 1.9 is set to point to a subfolder of course files, it is converted into the Folder correctly.
            Hide
            mudrd8mz David Mudrak added a comment -

            Behold! Development in progress.

            Show
            mudrd8mz David Mudrak added a comment - Behold! Development in progress.
            Hide
            mudrd8mz David Mudrak added a comment -

            This is a regression of MDL-36977

            Show
            mudrd8mz David Mudrak added a comment - This is a regression of MDL-36977
            Hide
            mudrd8mz David Mudrak added a comment -

            This may be partially caused by MDL-32012, too.

            Show
            mudrd8mz David Mudrak added a comment - This may be partially caused by MDL-32012 , too.
            Hide
            mudrd8mz David Mudrak added a comment -

            There was a problem in mod/folder/backup/moodle1/lib.php that has always been passing the trailing slash at the $rootpath parameter of moodle1_file_manager::migrate_directory(). This was not an issue until MDL-36977 landed recently. See commit messages for details of the solution.

            I believe we have to fix this regression at all five branches where MDL-36977 was integrated to (yes, including 2.1 :-S). I have prepared separate branches for all of them. As there are no fields for 2.1 yet, here are locations for it:

            Pull From Repository: git://github.com/mudrd8mz/moodle.git
            Pull Branch: MDL-37774-folder-conversion_21
            Pull Diff URL: https://github.com/mudrd8mz/moodle/compare/MOODLE_21_STABLE...MDL-37774-folder-conversion_21

            Show
            mudrd8mz David Mudrak added a comment - There was a problem in mod/folder/backup/moodle1/lib.php that has always been passing the trailing slash at the $rootpath parameter of moodle1_file_manager::migrate_directory(). This was not an issue until MDL-36977 landed recently. See commit messages for details of the solution. I believe we have to fix this regression at all five branches where MDL-36977 was integrated to (yes, including 2.1 :-S). I have prepared separate branches for all of them. As there are no fields for 2.1 yet, here are locations for it: Pull From Repository: git://github.com/mudrd8mz/moodle.git Pull Branch: MDL-37774 -folder-conversion_21 Pull Diff URL: https://github.com/mudrd8mz/moodle/compare/MOODLE_21_STABLE...MDL-37774-folder-conversion_21
            Hide
            poltawski Dan Poltawski added a comment -

            Integrated to master, 24, 23 and 22, thanks David.

            Note that 2.1 is 100% out of support, we no longer build packages for it, or have the branch checked out, it doesn't get the change.

            Show
            poltawski Dan Poltawski added a comment - Integrated to master, 24, 23 and 22, thanks David. Note that 2.1 is 100% out of support, we no longer build packages for it, or have the branch checked out, it doesn't get the change.
            Hide
            rwijaya Rossiani Wijaya added a comment -

            This is working great.

            Tested for 2.2, 2.3, 2.4 and master

            Test passed.

            Show
            rwijaya Rossiani Wijaya added a comment - This is working great. Tested for 2.2, 2.3, 2.4 and master Test passed.
            Hide
            damyon Damyon Wiese added a comment -

            Congratulations this fix has been added to Moodle!

            You may want to dedicate this issue to someone special on this Valentines day.

            Thanks!

            Show
            damyon Damyon Wiese added a comment - Congratulations this fix has been added to Moodle! You may want to dedicate this issue to someone special on this Valentines day. Thanks!
            Hide
            marycooch Mary Cooch added a comment -
            Show
            marycooch Mary Cooch added a comment - Just made a quick note of this in 2.3 and 2.4 docs http://docs.moodle.org/24/en/Upgrading_FAQ#Courses_with_.22display_a_directory.22_aren.27t_restoring_correctly .

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

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