function role_export_normalize in Role Export 6
Ensure that all rids are hashes of their machine_name.
4 calls to role_export_normalize()
- role_export_enable in ./
role_export.module - Implements hook_enable().
- role_export_features_rebuild in ./
role_export.module - Implements hook_features_rebuild().
- role_export_flush_caches in ./
role_export.module - Implements hook_flush_caches().
- role_export_submit in ./
role_export.module - Save the role information to the {role} table.
File
- ./
role_export.module, line 113 - Role Export's primary module file.
Code
function role_export_normalize() {
foreach (role_export_roles(true) as $role) {
// Ensure the rid is the machine_name's hash
if ($role->rid != role_export_generate_id($role->machine_name)) {
if (empty($role->machine_name)) {
$role->machine_name = role_export_machine_name_gen($role->name);
}
$new_rid = role_export_generate_id($role->machine_name);
// Update the current role with the new data.
db_query("UPDATE {role} SET rid = %d, machine_name = '%s' WHERE rid = %d", $new_rid, $role->machine_name, $role->rid);
}
}
}