After (in list view) selecting some files, that I want to delete, I select proper option ("delete selected files") and click the button.
Page reloads, I get a summary list of files and this error:

Notice: Undefined index: options w _media_browser_plus_media_admin_list_alter() (linia 192 z ...\sites\all\modules\media_browser_plus\includes\file_entity.admin.inc).

This doesn't stop me from actually deleting files. I can click "delete" button and files are gone.

I looked inside the file (which notice points to) and found this 192th line. Don't know why there is this 'option' index since the first it is being set happens in line 195 ;/

-----
One more bug on this page (the one with the summary titled "Are you sure you want to delete ... ")
A the bottom there is unnecessary pagination !

Comments

emptyvoid’s picture

Priority: Normal » Major

File delete doesn't work at all on my built.

Modules Involved.

File entity -- 7.x-2.0-unstable6
Media -- 7.x-2.0-unstable6
Media Browser Plus for Media 2.x -- 7.x-2.x-dev
Media Internet Sources -- 7.x-2.0-unstable6
Media: YouTube (media_youtube) -- 7.x-1.0-beta3

Both list and thumbnail views can't delete any files no matter the number selected.

List View
http://www.example.com/admin/content/file

Notice: Undefined index: options in _media_browser_plus_media_admin_list_alter() (line 192 of /srv/clients/example/code/sites/all/modules/contrib/media_browser_plus/includes/file_entity.admin.inc). Backtrace:

_media_browser_plus_media_admin_list_alter(Array, Array) file_entity.admin.inc:29
media_browser_plus_form_file_entity_admin_files_alter(Array, Array, 'file_entity_admin_files') module.inc:1022
drupal_alter(Array, Array, Array, 'file_entity_admin_files') form.inc:1067
drupal_prepare_form('file_entity_admin_files', Array, Array) form.inc:475
drupal_rebuild_form('file_entity_admin_files', Array, Array) form.inc:924
drupal_process_form('file_entity_admin_files', Array, Array) form.inc:374
drupal_build_form('file_entity_admin_files', Array) form.inc:131
drupal_get_form('file_entity_admin_files') 
call_user_func_array('drupal_get_form', Array) menu.inc:516
menu_execute_active_handler() index.php:21

Thumbnails View
http://www.example.com/admin/content/file/thumbnails

I noticed that on line 46 of the media_browser_plus.pages.inc it references a method defined in the file_entity module. But that method doesn't exist any longer. I changed it to this, but it still doesn't work.

function media_browser_plus_delete_multiple_form($form, &$form_state, $fids) {
  $files = array();
  $file_list = explode(' ', $fids);
  if ($file_list !== FALSE) {
      foreach (explode(' ', $fids) as $key => $value) {
        $files[$value] = $value;
      }
  } else if (!empty($fids)) {
      $files[$fids] = $fids;
  }
  $form_state['values']['files'] = $files;
  //module_load_include('inc', 'file_entity', 'file_entity.pages');
  $form = drupal_get_form('file_entity_multiple_delete_confirm_operation', $form, $form_state, $files);
  return $form;
}

This change loads the correct confirmation form, however the submit hook expects the file ID list to exist in the $form_state['values']['files'] variable and it doesn't exist. Even though I attempt to fine the value in the $form_state in this method above it doesn't appear to properly use a "by reference" and update the global object. :(

This results in the following errors:

    Notice: Undefined index: files in file_multiple_delete_form_submit() (line 437 of /srv/clients/example/code/sites/all/modules/contrib/file_entity/file_entity.pages.inc). Backtrace:

    file_multiple_delete_form_submit(Array, Array) form.inc:1443
    form_execute_handlers('submit', Array, Array) form.inc:854
    drupal_process_form('media_browser_plus_delete_multiple_form', Array, Array) form.inc:374
    drupal_build_form('media_browser_plus_delete_multiple_form', Array) form.inc:131
    drupal_get_form('media_browser_plus_delete_multiple_form', '841') 
    call_user_func_array('drupal_get_form', Array) menu.inc:516
    menu_execute_active_handler() index.php:21

    Warning: array_keys() expects parameter 1 to be array, null given in file_multiple_delete_form_submit() (line 437 of /srv/clients/example/code/sites/all/modules/contrib/file_entity/file_entity.pages.inc). Backtrace:

    array_keys(NULL) file_entity.pages.inc:437
    file_multiple_delete_form_submit(Array, Array) form.inc:1443
    form_execute_handlers('submit', Array, Array) form.inc:854
    drupal_process_form('media_browser_plus_delete_multiple_form', Array, Array) form.inc:374
    drupal_build_form('media_browser_plus_delete_multiple_form', Array) form.inc:131
    drupal_get_form('media_browser_plus_delete_multiple_form', '841') 
    call_user_func_array('drupal_get_form', Array) menu.inc:516
    menu_execute_active_handler() index.php:21

emptyvoid’s picture

Discussion about this issue on another issue: http://drupal.org/node/1660918

Jackinloadup’s picture

Status: Active » Closed (duplicate)

As emptyvoid stated above this is a duplicate of #1660918: Cannot delete multiple files.

Please see that issue for patches.

Jackinloadup’s picture

Issue summary: View changes

One more bug found