You are here

function webform_update_7404 in Webform 7.4

Remove files left over from deleted submissions.

Such files are now deleted automatically.

File

./webform.install, line 1674
Webform module install/schema hooks.

Code

function webform_update_7404() {
  module_load_include('inc', 'webform', 'components/file');
  $fids = db_query('SELECT fid FROM {file_usage} WHERE module = \'webform\' AND type = \'submission\' AND NOT id IN(SELECT sid FROM {webform_submissions})')
    ->fetchCol();
  foreach ($fids as $fid) {
    _webform_delete_file(NULL, array(
      $fid,
    ));
  }
}