You are here

favorite_nodesactivity.install in Activity 6

Same filename and directory in other branches
  1. 5.4 contrib/favorite_nodesactivity/favorite_nodesactivity.install

File

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

// $Id:

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

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

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

  // 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 'favorite_nodesactivity_%'");

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

Functions