Is it possible to enable/disable an addon from another addon?

SneakyDave

Well-known member
I'd like to create a simple cron or addon to disable or enable an addon (chat) at certain dates and times.

Looking at the xf_addon table, it looks like it would be as simple as setting the "active" column to 0, but after noticing that didn't work, it looks like there is a cache rebuild that needs to happen

From the AddOn DataWriter
Code:
$this->_getAddOnModel()->rebuildAddOnCachesAfterActiveSwitch($this->getMergedData());

Is it possible to somehow do this rebuild from an addon, or is that more or less impossible?

Or is there a better way to disable an addon , I suppose I could set it to display:none in the template, but I bet there'd be a template cache to rebuild after that.
 
How did you set active to 0?

You would need to do it using the AddOn DataWriter as that would call the _postSave process that then rebuilds that very cache that needs rebuilding.
 
For the moment, I was just doing an external query, updating the table. Looks like it requires a little more thought than that, obviously. Thanks for the tip
 
Wherever possible, always use the DataWriter to make changes. There are often values and caches (as is the case here) that need to be updated and they only going to be triggered when using the DataWriter.
 
Back
Top Bottom