[wp-hackers] How to detect WP upgrade or installation

Matt Slocum mattslocum at sharefaith.com
Mon Mar 12 18:39:41 UTC 2012


We have a bunch of customer websites, and occasionally one of them gets
messed up install during a core WP upgrade. I haven't been able to
pin-point what is going wrong. We've had a variety of problems from an
incomplete upgrade (in random locations) to an update where the
wp-config.php file gets cleared out (happened again today).

I've got a plugin installed that does some file moving/manipulation/copying
on a timed basis. I'm trying to rule out this plugin as a possible culprit.
I've got a line of code already that I thought would stop it from running
during a WP core update:

    if ( defined( 'WP_INSTALLING' ) )
        return false;

I've been looking at the source
and this seems to be only defined during first-time WP installation and WP
database upgrades. Also, while looking at the source code I'm not seeing
how WP prevents multiple upgrade requests (ex. a user double clicks

I also added a line:

        if (strstr($_SERVER["SCRIPT_NAME"], 'update-core.php') === false)

but I'm not sure it will catch it either.

Anyone have any insights on how to prevent things from happening during a
WP core update?


More information about the wp-hackers mailing list