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

Upgrade process fails if role 'manager' already exists.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Component/s: Installation
    • Labels:
      None
    • Database:
      Any
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      When upgrading a site from moodle 1.9 to 2.0 I received the error:

      Debug info: Duplicate entry 'manager' for key 4
      UPDATE mdl_role SET name = ?,shortname = ?,description = ?,sortorder = ?,archetype = ? WHERE id=?
      [array (
      0 => 'Manager',
      1 => 'manager',
      2 => 'Managers can access course and modify them, they usually do not participate in courses.',
      3 => '0',
      4 => 'manager',
      5 => '1',
      )]

      Stack trace:

      • line 394 of /lib/dml/moodle_database.php: dml_write_exception thrown
      • line 922 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      • line 954 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->update_record_raw()
      • line 2861 of /lib/db/upgrade.php: call to mysqli_native_moodle_database->update_record()
      • line 1307 of /lib/upgradelib.php: call to xmldb_main_upgrade()
      • line 261 of /admin/index.php: call to upgrade_core()

      This is because the existing role table consisted of the following:

      name | shortname
      Administrator | admin
      Course creator | coursecreator
      Course Manager | manager
      Course Co-ordinator | co-ordinator
      Student | student
      Guest | guest
      Authenticated user | user

      Suggestion: Check to see if the role name exists before updating, if so rename the existing role to a temporary name before proceeding.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              skodak Petr Skoda
              Reporter:
              markn Mark Nelson
              Tester:
              Nobody
              Participants:
              Component watchers:
              Matteo Scaramuccia, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                24/Nov/10