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

Upgrade process fails if role 'manager' already exists.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • 2.0
    • 2.0
    • Installation
    • None
    • Any
    • MOODLE_20_STABLE
    • MOODLE_20_STABLE
    • Easy

      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.

            skodak Petr Skoda
            markn Mark Nelson
            Nobody Nobody (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

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