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

incorrect rebuild_course_cache() call in upgrade

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Duplicate
    • Affects Version/s: 2.3.6, 2.4, 2.5
    • Fix Version/s: None
    • Component/s: Installation
    • Labels:
      None
    • Testing Instructions:
      Hide

      Ideally for all DBs...

      In a site with at least 1 course with at least 1 activity of each type, try (always using the current versions of each branch):

      First set:
      1) Upgrade from 19 to 22.
      2) Upgrade from 22 to 25.

      Second set:
      3) Upgrade from 22 to 23.
      4) Upgrade from 23 to 24.
      5) Upgrade from 24 to 25.

      Verify no error happen with rebuild_course_cache() involved. That's enough to pass this. Any other problem must be reported in separated issue.

      Show
      Ideally for all DBs... In a site with at least 1 course with at least 1 activity of each type, try (always using the current versions of each branch): First set: 1) Upgrade from 19 to 22. 2) Upgrade from 22 to 25. Second set: 3) Upgrade from 22 to 23. 4) Upgrade from 23 to 24. 5) Upgrade from 24 to 25. Verify no error happen with rebuild_course_cache() involved. That's enough to pass this. Any other problem must be reported in separated issue.
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      Detected upgrading one 2.4dev site to current 2.5beta:

      Debug info: ORA-00904: "SHOW_EXPANDED": invalid identifier
      SELECT id, name, display, show_expanded, intro, introformat FROM m_folder WHERE id = :o_id
      [array (
      'o_id' => '21',
      )]
      Error code: dmlreadexception
      Stack trace:
      .....
      .....
      line 429 of /mod/folder/lib.php: call to moodle_database->get_record()
      line 936 of /course/lib.php: call to folder_get_coursemodule_info()
      line 1457 of /lib/modinfolib.php: call to get_array_of_activities()
      line 1463 of /lib/db/upgrade.php: call to rebuild_course_cache()
      line 1530 of /lib/upgradelib.php: call to xmldb_main_upgrade()
      line 292 of /admin/index.php: call to upgrade_core()
      

      With the problem being the call to rebuild_course_cache() without params, aka, forcing the rebuild and trying to access to a non-existing-yet column folder->show_expanded.

      That call in upgrade code is forbidden and, alternatively, this should be used instead:

      rebuild_course_cache(0, true);
      

      because it's a safe alternative not using the cm api for regenerating the information but just a pair of raw sql statements.

      So this is about to change all the incorrect uses to correct ones, to avoid upgrade problems here and there.

      Ciao

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              stronk7 Eloy Lafuente (stronk7)
              Reporter:
              stronk7 Eloy Lafuente (stronk7)
              Participants:
              Component watchers:
              Matteo Scaramuccia, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: