You are here

flagactivity.install in Activity 5.4

Same filename and directory in other branches
  1. 6 contrib/flagactivity/flagactivity.install

File

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

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

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

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

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

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

Functions

Namesort descending Description
flagactivity_install Implementation of hook_install().
flagactivity_uninstall Implementation of hook_uninstall().