Commit 4f1c3c1
authored
Fix release download failure when
Servers with `allow_url_fopen = Off` (common on shared hosting) fail to
download upgrade ZIPs via `file_get_contents()`, producing "no suitable
wrapper could be found". Since `cURL` is already a declared ChurchCRM
prerequisite, it's the correct transport to use here.
## Changes
- **`src/ChurchCRM/dto/ChurchCRMReleaseManager.php`** —
`downloadRelease()` now uses cURL as the primary download method:
- SSL verification enabled (`CURLOPT_SSL_VERIFYPEER`,
`CURLOPT_SSL_VERIFYHOST`)
- Follows redirects (`CURLOPT_FOLLOWLOCATION`) — needed for GitHub's
release asset CDN
- 300s timeout appropriate for large ZIP payloads
- Captures `curl_errno()` + `curl_error()` + HTTP status code for
actionable failure logs
- Falls back to `file_get_contents` only if `curl_init` is somehow
unavailable
- Existing 3-attempt retry loop with backoff is unchanged
```php
// Before — fails silently when allow_url_fopen=Off
$downloadContent = @file_get_contents($url);
// After — works regardless of allow_url_fopen
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_TIMEOUT, 300);
$result = curl_exec($ch);
```
<!-- START COPILOT ORIGINAL PROMPT -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>Upgrade to 7.0 error</issue_title>
> <issue_description>Using "new release" feature, ChurchCRM throwing
error:
> Error making API Call to: /admin/api/upgrade/download-latest-release
> Error text: Failed to download latest release
> Log attached.
>
>
[260302_release_upgrade_error.log](https://github.com/user-attachments/files/25689642/260302_release_upgrade_error.log)
>
>
>
> Collected Value Title | Data
> ----------------------|----------------
> Page Name |/admin/system/upgrade
> Screen Size |1080x1920
> Window Size |793x1606
> Page Size |1171x1606
> Platform Information | Linux cccat740.hostpapavps.net
4.18.0-553.58.1.el8_10.x86_64 #1 SMP Wed Jun 25 06:37:46
EDT 2025 x86_64
> PHP Version | 8.4.18
> SQL Version | 10.11.16-MariaDB
> ChurchCRM Version |6.8.1
> Reporting Browser |Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0)
Gecko/20100101 Firefox/148.0
> Prerequisite Status |Missing Prerequisites: ["PHP iconv","FileInfo
Extension for image manipulation"]
> </issue_description>
>
> <agent_instructions>Review the logs and recommend a fix
</agent_instructions>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>
</details>
<!-- START COPILOT CODING AGENT SUFFIX -->
- Fixes #8125
<!-- START COPILOT CODING AGENT TIPS -->
---
✨ Let Copilot coding agent [set things up for
you](https://github.com/ChurchCRM/CRM/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot)
— coding agent works faster and does higher quality work when set up for
your repo.allow_url_fopen is disabled (#8127)1 file changed
+40
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | | - | |
| 248 | + | |
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
257 | 276 | | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
262 | 290 | | |
263 | 291 | | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | 292 | | |
269 | 293 | | |
270 | 294 | | |
271 | | - | |
| 295 | + | |
272 | 296 | | |
273 | 297 | | |
274 | 298 | | |
| |||
277 | 301 | | |
278 | 302 | | |
279 | 303 | | |
280 | | - | |
281 | 304 | | |
282 | 305 | | |
283 | | - | |
| 306 | + | |
284 | 307 | | |
285 | | - | |
| 308 | + | |
286 | 309 | | |
287 | 310 | | |
288 | 311 | | |
| |||
0 commit comments