HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

hooks request


I am trying to do a plugin that would hook before a plugin is enable and checks all its dependencies recursively and enables them automatically. Unfortunatelly there is absolutely no event that fires before a plugin is enabled (only after it is) which is kind of the main nail in this plugin's coffin

Therefore, I would need an event before an event is enabled, actually, it would be even better before the plugin is even tested for requirements

in: /library/core/class.pluginmanager.php on line 583, something like
or in: /applications/dashboard/controllers/class.settingscontroller.php on line 636, something like:

Also, I intend on making this check for requirements for applications. I know they don't have application requirements as plugins should depend on applications and not the other way around, but sometimes you have a set of plugins that you need to use for multiple applications and you want to make sure that it is enabled before you want to enable your application.

So is it possible that for the next version release to have the hook(s) and maybe also some dependencies for applications just like plugins have?



  • Options
    LincLinc Detroit Admin
    I need code context for where you want it in class.pluginmanager.php. The line numbers change constantly.

    Applications do support the 'RequiredApplications' property already.
  • Options
    so in class.pluginmanager.php
    public function TestPlugin( ... ){ $this->FireEvent('BeforeTestPlugin'); // Make sure...
    in class.settingscontroller.php
    try{ $this->FireEvent('BeforeTestAddon'); $AddonManager->$TestMethod( ... );

    Or choose any other name that you think it suits better

    As for the applications, could also a "RequiredPlugins" property be implemented as well as it would be useful?
  • Options
    LincLinc Detroit Admin
    RequiredPlugins wouldn't make much sense and could lead to the paradoxical situation where a plugin and application require each other and therefore neither can be enabled.
  • Options
    well that could also happen for two plugins that require each-other.
    The reason I'm asking for this is that we are developing several applications that make use of some common functionalities which we would like to make into global plugins and assign them to those applications instead of having an installation of each of them into every application.

    Also, you can have a priority management system for conflict situations: aka, if a plugin and an application require each-other, the application has priority but would shoot out a warning message.
  • Options
    So, will the hooks be added in the next version of vanilla? So I can add them into mine manually until it is released and have my plugin up and running 'till then
  • Options
    LincLinc Detroit Admin
    edited June 2011
    @Todd Could you look at this and see if this is feasible? (The new hook, I mean, not the dependency stuff) I neglected to follow up and now I'm not sure about it and it's close to missing .18.
  • Options
    ToddTodd Chief Product Officer Vanilla Staff
    I'm not against adding this, but you can get your functionality this way if you wish:
    public function SettingsController_TestAddon_Override($Sender, $Args) {
    $Valid = FALSE;
    // Enable all of the dependencies.
    // ...

    if ($Valid)
    $Sender->TestAddon($Args[0], $Args[1], $Args[2]);
    Let me know which route you want to take @Ishtvan.
  • Options
    What about some kind of hook for this one?
Sign In or Register to comment.