You are here

ogactivity.install in Activity 6

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

File

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

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

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

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

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

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

Functions

Namesort descending Description
ogactivity_install Implementation of hook_install().
ogactivity_uninstall Implementation of hook_uninstall().