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

admin_apply_default_settings() fails if heading has the same name as plugin setting

XMLWordPrintable

    • MOODLE_400_STABLE
    • MOODLE_401_STABLE, MOODLE_402_STABLE
    • MDL-78541/401
    • MDL-78541/master
    • Hide
      1. Add following into mod/book/settings.php 

         
        $settings->add(new admin_setting_heading('something', 'Something header', 'Desc'));  
         
        $settings->add(new admin_setting_configcheckbox('mod_book/something', 'Enable', 'Other desc', '0')); 
        

      1. Init behat
      2. Confirm tests that trigger upgradesettings do not fail, for example 

        behat --name="Admin page can be accessed through bookmarks block" 

      Show
      Add following into mod/book/settings.php  $settings->add( new admin_setting_heading( 'something' , 'Something header' , 'Desc' ));   $settings->add( new admin_setting_configcheckbox( 'mod_book/something' , 'Enable' , 'Other desc' , '0' )); Init behat Confirm tests that trigger upgradesettings do not fail, for example  behat --name= "Admin page can be accessed through bookmarks block"

      I got bitten by this recently in multiple plugins, following code settings content does not apply the setting during behat ini causing behat failures due to missing settings.

      $settings->add(new admin_setting_heading('something', 'Something header', 'Desc'));
      $settings->add(new admin_setting_configcheckbox('mod_book/something', 'Enable', 'Other desc', '0'));

      The code in admin_apply_default_settings() is problematic, I am going to submit a small workaround patch only and then create a followup for master only.

            skodak Petr Skoda
            skodak Petr Skoda
            Farhan Karmali Farhan Karmali
            Andrew Lyons Andrew Lyons
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 30 minutes
                30m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.