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

Matt Slocum mattslocum at sharefaith.com
Mon Mar 12 20:45:25 UTC 2012


Awesome! Thanks Jeff!

Here's my code now if anyone is curious.

if ( file_exists( ABSPATH . '.maintenance' ) || defined( 'WP_INSTALLING' ) )
    return;


On Mon, Mar 12, 2012 at 11:52 AM, Jeff Lambert <jeff.lambert at jvhm.com>wrote:

> Couldn't you check for the existence of the .maintenance file?
>
> Jeff
>
> On 3/12/12 11:39 AM, "Matt Slocum" <mattslocum at sharefaith.com> wrote:
>
> > Hi,
> >
> > 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
> > code<
> http://phpxref.ftwr.co.uk/wordpress/nav.html?wp-admin/update-core.php.sou
> > rce.html>,
> > 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
> > upgrade).
> >
> > I also added a line:
> >
> >         if (strstr($_SERVER["SCRIPT_NAME"], 'update-core.php') === false)
> > return;
> >
> > 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?
> >
> > Thanks,
> > Matt
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list