|Writing Drupal module, changes not showing|
Clearing cache, what am I missing?
I've been programming PHP for years, but have just recently decided to delve into Drupal module writing. I'm using Drupal 7. I've written portions of the module, which creates its own content type, and have had it installed, can set configuration options, etc.
The problem is that when I make changes to any of the fields or field instances in my module file they don't actually change the module, even after clearing cache, installing, uninstalling, clearing cache, and installing again. I've written an uninstall hook to remove the fields, field instances, and node type, but it's like the uninstall never gets fired when I disable the module because the database still has the field structure after I uninstall it.
I even manually deleted the fields from the database, and then when I re-installed the module, the content type was there but all the fields were gone... like the installation hooks never even ran. Again, I clear cache constantly.
What am I missing? Any ideas?
Hmm... That's a tough nut to crack without seeing the module. A typo in the .info file or in one of the hook names could stop everything. I assume you have error reporting set to E_ALL....
Disable versus uninstall
These are two separate things. The uninstall hook does not fire when you disable a module, only when you actually uninstall it (see the uninstall tab on the modules page).
Have you tried saving the DB, creating the content type as closely as possible using fields, taking an SQL dump, then loading the saved DB back in and creating the content type with your module and dumping again? Then you could compare the two dumps and see if your module is missing some field/setting/step.
Also you might consider trying to do as much as possible with the features module and use that as a starting point.
Do you have an IDE that allows you to set breakpoints? Can you set a breakpoint in your .install and in each hook function in your .module to see if the code is even executing?