[wp-hackers] Pre-upgrade and post upgrade hooks

DD32 wordpress at dd32.id.au
Tue Jan 8 07:28:15 GMT 2008


On Tue, 08 Jan 2008 17:51:19 +1100, <wordpress at santosj.name> wrote:
> The way I can see around it is having a hidden second and fourth upgrade
> step in between the upgrade third step.
>
> 1. User clicks on upgrade link.
> 2. Active Plugins are sandboxed and called one after the other with their
> preupgrade hook. The results are saved and serialized in the session or
> cookie. (Accept only bool and null values)
> 3. Run Upgrade.
> 4. Run Post Upgrade hook with sandboxed plugins and give the post-upgrade
> hooks the value returned from the pre-upgrade hook.
> 5. Display Finished status.

To me that sounds like a good idea, and easily implemented, on #2, and #4 it should be possible to sequentially include each plugin until one fails, at which point, it redirects back to itself and continues on with the next plugin.

My only other thought is, Is it worth it?
Think about it, unless the plugin is upgraded before WP is upgraded, then the plugin will most likely not know of anything it needs to be modified(eg, insert pages elsewhere or something).
I guess it could be setup so that the activation hook is called (as some plugins check for compatibility then) upon the upgrade.

I DO think that after an upgrade is run, plugins should be sandboxed, and sequentially activated, and de-activating those which cause an error to be thrown -- at least this would prevent the entire admin going down, And doesnt require plugin authors to do anything extra to allow this process to happen.

Unless an error occurs, it would be transparent to the user, if a plugin had to be deactivated, then showing it on the final screen(Along with a check to see if theres an updated version available) would be the cleanest method. Perhaps after the upgrade is completed, WP should check for ANY plugin having a newer version and reminding the user at that stage that they need to be upgraded?

I apologise if any of this is just pure ramble :) - Feel free to quote any of that on the trac tickets (I'll reframe from commenting there for now though)

D


More information about the wp-hackers mailing list