You are here

nodeactivity.install in Activity 6

File

contrib/nodeactivity/nodeactivity.install
View source
<?php

/**
 * Implementation of hook_install().
 */
function nodeactivity_install() {
  if (!module_exists('activity')) {
    module_load_include('module', 'activity');
  }
  activity_install_activity_defaults('nodeactivity');
  drupal_set_message(t('Activity integration with Node module installed. Go to <a href="@settings">Node Activity settings</a> to customize ', array(
    '@settings' => url('admin/settings/activity/nodeactivity'),
  )));
}

/**
 * Implementation of hook_uninstall().
 */
function nodeactivity_uninstall() {

  // Remove any activity entries from the nodeactivity module
  if (module_exists('activityhistory')) {
    db_query("DELETE FROM {activity_history} WHERE aid IN (SELECT aid FROM {activity} WHERE module = '%s')", 'nodeactivity');
  }
  db_query("DELETE FROM {activity_targets} WHERE aid IN (SELECT aid FROM {activity} WHERE module = '%s')", 'nodeactivity');
  db_query("DELETE FROM {activity_comments} WHERE aid IN (SELECT aid FROM {activity} WHERE module = '%s')", 'nodeactivity');
  db_query("DELETE FROM {activity} WHERE module = '%s'", 'nodeactivity');

  // Delete any variables that have been set.
  // We don't just DELETE FROM {variable}, even though we could.
  $result = db_query("SELECT name FROM {variable} WHERE name LIKE 'nodeactivity_%'");

  // Instead we use the API, because API's can change!
  while ($row = db_fetch_object($result)) {
    variable_del($row->name);
  }
}

Functions

Namesort descending Description
nodeactivity_install Implementation of hook_install().
nodeactivity_uninstall Implementation of hook_uninstall().