Closed (fixed)
Project:
Drupal core
Version:
x.y.z
Component:
system.module
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
22 Jan 2006 at 03:50 UTC
Updated:
19 Aug 2006 at 23:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
merlinofchaos commentedUpdated patch: Moved module_invoke($module, 'activate') above comment (which was for next line).
Comment #2
colorado commentedNewbieQ - What does this mean, "activate/deactivate hooks"?
Comment #3
merlinofchaos commentedSpecifically, when a module's status changes from 'active' to 'inactive' or 'inactive' to 'active' at admin/modules, the module will get hook_deactivate() or hook_activate() called so that it can do cleanup/setup/what have you.
Comment #4
chx commentedThis is a very simple, very non-obtrusive but extermely powerful feature.
Comment #5
drummI think we should stick with the enabled/disabled terms.
Comment #6
fool2 commentedIf we are to implement this I think it should be a little more complicated.
What if someone just wants to temporarily disable a module? If Database installation and deletion is in the these hooks, then you can't do that because you'll lose the data.
Comment #7
merlinofchaos commentedI think anything that complex is a feature for 4.8; this is simple and will work.
A module would be foolish to do permanent data deletion in deactivate. deactivate shouldn't be considered the same as uninstall. On the other hand, there are things some modules do (especially if they are node_access using modules) that do need to make some kinds of database changes when the module is deactivated).
Comment #8
merlinofchaos commentedalternative patch using enable instead of activate attached.
Comment #9
jjeff commented+1
oh and also...
+1!
Comment #10
drewish commented+1 I like the enable/disable names better than activate/deactivate.
Also, the install hook has been committed to HEAD but it's not documented yet. The docs for this need to make it clear that db schema setup belongs there.
Comment #11
drewish commentedPersonally, I don't think new hooks should be committed without documentation. Here are some very basic docs for contrib/docs/developer/hooks:
Comments and criticism are welcome. An example would be nice... someone is testing this with an access module... right?
I'll roll this into a patch and open a documentation issue once this is committed.
Comment #12
keve commented+1 for hook_disable
I am developer of Taxonomy Access Controll.
From time to time i get request for this from users.
(Since they forget to disable TAC on settings page, afterwards they have much trouble w/ accessing/editing nodes, because of the remaining values in table 'node_access')
Comment #13
merlinofchaos commentedPatch cleaned up slightly based upon Steven's comments via IRC.
Comment #14
keve commentedHow are these hooks standing? Can it be commited soon?
Comment #15
drewish commentedi'd love to see this comitted before 4.7...
Comment #16
keve commentedI'd love it,too.
Although with taxonomy_access, i got around the problem with hook_form_alter.
On page
/admin/modulesTAC cannot be disabled until deactivated on it settings page.Comment #17
Steven commentedUnless I'm reading this patch wrong, hook_enable would be invoked before hook_install. That does not make sense.
Comment #18
Crell commentedWhoever's fixing this patch next, it belongs to CVS now.
Comment #19
asimmonds commentedModule enable/disable hooks went into HEAD recently with patch #76209 [1]
[1] http://drupal.org/node/76209
Comment #20
(not verified) commented