You are here

function panopoly_widgets_update_7005 in Panopoly Widgets 7

Implements hook_update_N().

Removes the default content from the database and file system

File

./panopoly_widgets.install, line 216
An installation file for Panopoly Widgets

Code

function panopoly_widgets_update_7005(&$sandbox) {

  // Retrieve the file IDs for default files
  $fids = array(
    'panopoly_widgets_default_spotlight_fid' => variable_get('panopoly_widgets_default_spotlight_fid', NULL),
    'panopoly_widgets_default_image_fid' => variable_get('panopoly_widgets_default_image_fid', NULL),
    'panopoly_widgets_default_video_fid' => variable_get('panopoly_widgets_default_video_fid', NULL),
  );
  foreach ($fids as $variable_name => $fid) {

    // Deletes the file
    if (!empty($fid) && ($file = file_load($fid))) {
      file_delete($file);
    }

    // Deletes the variable
    variable_del($variable_name);
  }
}