[wp-hackers] Testing for PHP 5 before activating
Eric Mann
eric at eamann.com
Mon Jul 12 17:27:45 UTC 2010
It's still a very rough framework right now. The only available method is a
generic "send message" one. You can look through the client side of things on
my Facebook Dashboard widget plugin
(http://wordpress.org/extend/plugins/facebook-dashboard/).
The server side of things is a bit more sophisticated ... but it's not publicly
available (yet). Basically, it extends the Wordpress XMLRPC API to allow remote
sites to post information to a database table that holds the site address, the
admin contact email, the current versions of PHP and WordPress on their system,
and whether or not fopen() is enabled (I have plug-ins that depend on this
function ... so if I see fopen() is disabled, that's my first recommendation for
fixing errors).
In any case, the client-side script for the reporter is in
/facebook-dashboard/includes/elliot.php.
The server-side script is (temporarily) available in a
pastebin: http://wordpress.pastebin.com/yKuQpsw4
I've included all of the server files, and marked them with -- filename.php --
so you can cut them back apart. Like I said, it's not well-documented but
that's because it's not entirely finished, either.
So if you have any requests for feature improvement, feel free to drop me a line
and I'll see what I can do :-)
On July 12, 2010 at 5:11 PM Alex Hempton-Smith <hempsworth at gmail.com> wrote:
> Is the code for your error reporter available for others to use in their
> plugins?
>
> -- Alex (Hempsworth)
>
>
> On Mon, Jul 12, 2010 at 6:09 PM, Eric Mann <eric at eamann.com> wrote:
>
> > I've been using a custom XMLRPC reporter on my new plug-ins to report back
> > when
> > the scripts throw errors (to make up for the "It's broke" messages I get
> > without
> > any details regarding what broke or what they were trying to do).
> > Unfortunately, my system only works with PHP5, so I don't know how many
> > people
> > are using PHP4 ...
> >
> > ... but it's frighteningly common for people to try to install my plug-ins
> > on
> > WordPress 2.7 or lower when they explicitly require 2.9 or higher (I've had
> > people try to install them on version 2.0!!! Then they email me a few days
> > later and try to claim the plug-in is broken because it won't work on their
> > system!).
> >
> > So no, a stern warning on the plugin download page isn't enough. I wonder
> > if
> > anyone (lay users) actually reads the full download page before installing
> > or if
> > they just read the name and say "oh, that sounds good."
> >
> > On July 12, 2010 at 5:02 PM Kris Young <KrisY at tbs.uk.com> wrote:
> >
> > > Would have thought that a stern warning on the plugin download page would
> > do
> > > enough. Especially in coding policy on WordPress 3, PHP4 is being slowly
> > > squeezed out.
> > >
> > > Do you anticipate a lot of PHP4 users, or is it a
> > 'better-safe-than-sorry'
> > > measure?
> > >
> > > Kris
> > >
> > > -----Original Message-----
> > > From: wp-hackers-bounces at lists.automattic.com
> > > [mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Eric Mann
> > > Sent: 12 July 2010 15:31
> > > To: wp-hackers at lists.automattic.com
> > > Subject: Re: [wp-hackers] Testing for PHP 5 before activating
> > >
> > > John,
> > >
> > > We'd need to see how your try/catch structure is formed to help you fix
> > that
> > > ...
> > >
> > > On July 12, 2010 at 2:26 PM John Eckman <eckman.john at gmail.com> wrote:
> > >
> > > > Otto - recently in wp-hackers you reposted this code, which I've seen
> > posted
> > > > before.
> > > >
> > > > I'm using it in wpbook (wordpress.org/extend/plugins/wpbook) but I'm
> > still
> > > > having an issue.
> > > >
> > > > Because my plugin uses try/catch syntax, the minute it gets uploaded,
> > before
> > > > the user can even activate it, they get a syntax error about an
> > unexpected
> > > > open curly brace {.
> > > >
> > > > Any suggestions on how to work around that?
> > > >
> > > >
> > > > On Jul 9, 2010, at 3:49 AM, Otto <otto at ottodestruct.com> wrote:
> > > >
> > > > > /**
> > > > > * plugin_activation_check()
> > > > > *
> > > > > * Replace "plugin" with the name of your plugin
> > > > > */
> > > > > function plugin_activation_check(){
> > > > > if (version_compare(PHP_VERSION, '5.0.0', '<')) {
> > > > > deactivate_plugins(basename(__FILE__)); // Deactivate
> > > > >ourself
> > > > > wp_die("Sorry, but you can't run this plugin, it
> > requires
> > > > >PHP 5 or higher.");
> > > > > }
> > > > > }
> > > > > register_activation_hook(__FILE__, 'plugin_activation_check');
> > > > >
> > > > >
> > > > > -Otto
> > > >
> > > >
> > > > ----------------------------------------
> > > > John Eckman
> > > > eckman.john at gmail.com
> > > > http://www.johneckman.com/
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > 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
> > > _______________________________________________
> > > 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
> >
> _______________________________________________
> 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