Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/bolt/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,6 @@ wysiwyg:
# Enforcing the use of SSL. If set, all pages will enforce an SSL connection,
# and redirect to HTTPS if you attempt to visit plain HTTP pages.
# enforce_ssl: true

curl_options:
verify_peer: false
6 changes: 6 additions & 0 deletions src/Configuration/Parser/GeneralParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public function parse(): Collection
$general['date_format'] = 'F j, Y H:i';
}

if (! isset($general['curl_options'])) {
$general['curl_options'] = [
'verify_peer' => true,
];
}

return new Collection($general);
}

Expand Down
13 changes: 11 additions & 2 deletions src/DataFixtures/ImageFetchFixtures.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Bolt\DataFixtures;

use Bolt\Configuration\Config;
use Bolt\Configuration\FileLocations;
use Doctrine\Bundle\FixturesBundle\FixtureGroupInterface;
use Doctrine\Persistence\ObjectManager;
Expand All @@ -23,7 +24,10 @@ class ImageFetchFixtures extends BaseFixture implements FixtureGroupInterface
private const AMOUNT = 10;
private const MAX_AMOUNT = 50;

public function __construct(FileLocations $fileLocations)
/** @var array */
private $curlOptions;

public function __construct(FileLocations $fileLocations, Config $config)
{
$this->urls = new Collection([
'https://source.unsplash.com/1280x1024/?business,workspace,interior/',
Expand All @@ -32,6 +36,8 @@ public function __construct(FileLocations $fileLocations)
'https://source.unsplash.com/1280x1024/?technology/',
]);

$this->curlOptions = $config->get('general/curl_options', []);

$this->fileLocations = $fileLocations;
}

Expand Down Expand Up @@ -69,7 +75,10 @@ private function fetchImages(): void

$client = HttpClient::create();
$resource = fopen($outputPath . $filename, 'w');
fwrite($resource, $client->request('GET', $url)->getContent());

$image = $client->request('GET', $url, $this->curlOptions)->getContent();

fwrite($resource, $image);
fclose($resource);

$progressBar->advance();
Expand Down