You are here

exclude_node_title.install in Exclude Node Title 6

Same filename and directory in other branches
  1. 8 exclude_node_title.install
  2. 7 exclude_node_title.install

File

exclude_node_title.install
View source
<?php

/*
 * Implementation of hook_install().
 */
function exclude_node_title_install() {

  // by default all users will have permission to use exclude node title
  db_query("UPDATE {permission} p SET p.perm = TRIM(LEADING ', ' FROM CONCAT(p.perm, ', use exclude node title'))");
}

/**
 * Implementation of hook_uninstall().
 */
function exclude_node_title_uninstall() {
  variable_del('exclude_node_title_nid_list');
  variable_del('exclude_node_title_remove_title');
  variable_del('exclude_node_title_content_type_values');
  variable_del('exclude_node_title_search');
}

/*
 * Implementation of hook_update_N().
 * We need to add permission to use exclude node title to all roles that didn't had the ignore permission.
 */
function exclude_node_title_update_6002() {
  $items = array();
  $items[] = update_sql("UPDATE {permission} p\n    SET p.perm = CONCAT(p.perm, ', use exclude node title')\n    WHERE p.perm NOT LIKE '%ignore node title exclusions%'");
  $items[] = update_sql("UPDATE {permission} p\n    SET p.perm = REPLACE(p.perm, ', ignore node title exclusions', '')\n    WHERE p.perm NOT LIKE '%ignore node title exclusions%'");
  return $items;
}