function photos_uninstall in Album Photos 7.3
Same name and namespace in other branches
- 6.2 photos.install \photos_uninstall()
Implements hook_uninstall().
File
- ./
photos.install, line 241 - Install, update, and uninstall functions for the Album Photos module.
Code
function photos_uninstall() {
$node_types = node_type_get_names();
foreach ($node_types as $type => $name) {
variable_del('photos_node_' . $type);
variable_del('photos_share_' . $type);
}
$roles = user_roles();
foreach ($roles as $rid => $role) {
variable_del('photos_pnum_' . $rid);
}
// @todo create new var to count name/res/size and loop through to delete all.
$additional_sizes = variable_get('photos_additional_sizes', 5);
for ($i = 0; $i <= $additional_sizes; $i++) {
variable_del('photos_name_' . $i);
variable_del('photos_res_' . $i);
variable_del('photos_size_' . $i);
}
variable_del('photos_access_photos');
variable_del('photos_additional_sizes');
variable_del('photos_block_num_information_pager');
variable_del('photos_block_num_latest_images');
variable_del('photos_block_num_random_images');
variable_del('photos_block_num_user_images');
variable_del('photos_comment');
variable_del('photos_cover_imagesize');
variable_del('photos_display_full_imagesize');
variable_del('photos_display_full_viewnum');
variable_del('photos_display_imageorder');
variable_del('photos_display_list_imagesize');
variable_del('photos_display_page_display');
variable_del('photos_display_page_imagesize');
variable_del('photos_display_page_slide');
variable_del('photos_display_page_user');
variable_del('photos_display_slide');
variable_del('photos_display_teaser_display');
variable_del('photos_display_teaser_imagesize');
variable_del('photos_display_teaser_slide');
variable_del('photos_display_teaser_user');
variable_del('photos_display_teaser_viewnum');
variable_del('photos_display_user');
variable_del('photos_display_viewpager');
variable_del('photos_display_view_imagesize');
variable_del('photos_exif');
variable_del('photos_exif_cache');
variable_del('photos_image_count');
variable_del('photos_node_photos');
variable_del('photos_num');
variable_del('photos_pager_imagesize');
variable_del('photos_path');
variable_del('photos_plupload_status');
variable_del('photos_print_sizes');
variable_del('photos_rname');
variable_del('photos_share_photos');
variable_del('photos_size');
variable_del('photos_size_max');
variable_del('photos_slide');
variable_del('photos_slide_music');
variable_del('photos_slide_show_thumb');
variable_del('photos_slide_show_view');
variable_del('photos_slide_zoom');
variable_del('photos_swfu_num');
variable_del('photos_thumb_count');
variable_del('photos_thumb_create_time');
variable_del('photos_thumb_imagesize');
variable_del('photos_upzip');
variable_del('photos_user_count_cron');
variable_del('photos_vote');
// hook_search vars:
variable_del('photos_search_max_id_ever');
variable_del('photos_search_max_id_reindex');
variable_del('photos_search_reindex_old_photos');
// Remove photos nodes.
$result = db_select('node', 'n')
->fields('n', array(
'nid',
))
->condition('n.type', 'photos')
->execute();
foreach ($result as $node) {
node_delete($node->nid);
}
// Remove files.
$result = db_select('photos_image', 'p')
->fields('p', array(
'fid',
))
->execute();
foreach ($result as $file) {
$file = file_load($file->fid);
if ($file) {
file_usage_delete($file, 'photos');
file_delete($file);
}
}
// Clear cache.
cache_clear_all('*', 'cache', TRUE);
cache_clear_all('*', 'cache_menu', TRUE);
cache_clear_all('*', 'cache_page', TRUE);
}