You are here

function webform_update_7321 in Webform 7.3

Remove files left over from deleted submissions. Such files are now deleted automatically.

File

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

Code

function webform_update_7321() {
  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,
    ));
  }
}