Details

    • Database:
      MySQL
    • Testing Instructions:
      Hide
      1. Create a 1.9 site.
      2. Log in as an administrator.
      3. Visit <yoursite>/admin/settings.php?section=frontpagesettings and set 'List of courses' for frontpageloggedin setting and save.
      4. Visit the front page and turn editing on.
      5. Add a database activity with any name and introduction.
      6. Click on the database once it has been created.
      7. Click on 'Add Entry' and add a few entries.
      8. Click on the 'Presets' tab and click 'Save' next to 'Save as presets'.
      9. Do the last step multiple times saving under a different name each time, remember the names you used to create the presets.
      10. Log in as another user and perform step 8 using the same preset names you used earlier.
      11. You might want to take a database dump at this time of your 1.9 site.
      12. Upgrade to version 2.2 and check that the presets you created site wide remain. Note, in 2.x you can not create a preset using an existing name by another user, though you could in 1.9. This is why we created multiple presets with the same name for different users to ensure the upgrade can handle this scenario.
      13. Clear the database and use the database dump to restore it back to 1.9 and upgrade to the other Moodle versions that have this fix applied.
      Show
      Create a 1.9 site. Log in as an administrator. Visit <yoursite>/admin/settings.php?section=frontpagesettings and set 'List of courses' for frontpageloggedin setting and save. Visit the front page and turn editing on. Add a database activity with any name and introduction. Click on the database once it has been created. Click on 'Add Entry' and add a few entries. Click on the 'Presets' tab and click 'Save' next to 'Save as presets'. Do the last step multiple times saving under a different name each time, remember the names you used to create the presets. Log in as another user and perform step 8 using the same preset names you used earlier. You might want to take a database dump at this time of your 1.9 site. Upgrade to version 2.2 and check that the presets you created site wide remain. Note, in 2.x you can not create a preset using an existing name by another user, though you could in 1.9. This is why we created multiple presets with the same name for different users to ensure the upgrade can handle this scenario. Clear the database and use the database dump to restore it back to 1.9 and upgrade to the other Moodle versions that have this fix applied.
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-29334_master
    • Rank:
      18867

      Description

      None of the site-wide database activity presets we added to our Moodleinstallation is there anymore after upgrading. The function data_get_available_presets in mod/data/lib.php returns only the preset that exist within the mod/data directory. The function data_get_available_site_presets returns nothing. DATA_PRESET_FILEAREA is set to 'site-preset' but there are no files in the database with SELECT * FROM `mdl_files` WHERE `filearea` = 'site_presets'.
      In the dataroot of the installation all the presets are there as before in ..../dataroot/data/preset/courseid
      It seems as if with these files nothing happened during upgrade?

        Issue Links

          Activity

          Hide
          Michael de Raadt added a comment -

          Thanks for reporting this.

          Show
          Michael de Raadt added a comment - Thanks for reporting this.
          Hide
          Katja Krüger added a comment -

          The presets are not in dataroot/data/preset/courseid but in dataroot/data/preset/userid

          Show
          Katja Krüger added a comment - The presets are not in dataroot/data/preset/courseid but in dataroot/data/preset/userid
          Hide
          Katja Krüger added a comment -

          I tried to get the presets back and copied the data/preset directory from the server to my lokal mashine, went into it and zipped a preset folder, than I tried to import it as a preset into a new database I made in the Moodle 2 installation. I got a invaliddata error. I attache the zipped preset in the hope that somebody can tell me what to do to get all the presets back into the new upgraded installation

          Show
          Katja Krüger added a comment - I tried to get the presets back and copied the data/preset directory from the server to my lokal mashine, went into it and zipped a preset folder, than I tried to import it as a preset into a new database I made in the Moodle 2 installation. I got a invaliddata error. I attache the zipped preset in the hope that somebody can tell me what to do to get all the presets back into the new upgraded installation
          Hide
          Michael de Raadt added a comment -

          I'm bumping this issue as it has now been duplicated and I think it is more serious than it was previously prioritised.

          Feel free to help us work on this issue. If you are able to provide a patch or links to your Git repository branch, please add a patch label so we will spot it.

          Show
          Michael de Raadt added a comment - I'm bumping this issue as it has now been duplicated and I think it is more serious than it was previously prioritised. Feel free to help us work on this issue. If you are able to provide a patch or links to your Git repository branch, please add a patch label so we will spot it.
          Hide
          Mark Nelson added a comment -

          Once this clears peer review I will create a branch for 2.3 and master.

          Show
          Mark Nelson added a comment - Once this clears peer review I will create a branch for 2.3 and master.
          Hide
          Adrian Greeve added a comment -

          [Y] Syntax
          [-] Output
          [Y] Whitespace
          [-] Language
          [Y] Databases
          [Y] Testing
          [-] Security
          [-] Documentation
          [*] Git
          [Y] Sanity check

          • Minor spelling mistake on line 363.
          • I personally would like to have any old preset that has the same name as a current preset saved. Maybe with an addition to the file name of 'old' or something like that, rather then just deleting it. I know that this is probably highly unlikely to happen, but there is still a chance.
          • I don't think any specific guidelines have been discussed, but there seems to be a general consensus to use a frankenstyle component name e.g. mod_data.
            I like the code. It's well commented and easy to follow.
          Show
          Adrian Greeve added a comment - [Y] Syntax [-] Output [Y] Whitespace [-] Language [Y] Databases [Y] Testing [-] Security [-] Documentation [*] Git [Y] Sanity check Minor spelling mistake on line 363. I personally would like to have any old preset that has the same name as a current preset saved. Maybe with an addition to the file name of 'old' or something like that, rather then just deleting it. I know that this is probably highly unlikely to happen, but there is still a chance. I don't think any specific guidelines have been discussed, but there seems to be a general consensus to use a frankenstyle component name e.g. mod_data. I like the code. It's well commented and easy to follow.
          Hide
          Mark Nelson added a comment -

          Dear Adrian, my kind sir, I have updated it as you requested. I am much obliged. Would it be at all possible that I bother you for another peer review on this beautiful afternoon?

          Show
          Mark Nelson added a comment - Dear Adrian, my kind sir, I have updated it as you requested. I am much obliged. Would it be at all possible that I bother you for another peer review on this beautiful afternoon?
          Hide
          Adrian Greeve added a comment -

          I had a look at the changes that you made.
          They all look good to me.
          Feel free to submit to integration when you're ready.

          Show
          Adrian Greeve added a comment - I had a look at the changes that you made. They all look good to me. Feel free to submit to integration when you're ready.
          Hide
          Dan Poltawski added a comment -

          Hi Mark,

          I'm afraid there are a few issues:

          1. You can't raise the version number in all branches like that, you need to keep the main YYYYMMDD part of it static and just increment. The reason is that if a user upgrades to 2.3.4 and there are already upgrade steps in 2.4 before this, then those upgrade steps will be skipped.
          2. Looking at the mod_assignment upgrade in 2.2, I think that you could clean this up by using class DirectoryIterator which seems to do a lot of the job you are doing
          3. You need to clean the filename, again like the mod_assignment upgrade steps

          Otherwise looks good.

          cheers!
          dan

          Show
          Dan Poltawski added a comment - Hi Mark, I'm afraid there are a few issues: You can't raise the version number in all branches like that, you need to keep the main YYYYMMDD part of it static and just increment. The reason is that if a user upgrades to 2.3.4 and there are already upgrade steps in 2.4 before this, then those upgrade steps will be skipped. Looking at the mod_assignment upgrade in 2.2, I think that you could clean this up by using class DirectoryIterator which seems to do a lot of the job you are doing You need to clean the filename, again like the mod_assignment upgrade steps Otherwise looks good. cheers! dan
          Hide
          CiBoT added a comment -

          Moving this reopened issue out from current integration. Please, re-submit it for integration once ready.

          Show
          CiBoT added a comment - Moving this reopened issue out from current integration. Please, re-submit it for integration once ready.
          Hide
          Mark Nelson added a comment -

          Dan, I have done changes 1-2 you suggested, thanks. However 3 is not necessary as only certain filenames are accepted.

          Show
          Mark Nelson added a comment - Dan, I have done changes 1-2 you suggested, thanks. However 3 is not necessary as only certain filenames are accepted.
          Hide
          Dan Poltawski added a comment -

          Mark, this is conflicting on master. Could you rebase?

          Show
          Dan Poltawski added a comment - Mark, this is conflicting on master. Could you rebase?
          Hide
          Mark Nelson added a comment -

          Hi Dan, I have rebased. Thanks.

          Show
          Mark Nelson added a comment - Hi Dan, I have rebased. Thanks.
          Hide
          Dan Poltawski added a comment -

          Integrated to master, 24, 23 and 22. Thanks Mark

          Show
          Dan Poltawski added a comment - Integrated to master, 24, 23 and 22. Thanks Mark
          Hide
          David Monllaó added a comment -

          It passes, tested:

          • Upgrading from 1.9 to 22 integration
          • Upgrading from 1.9 to 22 stable and then to 23 integration
          • Upgrading from 1.9 to 22 stable and then to master integration

          The presets with duplicate names are correctly renamed to $name.'_2_old' and from 2.2 onwards I can't create presets with an existing name when the existing one belong to another user

          Show
          David Monllaó added a comment - It passes, tested: Upgrading from 1.9 to 22 integration Upgrading from 1.9 to 22 stable and then to 23 integration Upgrading from 1.9 to 22 stable and then to master integration The presets with duplicate names are correctly renamed to $name.'_2_old' and from 2.2 onwards I can't create presets with an existing name when the existing one belong to another user
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Changes are now upstream, thanks for your collaboration!

          If you are going to have any celebration next days, enjoy with your gang, if not, too!

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Changes are now upstream, thanks for your collaboration! If you are going to have any celebration next days, enjoy with your gang, if not, too! Ciao

            People

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

              Dates

              • Created:
                Updated:
                Resolved: