I have a node with 3 CCK file fields. When I use the devel module's generate functionality to create nodes, FileField is creating over 250 files for each node generated.
So if I generate a single node, I will have 250 files in my uploads directory. It properly assigns 3 files to the node, but I tried creating 50 nodes and then I ended up with over 7000 files in the database and on the filesystem.
I believe this is hooked into the generate functionality in filefield_content_generate. This function gets called way more than 3 times per node generated.
I attempted adding a static array here so it could "remember" which fields it has been called for:
static $fields_generated = array();
if (in_array($field['field_name'], $fields_generated)) {
return;
}
$fields_generated[] = $field['field_name'];
That works so that it only creates 3 files on the filesystem and in the database, but it does NOT associated them with the auto-generated node. Maybe someone with further knowledge of this code can see where I'm going wrong. These CCK file fields only accept 1 value (file).
Comments
Comment #1
hefox commentedThis sounds like a bug with devel generate and not filefield specially?
Comment #2
hefox commented#1049656: content_generate_fields() calls hook_content_generate too many times (filefield creates many files) cck issue