function background_video_uninstall in Background Video 7
Implements hook_uninstall(). This function delete Background Video Directory and all videos from it. It also deletes all the system variables of this module.
File
- ./
background_video.install, line 13 - This file provides the uninstall function.
Code
function background_video_uninstall() {
// Remove the background_video directory and uploaded files.
file_unmanaged_delete_recursive(file_default_scheme() . '://background_video');
$result = db_query("SELECT fid FROM {file_usage} WHERE module = 'background_video'");
// Remove all data used files.
foreach ($result as $record) {
$file = file_load($record->fid);
if ($file) {
// Remove all usage for this file by my_module_name.
file_usage_delete($file, 'background_video', 'background_video', NULL, 0);
// Should only delete if file not in use by another module.
file_delete($file);
}
}
variable_del('background_video');
variable_del('background_video_source_mp4');
variable_del('background_video_source_ogv');
variable_del('background_video_source_webm');
variable_del('background_video_id');
variable_del('background_video_control_position');
variable_del('background_video_source_poster');
variable_del('background_video_loop');
variable_del('background_video_autoplay');
}