WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to test a plugin upgrade or install (6 posts)

  1. toddhalfpenny
    Member
    Posted 4 years ago #

    Hi there,

    I'm developing a new version of one of my plugins and I want to test the install/upgrade function (called by the register_activation_hook()) since the new version changes the manner in which the options are stored in the DB.

    What I'm wondering is how can I test this install/upgrade process without putting the plugin live. Is it possible to force an upgrade from a non-stable version of the plugin (if I commit it) or is there a manual process which can be used without evening committing it?

    All help greatly appreciated.
    Thanks

  2. Edward Caissie
    Theme Review Admin
    Posted 4 years ago #

    Plugin (like theme) updates are essentially an over-write of the existing code. I would suggest setting up a test environment (or several) and install the current plugin ... test for functionality (it should work just fine).

    Then simply overwrite the current with the latest version you are working on and re-test. Unfortunately if you have not written any "undo" functions into the plugin you will need multiple sandboxes to test with and play in.

    ... that would be one approach I would take. I hope it helps ...

  3. toddhalfpenny
    Member
    Posted 4 years ago #

    Thanks for the reply... I'm just wondering if this approach would still execute the function I have called via the register_activation_hook().

  4. Edward Caissie
    Theme Review Admin
    Posted 4 years ago #

    From what I understand on this page: http://codex.wordpress.org/Function_Reference/register_activation_hook the function should work based on the user actions on the Plugin page, at least for testing purposes.

  5. toddhalfpenny
    Member
    Posted 4 years ago #

    Ah right... so looks like I need to deactivate the current version, overwrite the file with the new version and then activate the new version.

    I'll give this a go and see what happens.
    Thanks

  6. toddhalfpenny
    Member
    Posted 4 years ago #

    So what I eventually did was deactivate the existing (old) plugin, overwrite it and then activate it.
    The code within the code within the function called by the register_activation_hook was handled at this point.

Topic Closed

This topic has been closed to new replies.

About this Topic