• I think it would be great if there were a way for plugin developers to specify compatibility requirements beyond the WordPress version. For instance, if the plugin requires a higher version of PHP or a particular extension or function, plugin authors should be able to specify the requirements in the readme:

    === Plugin Name ===
    .
    .
    .
    Requires at least: 2.0.2
    Tested up to: 2.1
    Stable tag: 4.3
    Minimum PHP Verison: 5.3
    Required Extensions: IMAP
    Required Functions: json_ encode

    It would only take a couple of simple checks (extension_loaded, function_exists, phpversion) to see if you meet the requirements (when using the plugin browser within WordPress).

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    That can be coded into your plugin, to check for PHP version, WP version, etc etc. Since there are so many different implementations of PHP, however, it would be a pretty tall order to put that into Core. Right now, it’s up to the plugin devs.

    Thread Starter mtinsley

    (@mtinsley)

    That can be coded into your plugin, to check for PHP version, WP version, etc etc.

    I just thought it would be more convenient if the plugin browser notified users of any compatibility issues prior to installing the plugin. This would take some of the burden off of plugin developers.

    Since there are so many different implementations of PHP, however, it would be a pretty tall order to put that into Core.

    I’m not sure I get your meaning. Once the data is incorporated into the plugin api it would be fairly simple to add a few more checks in addition to the existing WordPress compatibility checks.

    For example, this is the code where the wordpress version is checked (plugin-install.php line 341):

    if ( !empty($api->tested) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->tested)), $api->tested, '>') )<br />
    			echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been tested</strong> with your current version of WordPress.') . '</p></div>';</p>
    <p>		else if ( !empty($api->requires) && version_compare( substr($GLOBALS['wp_version'], 0, strlen($api->requires)), $api->requires, '<') )<br />
    			echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of WordPress.') . '</p></div>';

    Assuming the api is updated to include a minimum php version data point you would just need to add the following to check if you meet the requirement:

    <br />
    if ( !empty($api->min_php) && version_compare( phpversion(), $api->min_php, '<') )<br />
    			echo '<div class="updated"><p>' . __('<strong>Warning:</strong> This plugin has <strong>not been marked as compatible</strong> with your version of PHP.') . '</p></div>';<br />

    Unless there is something I’m not understanding it seems like the biggest challenge would be to update the plugin api to include the additional data from the readme, not wordpress itself.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    I meant with regards to php-addons, sorry, I’m gonna blame how ganked I was Friday ??

    A quick check for PHP minimum version, sure, that could work.

    Thread Starter mtinsley

    (@mtinsley)

    I meant with regards to php-addons, sorry, I’m gonna blame how ganked I was Friday ??

    I know the feeling ??

    Even with extensions and functions it’s a simple check. The only difference with the code I posted above is that you would have to iterate over each of the required functions or extensions in the readme file, and call function_exists or extension_loaded.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Better Compatibility Checking’ is closed to new replies.