You are here

function filebrowser_form_delete_confirm_submit in Filebrowser 7.4

Same name and namespace in other branches
  1. 8 filebrowser.module \filebrowser_form_delete_confirm_submit()
  2. 6.2 filebrowser.module \filebrowser_form_delete_confirm_submit()
  3. 7.2 filebrowser.module \filebrowser_form_delete_confirm_submit()
  4. 7.3 filebrowser.module \filebrowser_form_delete_confirm_submit()

File delete confirmation form submit

File

./filebrowser.module, line 967

Code

function filebrowser_form_delete_confirm_submit($form, &$form_state) {
  foreach ($form_state['values']['items_to_delete'] as $file) {
    $fullpath = $file['full-path'];
    if (is_s3_filesystem($fullpath)) {
      s3_delete($fullpath);
    }
    else {
      if (is_file($fullpath)) {
        $result = unlink($fullpath);
        if ($result) {

          // Remove metadata of the deleted file.
          module_invoke_all('filebrowser_metadata_set', $file, NULL);
        }
        else {
          drupal_set_message(t('Unable to delete @file', array(
            '@file' => $fullpath,
          )), 'warning');
        }
      }
      else {
        $result = _filebrowser_rmdir($fullpath);
        if (!$result) {
          drupal_set_message(t('Unable to prune @file (not empty ?)', array(
            '@file' => $fullpath,
          )), 'warning');
        }
      }
    }
  }
}