33
0
mirror of https://github.com/joomla-extensions/patchtester.git synced 2024-12-23 11:29:00 +00:00

Verify cURL is usable in environment (Fix #7)

This commit is contained in:
Michael Babker 2013-09-28 19:02:04 -05:00
parent b83ffa291e
commit 03063fea23

View File

@ -52,6 +52,7 @@ class PatchtesterModelPull extends JModelLegacy
* @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request). * @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request).
* *
* @since 2.0 * @since 2.0
* @throws RuntimeException
*/ */
public function __construct($config = array()) public function __construct($config = array())
{ {
@ -62,7 +63,15 @@ class PatchtesterModelPull extends JModelLegacy
$options->set('userAgent', 'JPatchTester/2.0'); $options->set('userAgent', 'JPatchTester/2.0');
$options->set('timeout', 120); $options->set('timeout', 120);
$this->transport = JHttpFactory::getHttp($options, 'curl'); // Make sure we can use the cURL driver
$driver = JHttpFactory::getAvailableDriver($options, 'curl');
if (!($driver instanceof JHttpTransportCurl))
{
throw new RuntimeException('Cannot use the PHP cURL adapter in this environment, cannot use patchtester', 500);
}
$this->transport = new JHttp($options, $driver);
// Set up the Github object // Set up the Github object
$params = JComponentHelper::getParams('com_patchtester'); $params = JComponentHelper::getParams('com_patchtester');