forked from gushphp/gush
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathphar-stub.php
30 lines (25 loc) · 904 Bytes
/
phar-stub.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env php
<?php
/*
* This file is part of Gush package.
*
* (c) Luis Cordova <[email protected]>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
if (class_exists('Phar')) {
Phar::mapPhar('gush.phar');
// Copy the cacert.pem file from the phar if it is not in the temp folder.
$from = 'phar://gush.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));
}
}
require 'phar://'.__FILE__.'/bin/gush';
}
__HALT_COMPILER(); ?>