This was listed as a todo in the current function.

This implementation removes all mappings defined by the module, even if they were altered by another module using hoof_rdf_mapping. We will need to note in the documentation that altering a bundles rdf mapping should be done through hook_entity_info_alter

CommentFileSizeAuthor
drupal.rdf-modules-uninstalled.patch921 byteslinclark

Comments

lilou’s picture

Status: Active » Needs review
Anonymous’s picture

This will no longer be a good way to do this if we implement a hook_rdf_mapping_alter

sun’s picture

Title: Add rdf_modules_uninstalled function » Add rdf_modules_uninstalled() functionality
Priority: Minor » Normal

I don't think that this will work reliably. We probably have to introduce a new 'module' column for the {rdf_mapping} table instead.

With that column, this code will look almost identically to the example snippet in http://api.drupal.org/api/function/hook_modules_uninstalled/7

scor’s picture

why not dropping the rdf_mapping table? You would lose all the mappings other modules might have stored there but what else would you expect after uninstalling the core rdf module?

sun’s picture

@scor: err? hook_modules_uninstalled(), NOT hook_uninstall() ;)

scor’s picture

doh!

Anonymous’s picture

This touches on an issue that scor and I talked about when I was in Boston.

When we discussed it, scor clarified that hook_rdf_mapping should only be used for bundles that are defined in the module. If a module wants to alter a bundle mapping defined in another module, it should use the RDF CRUD API in hook_install. I posted a related issue around this time, (#622518: need for hook_rdf_mapping_alter).

If you have multiple entries for a bundle in the table, tied to different modules, you would have to merge the mappings when pulling the entries out of the database. This would be better on the one hand because you could uninstall a module and have the bundle's mappings revert to what they were before you installed that module. I think we would need to discuss the cons before moving forward with the change, though.

Sidenote: This code should definitely be rewritten, though, if #623346: Use module_invoke in rdf_modules_installed is committed just to make it consistent.

Anonymous’s picture

Status: Needs review » Needs work
shenzhuxi’s picture

Should rdf_modules_disabled and rdf_modules_enabled be used for the database record?

Anonymous’s picture

Unfortunately, that would remove any of the mappings that had been altered by the user or altered by another module.

Anonymous’s picture

Title: Add rdf_modules_uninstalled() functionality » Module-defined mappings are not deleted on uninstall

This is now included in #1778226: [META] Fix RDF module.

Anonymous’s picture

Status: Needs work » Closed (won't fix)

This is no longer an issue in Drupal 8. Since no one has written a patch in 7.x for the past 3+ years, I'm going to won't fix this for D7.