You are here

function minisite_site_delete in Mini site 7

Delete minisite.

1 call to minisite_site_delete()
minisite_file_field_delete_file in includes/minisite.field.inc
Delete minisite file field data.

File

./minisite.module, line 165
Module file.

Code

function minisite_site_delete($item, $field, $entity_type, $id) {
  $file = (object) $item;
  $file_usage = file_usage_list($file);
  if ($file->status == 0 || !empty($file_usage['minisite'])) {
    if (!empty($file)) {

      // Delete database records.
      db_delete('minisite_asset')
        ->condition('minisite_fid', $file->fid)
        ->execute();

      // Load module inc file.
      module_load_include('inc', 'minisite', 'includes/minisite.site');
      $path = 'public://' . MINISITE_ASSETPATH . '/' . minisite_site_hash($file);
      file_unmanaged_delete_recursive($path);
    }
  }
}