[wp-hackers] readme.txt: "Requires PHP 5 tag"

Aaron D. Campbell aaron at xavisys.com
Wed Jul 15 16:02:11 UTC 2009


Are you sure about that?  It looks like the deactivation hook is 
silently skipped, but it looks like the activation hook runs normally on 
an auto upgrade.

Stephen Rider wrote:
> That won't work for auto-updates (a plugin going from "works with PHP 
> 4+" to "works with PHP 5+").
>
> The activation hook does not fire during auto update.
>
> On Jul 14, 2009, at 3:41 PM, Otto wrote:
>
>> Don't rely on users, they're invariably idiots. ;)
>>
>> Make your plugin smarter instead.
>>
>> /**
>> * 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');



More information about the wp-hackers mailing list