Just installed weblinks and attempted to migrate content from D6. Several errors arose in the install and use.
Because I previously had weblinks on the D6 site with a vocabulary called web_links I created a vocabulary with the machine name web_links on the new site. The install created a duplicate vocabulary with no machine name. I uninstalled the module and deleted my web_links vocabulary and a content type I had created. When I reinstalled the module it again created a vocabulary called web_links with no machine name. So I assigned the vocabulary the machine name 'weblinks', which appears to be what the weblinks.install tries to do. I migrated my taxonomy terms into the vocabulary using migrate.
The weblinks module created a content type, but did not add a term reference field to it for the weblinks vocabulary. So I added the field and associated it with the vocabulary.
I then attempted to create a new weblink manually, providing a title and url, and I selected one of my terms. When I saved the node I got the following error message:
Warning: reset() expects parameter 1 to be array, null given in weblinks_node_presave() (line 581 of /home/spjdco5/public_html/spjdc.net/drupal7/sites/all/modules/weblinks/weblinks.module).
When I run the migrate module to populate the weblinks table with my D6 nodes I get the following errors for each node and the migration fails.
11 Error MigrateException: reset() expects parameter 1 to be array, null given File /home/spjdco5/public_html/spjdc.net/drupal7/sites/all/modules/weblinks/weblinks.module, line 581 in MigrationBase->errorHandler() (line 530 of /home/spjdco5/public_html/spjdc.net/drupal7/sites/all/modules/migrate/includes/base.inc).
11 Error reset() expects parameter 1 to be array, null given File /home/spjdco5/public_html/spjdc.net/drupal7/sites/all/modules/weblinks/weblinks.module, line 581
All fields appear to be properly mapped in my migration class.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | content_type_weblinks.jpg | 103.38 KB | gstegemann |
Comments
Comment #1
gstegemann commentedThanks for your tests and reporting the issue.
I think I have found already the reason for the missing machine name in the created vocubulary. The property "machine name" of the added vocabulary is mispelled. For a quick test you can change line 43 in weblinks.install from "$vocabulary->mach_name = 'weblinks';" to "$vocabulary->machine_name = 'weblinks';" and then re-install the module. This should fix both the creation of the vocabulary and the term reference field.
Second creation of a weblink fails because the taxonomy term reference field has to have the name 'taxonomy_weblinks'. Otherwise it is not recognized and causes the error on line 581. This also lets migration fail.
I will try to provide a patch tomorrow.
However, when I upgraded my D6 site to D7 all the weblinks content was migrated during the upgrade. And the new weblinks update hook takes care of providing the taxonomy term references.
Comment #2
rsbecker commentedThe fix on line 43 added the machine name to the vocabulary. The install file creates the 'field_data_taxonomy_weblinks' table, still does not create the 'taxonomy_weblinks' field on the node form.
Comment #3
gstegemann commentedSo we got two steps further. But still strange, the install file should also create the field instances.
Some questions:
- are there any weblinks related messages logged in the sites protocol log?
- did update #7000 run?
- have you tried to add the taxonomy term reference field to the content type from the list of existing fields?
Comment #4
rsbecker commentedThere are no messages in the status report or the watchdog re port from the time of installation.
This was a clean install of drupal into which I am migrating content, so no site upgrade ran. I ran update.php after install of weblinks and no pending changes were listed.
You try to create a field called taxonomy_weblinks, not field_taxonomy_weblinks. Your field does not appear as a choice on the Manage Fields form.
Comment #5
rsbecker commentedWhen I uninstall weblinks I get the following error messages:
Notice: Undefined variable: had_vocab in weblinks_uninstall() (line 194 of /home/spjdco5/public_html/spjdc.net/drupal7/sites/all/modules/weblinks/weblinks.install).
Notice: Trying to get property of non-object in comment_node_type_delete() (line 344 of /home/spjdco5/public_html/spjdc.net/drupal7/modules/comment/comment.module).
Notice: Trying to get property of non-object in comment_node_type_delete() (line 355 of /home/spjdco5/public_html/spjdc.net/drupal7/modules/comment/comment.module).
Notice: Trying to get property of non-object in comment_node_type_delete() (line 355 of /home/spjdco5/public_html/spjdc.net/drupal7/modules/comment/comment.module).
Notice: Trying to get property of non-object in comment_node_type_delete() (line 355 of /home/spjdco5/public_html/spjdc.net/drupal7/modules/comment/comment.module).
Notice: Trying to get property of non-object in comment_node_type_delete() (line 355 of /home/spjdco5/public_html/spjdc.net/drupal7/modules/comment/comment.module).
Notice: Trying to get property of non-object in comment_node_type_delete() (line 355 of /home/spjdco5/public_html/spjdc.net/drupal7/modules/comment/comment.module).
Notice: Trying to get property of non-object in comment_node_type_delete() (line 355 of /home/spjdco5/public_html/spjdc.net/drupal7/modules/comment/comment.module).
Notice: Trying to get property of non-object in comment_node_type_delete() (line 355 of /home/spjdco5/public_html/spjdc.net/drupal7/modules/comment/comment.module).
Notice: Trying to get property of non-object in notifications_content_node_type_delete() (line 736 of /home/spjdco5/public_html/spjdc.net/drupal7/sites/all/modules/notifications/notifications_content/notifications_content.module).
Notice: Trying to get property of non-object in og_node_type_delete() (line 848 of /home/spjdco5/public_html/spjdc.net/drupal7/sites/all/modules/og/og.module).
Notice: Trying to get property of non-object in og_node_type_delete() (line 849 of /home/spjdco5/public_html/spjdc.net/drupal7/sites/all/modules/og/og.module).
Notice: Undefined variable: had_vocab in weblinks_uninstall() (line 262 of /home/spjdco5/public_html/spjdc.net/drupal7/sites/all/modules/weblinks/weblinks.install).
It appears there are some cleanup issues in the weblinks.install file. The weblinks taxonomy is not removed, nor are the field_data_taxonomy_weblinks and field_revision_taxonomy_weblinks tables. The content type is removed.
Comment #6
gstegemann commentedOK, I understand.
The field name 'taxonomy_weblinks' is correct. Have you also checked if this field exists in the list of already existing fields?
Comment #7
gstegemann commentedTo fix the uninstall problems please change the following lines in weblinks.install:
- line 193: "$had_vocbab = ..." to "$had_vocab = ..."
- line 216: "node_delete($obj->name);" to "variable_del($obj->name);"
Sure, due to the undefined variable 'had_vocab' the taxonomy resources could not be removed. That should work when the variable is correctly defined.
Comment #8
rsbecker commentedThe change on line 193 causes the following:
Fatal error: Call to undefined function taxonomy_del_vocabulary() in /home/spjdco5/public_html/spjdc.net/drupal7/sites/all/modules/weblinks/weblinks.install on line 197
The field taxonomy_weblinks is not shown in the fields list on the reports menu and is not available in Manage Fields on the Web Links content type. The only field attached to the content type is the body field.
Comment #9
gstegemann commentedSo the fix basically works. Next please change the following too:
- "taxonomy_del_vocabulary" to "taxonomy_vocabulary_delete",
- and on line 83 the entity_type from 'node' to 'taxonomy_term'.
I've tested it and the field was added to the weblinks content type. However, the field was in fact already there, but should have been shown up in Manage Fields under 'Add existing field'. However, it did not appear under 'Add new field'.
Comment #10
rsbecker commentedStill getting this error when I try to create a node.
There still is no field on the weblinks content type and there is nothing available in existing fields to put there.
Uninstall causes this:
Comment #11
gstegemann commentedAfter applying the todays fixes I performed several install/enable/disable/uninstall cycles which all worked as expected. The taxonomy term reference field, instance and bundle was created and is manageable. However, I also see the notices from comment_node_type_delete.
Sure, I can add a safeguard to prevent the 'reset' statement failing. But as soon as the term reference field is there the notice will go away anyway.
After some investigation it looks like that this could be a problem in comment_node_type_delete itself. This function has a parameter '$info' and attempts to access a property 'type', i.e. $info->type, which in fact not does exists. See also #1327114: Notice: Trying to get property of non-object in comment_node_type_delete() and http://andypangus.com/an-annoying-error-part-two. So this notices shouldn't bother us right now are not a weblinks problem.
Third you can uncomment the 'field_delete_field' statement so that the uninstall function will run to its end. Then you should try to remove any leftovers manually and try again to install the module.
Comment #12
gstegemann commentedI did more testing. The following should be changed:
- on line 33, change the parameter value of call 'field_associate_field' to 'weblinks',
- on line 83, change the entity_type back to 'node'.
I will try to upload a new version this evening which also includes fixes for the notices raised in 'weblinks_node_presave'.
Comment #13
rsbecker commentedLast night I cleaned up stuff left in the db by the failed uninstall and reinstalled the module with the changes above in the weblinks.install file. This time the taxonomy_weblinks field was visible in the content type.
I have run a migration that succeeded as well.
Thanks for your help.
Comment #14
gstegemann commentedYou, re welcome. Great news.
Anyway I will upload a new version this evening.
One thing I'm interested in is how you did setup the migration. I already had a quick look into the Migrate and migrate_d2d module. But I have still no plan how to use them.
Comment #15
rsbecker commentedThe learning curve for Migrate is pretty steep, and the documentation is good for some things but absolutely opaque about others.
The benefit of migrating over upgrading is significant if you have a site that is several years old. Over time, the db gets cluttered with trash from module upgrades that went bad or uninstallations that left variables and other gunk in tables, not to mention leaving tables that are no longer used. The trash can cause errors in the upgrade process. I had a site that I tried several times to upgrade and each time I ran an upgrade on a copy of the db I had different errors and different problems after successful upgrades. This suggests that the better course is to create a clean D7 db, add the content types, views, vocabs, etc., then migrate the content into it.
Problem is I'm an end user, not a developer or designer. So I have to crib from others to do anything, and finding good sources of info about migration takes time and a lot of trial and error.
Again, thanks for working with me on weblinks.
Comment #16
gstegemann commentedThanks for testing and your feedback.
Yes, at some point in time its definitely better to migrate rather than upgrading, especially when a site has seen several upgrade iterations.
Then I will try to read more of the documentation and learn how to setup migrations. Maybe there will be more migration tools available in the near future to simplify migration processes.
Back to this issue: if you don't mind I will close it the next days.
Comment #17
gstegemann commented