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

Can any function be overridden via bootstrap?

  • some clarification of the process needed.

  • Can any function be overridden in /bootstrap.before.php?

  • also what about

/bootstrap.after.php. what would be an example of something you would do in bootstrap.after.php rather thanbootstrap.before.php. And why?

I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Comments

  • ToddTodd Vanilla Staff

    You can override pretty much any function in bootstrap.before.php. In general I'd say what you want to do is.

    1. Don't override anything in functions.general.php.
    2. Override functions in the other files (functions.render.php, functions.validation.php) in a plugin or a theme.

    To be honest, we added those bootstrap.*.php files as sort of a logical exercise, but don't much use them. We use bootstrap.before.php in our hosted environment, but have never user bootstrap.after.php so I guess it's not really that useful.

  • thx for clarification. Todd

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • LincLinc Admin
    edited December 2012

    bootstrap.before is good for overriding functions or constants. Nothing is available.

    bootstrap.early is good for overriding config settings during initial install. Config values, functions, and constants are available.

    bootstrap.late has loaded the plugin, app, and theme managers, as well as loaded individual app configs. Validation functions are also loaded just before this. It's the last chance to turn on Debug via config.

    bootstrap.after has loaded the entire framework except the render functions. You could theoretically use all of Vanilla to do some logic on what render functions to use or do some prep before processing the user's request.

    My takeaway is bootstrap.before is good for defining, bootstrap.after is good for doing. I use bootstrap.after in my dev environment to keep some SaveToConfig commands to override default setup (bootstrap.early is newer than my setup). We don't need them often because Vanilla does exactly what we need it to do :p

  • peregrineperegrine MVP
    edited December 2012

    wow, thx for the further explanation Lincoln. Excellent.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Sign In or Register to comment.