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

Installation fails if $CFG->allowcategorythemes is enabled

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.11.11, 4.0.5
    • 3.9.17, 3.11.10, 4.0.4, 4.1
    • Installation
    • MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE
    • MOODLE_311_STABLE, MOODLE_400_STABLE
    • Hide

      Requires setup ready to install a new site, with pre-configured config.php file

      1. Edit config.php, add the following:

        $CFG->allowcategorythemes = true;
        

      2. Open site in browser
      3. Confirm installation screen opens
      4. Proceed through installation until complete

      Regression test

      1. Navigate to Courses > Manage courses and categories in site administration
      2. Create a new top-level category "Category 2"
        • Force theme: Classic
      3. Create a new course in "Category 1" and "Category 2"
      4. Navigate to course in "Category 1"
      5. Confirm course is shown using Boost theme
      6. View page source, confirm page body tag has category-1 value (assuming 1 is the ID of "Category 1")
      7. Navigate to course in "Category 2"
      8. Confirm course is shown using Classic theme
      9. View page source, confirm page body tag has category-2 value (assuming 2 is the ID of "Category 2")
      10. Navigate to Courses > Manage courses and categories in site administration
      11. Open Actions menu for "Category 1"
      12. Press View
      13. Confirm category is shown using Boost theme
      14. Navigate to Courses > Manage courses and categories in site administration
      15. Open Actions menu for "Category 2"
      16. Press View
      17. Confirm category is shown using Classic theme
      Show
      Requires setup ready to install a new site, with pre-configured config.php file Edit config.php , add the following: $CFG->allowcategorythemes = true; Open site in browser Confirm installation screen opens Proceed through installation until complete Regression test Navigate to Courses > Manage courses and categories in site administration Create a new top-level category "Category 2" Force theme: Classic Create a new course in "Category 1" and "Category 2" Navigate to course in "Category 1" Confirm course is shown using Boost theme View page source, confirm page body tag has category-1 value (assuming 1 is the ID of "Category 1") Navigate to course in "Category 2" Confirm course is shown using Classic theme View page source, confirm page body tag has category-2 value (assuming 2 is the ID of "Category 2") Navigate to Courses > Manage courses and categories in site administration Open Actions menu for "Category 1" Press View Confirm category is shown using Boost theme Navigate to Courses > Manage courses and categories in site administration Open Actions menu for "Category 2" Press View Confirm category is shown using Classic theme

      This is really unlikely to happen... until it happens!

      Was installing a test site from scratch (via web) using an old config.php... and then, trying to install any current Moodle version (3.11.x, 4.0.x, 4.1dev...) I was getting, consistently this error:

      Coding error detected, it must be fixed by a programmer: Attempt to get the course category for this page before the course was set.
      Debug info: 
      Error code: codingerror
      Stack trace:
      line 2005 of /lib/pagelib.php: coding_exception thrown
      line 2042 of /lib/pagelib.php: call to moodle_page->ensure_category_loaded()
      line 546 of /lib/pagelib.php: call to moodle_page->ensure_categories_loaded()
      line 953 of /lib/pagelib.php: call to moodle_page->magic_get_categories()
      line 1792 of /lib/pagelib.php: call to moodle_page->__get()
      line 1695 of /lib/pagelib.php: call to moodle_page->resolve_theme()
      line 751 of /lib/pagelib.php: call to moodle_page->initialise_theme_and_output()
      line 997 of /lib/pagelib.php: call to moodle_page->magic_get_theme()
      line 229 of /admin/index.php: call to moodle_page->get_renderer()
      

      Debugging the problem I discovered that this $CFG setting was causing the error:

      $CFG->allowcategorythemes = true; // This breaks installation.

      And, commenting it out, installation worked without problems.

      As said, it's unlikely people is going to install Moodle with that setting enabled but, still, it shouldn't happen (at some level in the stack-trace above we have to stop looking to allow install to work normally).

      Ciao

      PS: I've not tested CLI install, maybe it has the same problem!

        1. master_5_reg_MDL-75904.png
          33 kB
          John Edward Pedregosa
        2. v311_2_MDL-75904.png
          49 kB
          John Edward Pedregosa
        3. master_1_MDL-75904.png
          106 kB
          John Edward Pedregosa
        4. master_2_MDL-75904.png
          62 kB
          John Edward Pedregosa
        5. master_3_reg_MDL-75904.png
          87 kB
          John Edward Pedregosa
        6. master_4_reg_MDL-75904.png
          88 kB
          John Edward Pedregosa
        7. master_6_reg_MDL-75904.png
          65 kB
          John Edward Pedregosa
        8. v311_1_MDL-75904.png
          96 kB
          John Edward Pedregosa
        9. v311_3_reg_MDL-75904.png
          100 kB
          John Edward Pedregosa
        10. v311_4_reg_MDL-75904.png
          95 kB
          John Edward Pedregosa
        11. v400_1_MDL-75904.png
          107 kB
          John Edward Pedregosa
        12. v400_2_MDL-75904.png
          54 kB
          John Edward Pedregosa
        13. v400_3_reg_MDL-75904.png
          94 kB
          John Edward Pedregosa
        14. v400_4_reg_MDL-75904.png
          88 kB
          John Edward Pedregosa
        15. v400_5_reg_MDL-75904.png
          64 kB
          John Edward Pedregosa
        16. v400_6_reg_MDL-75904.png
          32 kB
          John Edward Pedregosa

            pholden Paul Holden
            stronk7 Eloy Lafuente (stronk7)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Huong Nguyen Huong Nguyen
            John Edward Pedregosa John Edward Pedregosa
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 30 minutes
                2h 30m

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