berkmancenter / amber_wordpress

Amber plugin for Wordpress
http://amberlink.org
GNU General Public License v3.0
25 stars 10 forks source link

Add error message if the required PHP cURL extension isn't installed. #26

Closed webster closed 8 years ago

webster commented 8 years ago

Currently the Amber WordPress plugin silently fails to create snapshots if the PHP cURL extension isn't installed, showing all links in the Amber Dashboard with a "Down" status. The error log shows: PHP message: .../amberlink/libraries/AmberNetworkUtils.php:AmberNetworkUtils::open_multi_url:CURL not installed. This can be difficult for an end user to research and debug, and installing the cURL extension resolves the issue.

This pull request adds a check to see if the cURL extension is installed, and throws an error message if it is not, in a manner consistent with the permalink error messages currently in use in the plugin. Additionally, it updates the README to reflect the PHP cURL extension requirement.

screenshot 2016-01-30 at 01 52 55
jlicht commented 8 years ago

This is a great addition - thanks!

To be consistent with the how AmberNetworkUtils.php checks for the presence of cURL, we should probably use:

in_array("curl", get_loaded_extensions())

rather than

function_exists('curl_init')