You are here

user_relationshipsactivity.install in Activity 6

File

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

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

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

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

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

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

Functions