Fix phar with new versions of Guzzle
This commit is contained in:
parent
6584b545ea
commit
205483e14c
2
box.json
2
box.json
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"main": "vendor/autoload.php",
|
"main": "phar-stub.php",
|
||||||
"output": "geoip2.phar",
|
"output": "geoip2.phar",
|
||||||
"compactors": [
|
"compactors": [
|
||||||
"Herrera\\Box\\Compactor\\Composer",
|
"Herrera\\Box\\Compactor\\Composer",
|
||||||
|
|
17
phar-stub.php
Normal file
17
phar-stub.php
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once 'vendor/autoload.php';
|
||||||
|
|
||||||
|
// The following was taken from Guzzle (MIT license)
|
||||||
|
|
||||||
|
// Copy the cacert.pem file from the phar if it is not in the temp folder.
|
||||||
|
$from = 'phar://geoip2.phar/vendor/guzzle/guzzle/src/Guzzle/Http/Resources/cacert.pem';
|
||||||
|
$certFile = sys_get_temp_dir() . '/guzzle-cacert.pem';
|
||||||
|
|
||||||
|
// Only copy when the file size is different
|
||||||
|
if (!file_exists($certFile) || filesize($certFile) != filesize($from)) {
|
||||||
|
if (!copy($from, $certFile)) {
|
||||||
|
throw new RuntimeException("Could not copy {$from} to {$certFile}: "
|
||||||
|
. var_export(error_get_last(), true));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user