You are here

function photos_uninstall in Album Photos 6.2

Same name and namespace in other branches
  1. 7.3 photos.install \photos_uninstall()

File

./photos.install, line 354

Code

function photos_uninstall() {
  db_query("DELETE FROM {variable} WHERE name LIKE 'photos_%'");

  // remove photos nodes.
  $result = db_query("SELECT nid FROM {node} WHERE type = 'photos'");
  while ($node = db_fetch_object($result)) {
    node_delete($node->nid);
  }

  //remove files
  $result = db_query("SELECT fid FROM {x_image}");
  while ($file = db_fetch_object($result)) {
    db_query('DELETE FROM {files} WHERE fid = %d', $file->fid);

    //file_delete($file->filepath);
  }

  // clear cache.
  cache_clear_all('*', 'cache', TRUE);
  cache_clear_all('*', 'cache_menu', TRUE);
  cache_clear_all('*', 'cache_page', TRUE);
  drupal_uninstall_schema('photos');
}