Execute code when add-on enabled or disabled

Arty

Well-known member
I'd like to execute small piece of code when my add-on is being enabled or disabled. Add-on isn't being installed/uninstalled, so installation function doesn't help.

Is it possible?
 
Hmm.

It might be possible by extending the add-on controller but that in itself requires an add-on which would need to be installed.

How come your add on isn't being installed or uninstalled?

Another way is to run a cron job that checks the status of the add on and then run the action depending on its outcome.

Depends how quickly that action needs to occur as to whether that's going to work.
 
Thanks.

How come your add on isn't being installed or uninstalled?
Its situation when you check "Enable / Disable" box in add-ons list. It doesn't uninstall, it just disables add-on.

edit: problem solved. I've found a workaround for my problem (forcing user to reload css when my add-on is disabled/enabled) that doesn't require executing anything
 
Top Bottom