function system_update_7036

Split the 'access site in maintenance mode' permission from 'administer site configuration'.

Related topics

File

modules/system/system.install, line 2399

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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.