Projet

Général

Profil

Révision 0125e073

Ajouté par Assos Assos il y a plus de 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/media/modules/media_bulk_upload/includes/media_bulk_upload.admin.inc
19 19
      '#required' => TRUE,
20 20
    );
21 21

  
22
    $form['to_directory'] = array(
23
      '#type' => 'textfield',
24
      '#title' => t('To Directory'),
25
      '#description' => t('Enter the subdirectory of /sites/default/files where files will be copied. If empty the default directory will be use.'),
26
      '#required' => FALSE,
27
    );
28

  
22 29
    $form['pattern'] = array(
23 30
      '#type' => 'textarea',
24 31
      '#title' => t('Pattern'),
......
76 83
      form_set_error('pattern', t('No files were found in %directory matching the regular expression %pattern', array('%directory' => $directory, '%pattern' => $pattern_quoted)));
77 84
    }
78 85
    $form_state['storage']['files'] = $files;
86
    $form_state['storage']['to_directory'] =  $form_state['values']['to_directory'];
79 87
  }
80 88
}
81 89

  
......
85 93
function media_bulk_upload_import_submit($form, &$form_state) {
86 94
  if ($form_state['values']['op'] == t('Confirm')) {
87 95
    $files = $form_state['storage']['files'];
96
    $params = array();
97
    $params['to_directory'] = $form_state['storage']['to_directory'];
88 98
    $batch = array(
89 99
      'title' => t('Importing'),
90 100
      'operations' => array(
91
        array('media_bulk_upload_import_batch_import_files', array($files)),
101
        array('media_bulk_upload_import_batch_import_files', array($files, $params)),
92 102
      ),
93 103
      'finished' => 'media_bulk_upload_import_batch_import_complete',
94 104
      'file' => drupal_get_path('module', 'media_bulk_upload') . '/includes/media_bulk_upload.admin.inc',
......
103 113
/**
104 114
 * BatchAPI callback op for media import.
105 115
 */
106
function media_bulk_upload_import_batch_import_files($files, &$context) {
116
function media_bulk_upload_import_batch_import_files($files, $params, &$context) {
107 117
  if (!isset($context['sandbox']['files'])) {
108 118
    // This runs the first time the batch runs.
109 119
    // This is stupid, but otherwise, I don't think it will work...
......
121 131

  
122 132
  foreach ($to_process as $file) {
123 133
    try {
124
      $file_obj = media_parse_to_file($file);
134
      $file_obj = media_parse_to_file($file, $params);
125 135
      $context['results']['success'][] = $file;
126 136
      if (!$image_in_message) {
127 137
        // @todo Is this load step really necessary? When there's time, test

Formats disponibles : Unified diff