From 06daeb7d505c7439fa4bf32c150561d7d1cbe8d3 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Fri, 5 Feb 2010 21:07:56 +0000 Subject: - Patch #607238 by agentrickard: fixed user_modules_uninstalled() calling hook_permission() for already uninstalled modules. --- modules/user/user.install | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'modules/user/user.install') diff --git a/modules/user/user.install b/modules/user/user.install index d3d6f095a..d6357ed12 100644 --- a/modules/user/user.install +++ b/modules/user/user.install @@ -65,6 +65,13 @@ function user_schema() { 'default' => '', 'description' => 'A single permission granted to the role identified by rid.', ), + 'module' => array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => "The module declaring the permission.", + ), ), 'primary key' => array('rid', 'permission'), 'indexes' => array( @@ -490,3 +497,28 @@ function user_update_7005(&$sandbox) { * The next series of updates should start at 8000. */ +/** + * Add module data to {role_permission}. + */ +function user_update_7006(&$sandbox) { + $module_field = array( + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'description' => "The module declaring the permission.", + ); + // Check that the field hasn't been updated in an aborted run of this + // update. + if (!db_column_exists('role_permission', 'module')) { + // Add a new field for the fid. + db_add_field('role_permission', 'module', $module_field); + } + $permissions = user_permissions_get_modules(); + foreach ($permissions as $key => $value) { + db_update('role_permission') + ->fields(array('module' => $value)) + ->condition('permission', $key) + ->execute(); + } +} -- cgit v1.2.3