Closed (fixed)
Project:
Media Mover
Version:
5.x-1.0-alpha3
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
28 Aug 2008 at 08:32 UTC
Updated:
14 Jul 2012 at 19:38 UTC
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
Comment #1
arthurf commentedWow, 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!
Comment #2
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.