Remove "imagefield_create_node_from" function.

Deciphered - April 20, 2009 - 03:38
Project:Imagefield Import
Version:6.x-1.x-dev
Component:Code
Category:task
Priority:minor
Assigned:Unassigned
Status:closed
Description

It appears, and I may be wrong, that the function "imagefield_create_node_from" isn't called anywhere in the module and is likely to be left over code from a previous version.

If this is the case, it couldn't hurt to remove it completely.

I'd roll a patch, but I hardly see the point.

Cheers,
Deciphered.

#1

vordude - April 21, 2009 - 02:31

I think You're right-- I'll wrap this up into the next commit.

Thanks!

#2

sgriffin - August 11, 2009 - 20:21

Still not commited.

#3

kari.kaariainen - September 20, 2009 - 18:39

Just passing by, this caught my eye.
imagefield_create_node_from is being called by imagefield_import_form_submit

#4

vordude - September 25, 2009 - 16:32
Status:active» closed

procrastination FTW.

thanks.

#5

Deciphered - September 27, 2009 - 22:42
Status:closed» active

@kari.kaariainen

What version are you using?
I just downloaded the current version (6.x-1.4-beta1), and below is the function you mentioned, which has no reference to imagefield_create_node_form().

function imagefield_import_form_submit($form, &$form_state) {
  $op = isset($form_state['values']['op']) ? $form_state['values']['op']: '';
  if ($op == t('Import')) {
    $source_path = variable_get('imagefield_import_source_path', '');
    if (file_check_directory($source_path)) {
      // determine the node type, and the target fieldname to import into
      $targetsetting = variable_get('imagefield_import_fieldname', FALSE);
      list($node_type, $field) = split(":::", $targetsetting);
      // try to avoid php's script timeout with a bunch of large files or a slow machine
      if (!ini_get('safe_mode'))
      set_time_limit(0);
      foreach (array_filter($form_state['values']['import_file']) as $index) {
        // Check the file is OK
        $filename = $form_state['values']['file_list'][$index];
        $source_filepath = file_check_location($source_path .'/'. $filename, $source_path);
        if ($source_filepath and file_validate_is_image($source_filepath)) {
          $file_info = image_get_info($source_filepath);
          $file_info['filepath'] = $source_filepath;
          // This is follwoing the method suggested by: http://drupal.org/node/292904 ...
          $file = array($field => $file_info);
          $title = $form_state['values']['title'][$index];
          $caption = $form_state['values']['body'][$index];
          $taxonomy = $form_state['values']['taxonomy'];
          if (_imagefield_import_process_form($file, $node_type, $title, $caption, $taxonomy))
          // delete original if it all went well.
          file_delete($source_filepath);
        }
        else {
          drupal_set_message('Problem with the file location:'. $source_filepath, 'error');
        }
      } // foreach( file )
    }
    else {
      drupal_set_message('Source directory has not been set in the settings?', 'error');
    }
  }
}

Maybe I'm missing something, it is quite early at the moment, but I just don't see it.

#6

kari.kaariainen - September 28, 2009 - 13:22

Must have looked at some other version than that. Sorry, I wasn't paying attention to the version number. Noob.

#7

wulff - November 21, 2009 - 11:39
Version:6.x-1.4-beta1» 6.x-1.x-dev
Status:active» closed

This function no longer exists after support for Batch API has been added to the module.

 
 

Drupal is a registered trademark of Dries Buytaert.