MyBB Community Forums

Full Version: If you're gonna have _is_installed ...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Logically, you should have is_active, right ??
I think the idea was that active list of plugins are stored in the cache. Whereas, if the cache stuffs up, or something, plugins can't stuff up the DB that much (since the DB modifications should generally have been done in the install routine).
In essence, it gets cumbersome - MyBB can't call is_activated for every single plugin on every single page load (waste of resources).

I can partly see where you're coming, but I think is_installed() is enough. Was there any particular use you could think of for is_activated()?
To be fair I can't think of any good reasons, I was just looking at the format of the new plugins, I saw is_installed and wondered if there was a good reason for it not being there.

One quite feeble reason might involve a mod rather than a plugin or a plugin with libraries, and the files for the mod being in the correct place even though the mod is deactivated in the acp, depending on how the mod works you might report a loss of data perhaps ...

Sure it would be a waste of resources for mybb to call it, but mybb wouldn't have to call it. I suppose more useful for working between plugins and mybb, or plugins and plugins, or mods and plugins, I know there's nothing stopping me making it anyway, just wanted to hear reasons, thanks ...
(2008-07-16, 09:07 AM)krakjoe Wrote: [ -> ]One quite feeble reason might involve a mod rather than a plugin or a plugin with libraries, and the files for the mod being in the correct place even though the mod is deactivated in the acp, depending on how the mod works you might report a loss of data perhaps ...
Oh, you mean some "plugin" which just adds a PHP file, eg http://example.com/forums/mynewpage.php, without requiring any other modification?
In that case, a plugin file is somewhat unnecessary...

(2008-07-16, 09:07 AM)krakjoe Wrote: [ -> ]I suppose more useful for working between plugins and mybb, or plugins and plugins, or mods and plugins, I know there's nothing stopping me making it anyway, just wanted to hear reasons, thanks ...
If a mod doesn't have a plugin file, there's not much we can do. Your plugin would probably have to read the relevant PHP files and check whether the mod is applied or not.
For working with active plugins, reading the plugin cache should be fine.
Otherwise, most is_activated() functions would probably just return whether the plugin exists in the list of active plugins...

Or, if you meant that you wanted to have a plugin which relies on another one, just make it "die" during the _activate() function, if the dependant plugin isn't activated.


Maybe a global is_plugin_activated($pluginname) as a shortcut to save checking the plugins cache manually? It's only a few lines though.
See it was a feeble reason, my curiosity is satisfied ...