You are here

notifications_ui.install in Notifications 6.2

File

notifications_ui/notifications_ui.install
View source
<?php

/**
 * Implementation of hook_install()
 * 
 * Set up some variables so basic options are enabled out of the box
 */
function notifications_ui_install() {
  variable_set('notifications_ui_user', array(
    'page' => 'page',
    'create' => 'create',
  ));
  variable_set('notifications_ui_node', array(
    'links' => 'links',
    'teaserlinks' => 'teaserlinks',
    'block' => 'block',
  ));
  variable_set('notifications_ui_account_options', array(
    'links' => 'links',
    'block' => 'block',
  ));

  // The most common options for notifications_content: thread, nodetype, author
  variable_set('notifications_ui_types', array(
    'thread' => 'thread',
    'nodetype' => 'nodetype',
    'author' => 'author',
  ));
}

/**
 * Implementation of hook_uninstall()
 */
function notifications_ui_uninstall() {

  // Some global variables
  variable_del('notifications_ui_per_type');
  variable_del('notifications_ui_user');
  variable_del('notifications_ui_node');
  variable_del('notifications_ui_account_options');

  // Just delete variables for subscription types and node types
  variable_del('notifications_ui_types');
  foreach (array_keys(node_get_types()) as $type) {
    variable_del('notifications_node_ui_' . $type);
  }
}

/**
 * Update UI variables
 */
function notifications_ui_update_6000() {

  // All options will be messed up so we better do manual review
  variable_del('notifications_link_teaser');
  drupal_set_message(t('Please, check all your Notifications UI settings and note the new options.'));
  return array();
}

/**
 * Disable cache in subscription block
 */
function notifications_ui_update_6001() {
  $ret = array();
  $ret[] = update_sql("UPDATE {blocks} SET cache = " . BLOCK_NO_CACHE . " WHERE module = 'notifications_ui'");
  $ret[] = update_sql("DELETE FROM {cache_block} WHERE cid LIKE 'notifications_ui:%'");
  return $ret;
}

Functions

Namesort descending Description
notifications_ui_install Implementation of hook_install()
notifications_ui_uninstall Implementation of hook_uninstall()
notifications_ui_update_6000 Update UI variables
notifications_ui_update_6001 Disable cache in subscription block