Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
An update from 7.x-4.1 to 7.x-4.5 fails with the following error message.
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3-administer autologout' for key 'PRIMARY'
A look in the role table reveals the following entries:
The db_update looks like this:
/**
* Fix permission names in role_permission table
*/
function autologout_update_7401() {
db_update('role_permission')
->fields(array('permission' => 'administer autologout'))
->condition('permission', 'auto administer autologout', '=')
->execute();
}
there are no other corresponding updates to this table in the install file.
Those are our featured permissions:
// Exported permission: 'administer autologout'.
$permissions['administer autologout'] = array(
'name' => 'administer autologout',
'roles' => array(
'administrator' => 'administrator',
'testrole' => 'testrole',
),
'module' => 'autologout',
);
Comment | File | Size | Author |
---|---|---|---|
#6 | update_from_4-1_to_4-5_fails-2928850-006.patch | 1.68 KB | stefan.korn |
| |||
#3 | autologout1.png | 5.63 KB | macdev_drupal |
#2 | autologout1.png | 0 bytes | macdev_drupal |
autologout2.png | 9.42 KB | macdev_drupal |
Comments
Comment #2
macdev_drupal CreditAttribution: macdev_drupal commentedComment #3
macdev_drupal CreditAttribution: macdev_drupal commentedComment #4
macdev_drupal CreditAttribution: macdev_drupal commentedComment #5
stefan.kornThis is related to: https://www.drupal.org/project/autologout/issues/2389845
Patch introduced there does not account for the case that the permissions "auto administer autologout" and "administer autologout" with the same "rid" do already exist in the table "role_permission" and can therefore lead to this MYSQL integrity constraint violation error. In this case the permission "auto administer autologout" should not be renamed (which in fact is not possible then) but rather be deleted.
Will provide a patch for this.
Comment #6
stefan.kornThis patch fixes the issue.
Comment #7
stefan.korn