cvs up -dPC
patch -p0 < admin_role_fix_3.patch
drop all table, and used install.php
turn on the a module which has uninstall hook
turn off the module
uninstall the module
turn on the module
You see the following:

(this example is with the aggregator module)

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '3-administer news feeds' for key 1: INSERT INTO {role_permission} (rid, permission) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => 3 [:db_insert_placeholder_1] => administer news feeds ) in user_modules_installed() (line 942 of /home/pp/munka/drupal/drupal-cvs/modules/user/user.admin.inc).

I suggest deleting all permissions of the module when uninstalling it.
see more info in #482346: node_modules_installed() implementation not invoked (located in include file) #17 and #18

CommentFileSizeAuthor
#2 503554.patch1.92 KBpp
#1 user_modules_uninstalled.patch999 bytescatch

Comments

catch’s picture

Title: There is an error when uninstalled and turned on a module which has uninstall hook. » user_modules_uninstalled() is missing
Status: Active » Needs review
StatusFileSize
new999 bytes

Patch.

pp’s picture

Status: Needs review » Needs work
StatusFileSize
new1.92 KB

The patch resolves the bug. I think we should add a test. I added a test which catches this bug but it isn't perfect. The correct test would catch all similar bugs. I am afraid this will be a different issue.
What is the problem?
There is a module which has modules_installed hook and it has not modules_uninsalled hook or this hook is wrong.

The test steps(my idea):
1. Enable all modules which has modules_installed hook. (now it is unnecessary because only User and Field module have this hook and all these modules are always enabled. :))
2. Enable, disable, uninstall, enable all other modules.
3. Repeat these two steps until similar modules are present.

pp

catch’s picture

Status: Needs work » Closed (duplicate)

pp I think that test is fine - just realised this is actually a duplicate of #306027: user_modules_uninistalled() is missing which solves the more general issue so moving things over there (including your test into a merged patch).