fields('v', array('name')) ->condition('name', 'block_class_styles%', 'LIKE') ->execute()->fetchCol(); foreach ($vars as $var) { variable_del($var); } } /** * Implements hook_enable(). */ function block_class_styles_enable() { //message about module settings drupal_set_message(t('You may administer your block styles now by visiting @url.', array('@url' => url(BLOCK_CLASS_STYLES_PATH_SETTINGS)))); // Change the system weight for the module (in relation to another)... $weight = db_select('system', 's') ->fields('s', array('weight')) ->condition('name', 'block_class') ->execute()->fetchField(); db_update('system') ->fields(array('weight' => ++$weight)) ->condition('name', 'block_class_styles') ->execute(); } /** * Grant new permission: Use Block Styles to all roles. */ function block_class_styles_update_7101(&$sandbox) { $output = array(); try { $rids = user_roles(); foreach ($rids as $rid => $name) { db_merge('role_permission') ->key(array( 'rid' => $rid, 'permission' => 'block_class_styles:use', )) ->fields(array( 'module' => 'block_class_styles', )) ->execute(); } $output[] = t('All roles have received new permission: %perm', array('%perm' => 'Use Block Styles')); } catch (Exception $e) { throw new DrupalUpdateException('FAILED: '); } if (empty($output)) { $output[] = t('Nothing to update.'); } return implode(PHP_EOL, $output); }