Skip to content

Commit 03063fe

Browse files
author
Michael Babker
committed
Verify cURL is usable in environment (Fix #7)
1 parent b83ffa2 commit 03063fe

File tree

1 file changed

+10
-1
lines changed
  • administrator/components/com_patchtester/models

1 file changed

+10
-1
lines changed

administrator/components/com_patchtester/models/pull.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class PatchtesterModelPull extends JModelLegacy
5252
* @param array $config An array of configuration options (name, state, dbo, table_path, ignore_request).
5353
*
5454
* @since 2.0
55+
* @throws RuntimeException
5556
*/
5657
public function __construct($config = array())
5758
{
@@ -62,7 +63,15 @@ public function __construct($config = array())
6263
$options->set('userAgent', 'JPatchTester/2.0');
6364
$options->set('timeout', 120);
6465

65-
$this->transport = JHttpFactory::getHttp($options, 'curl');
66+
// Make sure we can use the cURL driver
67+
$driver = JHttpFactory::getAvailableDriver($options, 'curl');
68+
69+
if (!($driver instanceof JHttpTransportCurl))
70+
{
71+
throw new RuntimeException('Cannot use the PHP cURL adapter in this environment, cannot use patchtester', 500);
72+
}
73+
74+
$this->transport = new JHttp($options, $driver);
6675

6776
// Set up the Github object
6877
$params = JComponentHelper::getParams('com_patchtester');

0 commit comments

Comments
 (0)