Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Application Setup but no Destruct?

edited June 2010 in Vanilla 2.0 - 2.8
I am writing two new applications for Vanilla/Dashboard RC1. I know there is a Setup method in "class.hooks.php" which is called when the application is enabled. I looked at the source and saw that it is like this:
// Call the application's setup method
$Hooks = $ApplicationName.'Hooks';
if (!class_exists($Hooks)) {
$HooksFile = PATH_APPLICATIONS.DS.$ApplicationFolder.DS.'settings'.DS.'class.hooks.php';
if (file_exists($HooksFile))
include($HooksFile);
}
if (class_exists($Hooks)) {
$Hooks = new $Hooks();
$Hooks->Setup();
}

(from line 172 of class.applicationmanager.php)
Unfortunately, there's no Destruct/Destroy/Die method. This would be useful for removing any changes made to the config file or dropping any tables, etc. Is there a way to do this that I am unaware of, or will I have to modify the source?

Thank you,

Richard

Comments

  • oliverraduneroliverraduner Contributing to Vanilla since 2010 Switzerland ✭✭
    Just a quick thought: probably you should have a look at the GettingStarted plugin, because that one works with the config-file as well.

    If I remember correctly, it uses values like TRUE/FALSE to disable itself in the end.
  • There are some methods, OnDisable for example i think exists. Unless they have since been removed.

    Ah maybe its just for plugins not applications:

    http://github.com/vanillaforums/Garden/blob/master/library/core/class.pluginmanager.php#L515

  • Thanks for the responses. I actually noticed this OnDisable function, but it seems to only be triggered for Plugins. It didn't seem to be triggered for my Application :-X. I think this is something the creators of Dashboard/Vanilla overlooked. If I knew how to do a pull I would.
Sign In or Register to comment.