Kind of a bug, more of a warning.
Just a heads-up regarding the length of plugin names and the Export UI.
If you are using the default Export UI handler class and its associated functions, then your plugin name must be less than 27 characters long. Otherwise import validation will not work.
The reason for this is that cached ctools objects can not be retrieved for plugins with long names. The 'name' field in the 'ctools_object_cache' table is only 32 chars long. (See ctools/inc/object-cache.inc, L42). During an import process an entry is made in the 'ctools_object_cache' table for the item being imported. This entry is keyed by both the 'import' operation ('::import') and the import object name ('ctui_' + the plugin name).
When the plugin name is longer than 27 characters problems occur. The import object name exceeds the size of the 'object' field in the 'ctools_object_cache' table, and it is truncated to 32 characters. When ctools tries to retrieve the corresponding cache object, it queries with the *full* import object name. Because the full name does not match the truncated name, the query returns no results and the cache object is not retrieved.
This can cause problems with validation during the import process.
Possible fixes:
* Make the 'object' field in the 'ctools_object_cache' table longer to accommodate longer plugin names
* Make the db_query in ctools/inc/object-cache.inc: ctools_object_cache_get truncate the object name to match the db
* Put a note in the export_ui documentation (which overall is excellent by the way) about the plugin name length limit.
I can't say enough how useful CTools is. I love your work!
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | ctools-plugin_name_field_size-1058786-12.patch | 1.02 KB | Stevel |
Comments
Comment #1
merlinofchaos commentedI think making the object cache name field longer is probably best. 27 is a reasonable length but I can see overshooting that pretty easily.
Even so, there's still going to be a length limit, so we should document whatever that ends up being at the same time.
Comment #2
vgoodvin commentedHi.
I have this problem with my custom module. Also some contrib modules may have a broken importing functionality. For example http://drupal.org/project/ffmpeg_converter
I attached my patch, that just updates the 'obj' field.
Thanks.
Comment #3
andypostSuppose patch should be against 7.x and then backported to 6.x
I think 64 is enough for object
First code comment should be 1 line
Powered by Dreditor.
Comment #4
vgoodvin commentedThanks. I attached patch for 7.x with corrections.
Comment #5
vgoodvin commentedPatch
Comment #6
merlinofchaos commentedschema_2 is locked. We need to create a schema_3 and update. It's how i track changes in tables to make it theoretically easier to manage. (I'm not sure that theory has actually worked out in practice).
Comment #7
geek-merlinJust for reference: The current API states that 'obj' limit is 128. Let's use that so we don't have a followup doc issue.
Comment #8
rooby commentedNew version with changes from #6 & #7
Comment #9
Stevel commentedThis patch makes the environment indicator import work, so marking this as RTBC.
Comment #10
Stevel commentedAdded tag.
Comment #12
Stevel commentedThere was a line changed just above the changes in this patch (the comment in the first line of the patch). Reroll should be good to go.
Comment #13
azinck commentedThis issue causes a PDOException on SQL Server. The patch fixes the problem for now. Should we consider something less fragile (like hashing)?
Comment #15
japerryReviewed and merged against dev. Fixed!