You are here

function user_relationshipsactivity_uninstall in Activity 6

Same name and namespace in other branches
  1. 5.4 contrib/user_relationshipsactivity/user_relationshipsactivity.install \user_relationshipsactivity_uninstall()
  2. 5.3 contrib/user_relationshipsactivity/user_relationshipsactivity.install \user_relationshipsactivity_uninstall()

Implementation of hook_uninstall().

File

contrib/user_relationshipsactivity/user_relationshipsactivity.install, line 18

Code

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);
  }
}