You are here

function facebook_tracking_pixel_uninstall in Facebook Tracking Pixel 7

Same name and namespace in other branches
  1. 8 facebook_tracking_pixel.install \facebook_tracking_pixel_uninstall()

Implements hook_uninstall().

File

./facebook_tracking_pixel.install, line 129
Install, update, and uninstall functions for the Facebook Tracking Pixel module.

Code

function facebook_tracking_pixel_uninstall() {
  $path = variable_get('facebook_tracking_pixel_path', 'public://facebook_tracking_pixel');
  file_unmanaged_delete_recursive($path);
  db_drop_table('facebook_tracking_pixel_events_path');
  db_drop_table('facebook_tracking_pixel_base_codes');

  // Delete all variables via an SQL query.
  $prefix = 'facebook_tracking_pixel';
  $result = db_select('variable', 'v')
    ->fields('v')
    ->condition('name', db_like($prefix) . '%', 'LIKE')
    ->execute()
    ->fetchAll();
  foreach ($result as $item) {
    db_delete('variable')
      ->condition('name', $item->name)
      ->execute();
  }
}