function system_update_7036 in Drupal 7
Split the 'access site in maintenance mode' permission from 'administer site configuration'.
Related topics
File
- modules/
system/ system.install, line 2380 - Install, update and uninstall functions for the system module.
Code
function system_update_7036() {
// Get existing roles that can 'administer site configuration'.
$rids = db_query("SELECT rid FROM {role_permission} WHERE permission = :perm", array(
':perm' => 'administer site configuration',
))
->fetchCol();
// None found.
if (empty($rids)) {
return;
}
$insert = db_insert('role_permission')
->fields(array(
'rid',
'permission',
));
foreach ($rids as $rid) {
$insert
->values(array(
'rid' => $rid,
'permission' => 'access site in maintenance mode',
));
}
$insert
->execute();
}