I've used this module and found some problems with MediaMover CCK module in harvest process. It doesn't work at all, then I traced the code and found bugs in mm_content_harvest function in mm_content.module file.

This function uses $job and $enabled variables inside, but these variables never defined before. So I changed couple lines :

function mm_content_harvest($action, $configuration, $running_config) {
  $files = array();
  $fields = content_fields();
  
  // are we harvesting from a specific NID ?
  if ($nid) {
    $harvest_conditions = ' AND n.nid = '. $nid;
  }
  else {
    $harvest_conditions = ' AND n.changed > '. $job->last_start_time;
  }
  
  foreach ($configuration['mm_config_harvest_field'] as $field_name) {
    if ($enabled) {
      $db_info = content_database_info($fields[$field_name]);
      $results = db_query('SELECT f.filepath, n.nid FROM {files} f LEFT JOIN {node} n ON f.nid = n.nid LEFT JOIN '. $db_info['table'] .' c ON c.nid = n.nid LEFT JOIN {media_mover_files} m ON m.fid = f.fid AND m.cid = %d WHERE c.'. $db_info['columns']['fid']['column'] .' = f.fid AND m.mmfid IS NULL '. $harvest_conditions .' ORDER BY n.nid DESC', $configuration['cid'], $running_config->last_start_time);
      while ($result = db_fetch_array($results)) {
        $files[] = array(
          'harvest_file' => $result['filepath'],
          'harvest_module' => 'mm_content',
          'harvest_action' => 1,
          'nid' => $result['nid'],
        );
      }
    }
  }
  return $files;
} 

INTO

function mm_content_harvest($action, $configuration, $running_config) {
  $files = array();
  $fields = content_fields();
  
  // are we harvesting from a specific NID ?
  if ($nid) {
    $harvest_conditions = ' AND n.nid = '. $nid;
  }
  else {
    $harvest_conditions = ' AND n.changed > '. $running_config->last_start_time;
  }
  
  foreach ($configuration['mm_config_harvest_field'] as $field_name) {
    if ($enabled) {
      $db_info = content_database_info($fields[$field_name]);
      $results = db_query('SELECT f.filepath, n.nid FROM {files} f LEFT JOIN {node} n ON f.nid = n.nid LEFT JOIN '. $db_info['table'] .' c ON c.nid = n.nid LEFT JOIN {media_mover_files} m ON m.fid = f.fid AND m.cid = %d WHERE c.'. $db_info['columns']['fid']['column'] .' = f.fid AND m.mmfid IS NULL '. $harvest_conditions .' ORDER BY n.nid DESC', $configuration['cid'], $running_config->last_start_time);
      while ($result = db_fetch_array($results)) {
        $files[] = array(
          'harvest_file' => $result['filepath'],
          'harvest_module' => 'mm_content',
          'harvest_action' => 1,
          'nid' => $result['nid'],
        );
      }
    }
  }
  return $files;
} 

Comments

arthurf’s picture

Status: Needs review » Fixed

Wow, thanks. There were a bunch of other things going on here that I cleaned up as well. You might want to check out http://drupal.org/patch/create for information on how to submit patches- this makes it easy for me to try out your changes.

Anyway, thanks for the bug report and code!

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.