mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
add more extensions support
This commit is contained in:
parent
c93a4e843f
commit
6b0baa8365
@ -30,7 +30,8 @@
|
|||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
"arg-type-windows": "with",
|
"arg-type-windows": "with",
|
||||||
"lib-depends": [
|
"lib-depends": [
|
||||||
"libxml2"
|
"libxml2",
|
||||||
|
"zlib"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"enchant": {
|
"enchant": {
|
||||||
|
|||||||
@ -10,53 +10,54 @@
|
|||||||
| bcmath | | yes | |
|
| bcmath | | yes | |
|
||||||
| bz2 | | untested | |
|
| bz2 | | untested | |
|
||||||
| calendar | | yes | |
|
| calendar | | yes | |
|
||||||
| ctype | | | |
|
| ctype | | yes | |
|
||||||
| curl | | yes | |
|
| curl | | yes | |
|
||||||
| date | | yes | |
|
| date | | yes | |
|
||||||
| dom | | | |
|
| dom | | untested | |
|
||||||
| event | | | |
|
| event | | | |
|
||||||
| exif | | | |
|
| exif | | yes | |
|
||||||
| filter | | | |
|
| filter | | yes | |
|
||||||
| fileinfo | | | |
|
| fileinfo | | | |
|
||||||
| ftp | | | |
|
| ftp | | yes | |
|
||||||
| gd | | untested | |
|
| gd | | untested | |
|
||||||
| gmp | | untested | |
|
| gmp | | untested | |
|
||||||
| hash | | yes | |
|
| hash | | yes | |
|
||||||
| iconv | | | |
|
| iconv | | | |
|
||||||
| inotify | | | |
|
| inotify | | | |
|
||||||
| json | | yes | |
|
| json | | yes | |
|
||||||
| libxml | | | |
|
| libxml | | yes | |
|
||||||
| mbstring | | | |
|
| mbstring | | yes | |
|
||||||
| mcrypt | | | |
|
| mcrypt | | | |
|
||||||
| mongodb | | | |
|
| mongodb | | | |
|
||||||
| mysqli | | | |
|
| mysqli | | | |
|
||||||
| mysqlnd | | | |
|
| mysqlnd | | yes | |
|
||||||
| openssl | | yes | |
|
| openssl | | yes | |
|
||||||
| pcntl | | untested | |
|
| pcntl | | untested | |
|
||||||
| pcre | | yes | |
|
| pcre | | yes | |
|
||||||
| pdo | | yes | |
|
| pdo | | yes | |
|
||||||
| pdo_mysql | | | |
|
| pdo_mysql | | yes | |
|
||||||
| pdo_sqlite | | yes | |
|
| pdo_sqlite | | yes | |
|
||||||
| pdo_pgsql | | | |
|
| pdo_pgsql | | | |
|
||||||
| phar | | | |
|
| phar | | yes | |
|
||||||
| posix | | | |
|
| posix | | yes | |
|
||||||
| protobuf | | | |
|
| protobuf | | | |
|
||||||
| readline | | | |
|
| readline | | | |
|
||||||
| redis | | | |
|
| redis | | yes | |
|
||||||
| Reflection | | yes | |
|
| Reflection | | yes | |
|
||||||
|
| session | | yes | |
|
||||||
| shmop | | | |
|
| shmop | | | |
|
||||||
| simplexml | | | |
|
| simplexml | | untested | |
|
||||||
| soap | | | |
|
| soap | | | |
|
||||||
| sockets | | | |
|
| sockets | | | |
|
||||||
| sqlite3 | | untested | |
|
| sqlite3 | | untested | |
|
||||||
| swow | | | |
|
| swow | | | |
|
||||||
| swoole | | yes | |
|
| swoole | | yes | |
|
||||||
| tokenizer | | | |
|
| tokenizer | | yes | |
|
||||||
| xml | | | |
|
| xml | | yes | |
|
||||||
| xmlreader | | | |
|
| xmlreader | | untested | |
|
||||||
| xmlwriter | | | |
|
| xmlwriter | | untested | |
|
||||||
| zip | | | |
|
| zip | | yes | |
|
||||||
| zlib | | | |
|
| zlib | | yes | |
|
||||||
|
|
||||||
## Additional Requirements
|
## Additional Requirements
|
||||||
|
|
||||||
|
|||||||
@ -184,7 +184,7 @@ class Downloader
|
|||||||
|
|
||||||
public static function downloadGit(string $name, string $url, string $branch, ?string $path = null): void
|
public static function downloadGit(string $name, string $url, string $branch, ?string $path = null): void
|
||||||
{
|
{
|
||||||
if ($path) {
|
if ($path !== null) {
|
||||||
$path = SOURCE_PATH . "/{$path}";
|
$path = SOURCE_PATH . "/{$path}";
|
||||||
} else {
|
} else {
|
||||||
$path = DOWNLOAD_PATH . "/{$name}";
|
$path = DOWNLOAD_PATH . "/{$name}";
|
||||||
@ -229,7 +229,7 @@ class Downloader
|
|||||||
public static function fetchSource(string $name, array $source): void
|
public static function fetchSource(string $name, array $source): void
|
||||||
{
|
{
|
||||||
// 避免重复 fetch
|
// 避免重复 fetch
|
||||||
if (is_dir(FileSystem::convertPath(SOURCE_PATH . "/{$name}")) || isset($source['path']) && is_dir(FileSystem::convertPath(SOURCE_PATH . "/{$source['path']}"))) {
|
if (!isset($source['path']) && !is_dir(FileSystem::convertPath(DOWNLOAD_PATH . "/{$name}")) || isset($source['path']) && is_dir(FileSystem::convertPath(SOURCE_PATH . "/{$source['path']}"))) {
|
||||||
logger()->notice("{$name} source already extracted");
|
logger()->notice("{$name} source already extracted");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -291,7 +291,8 @@ class Downloader
|
|||||||
// 从官网直接下载
|
// 从官网直接下载
|
||||||
return [
|
return [
|
||||||
'type' => 'url',
|
'type' => 'url',
|
||||||
'url' => "https://www.php.net/distributions/php-{$version}.tar.gz",
|
// 'url' => "https://www.php.net/distributions/php-{$version}.tar.gz",
|
||||||
|
'url' => "https://mirrors.zhamao.xin/php/php-{$version}.tar.gz",
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,6 +317,24 @@ class Downloader
|
|||||||
$headerArg = implode(' ', array_map(fn ($v) => '"-H' . $v . '"', $headers));
|
$headerArg = implode(' ', array_map(fn ($v) => '"-H' . $v . '"', $headers));
|
||||||
|
|
||||||
$cmd = "curl -sfSL {$methodArg} {$headerArg} \"{$url}\"";
|
$cmd = "curl -sfSL {$methodArg} {$headerArg} \"{$url}\"";
|
||||||
|
if (getenv('CACHE_API_EXEC') === 'yes') {
|
||||||
|
if (!file_exists(SOURCE_PATH . '/.curl_exec_cache')) {
|
||||||
|
$cache = [];
|
||||||
|
} else {
|
||||||
|
$cache = json_decode(file_get_contents(SOURCE_PATH . '/.curl_exec_cache'), true);
|
||||||
|
}
|
||||||
|
if (isset($cache[$cmd]) && $cache[$cmd]['expire'] >= time()) {
|
||||||
|
return $cache[$cmd]['cache'];
|
||||||
|
}
|
||||||
|
f_exec($cmd, $output, $ret);
|
||||||
|
if ($ret !== 0) {
|
||||||
|
throw new DownloaderException('failed http fetch');
|
||||||
|
}
|
||||||
|
$cache[$cmd]['cache'] = implode("\n", $output);
|
||||||
|
$cache[$cmd]['expire'] = time() + 3600;
|
||||||
|
file_put_contents(SOURCE_PATH . '/.curl_exec_cache', json_encode($cache));
|
||||||
|
return $cache[$cmd]['cache'];
|
||||||
|
}
|
||||||
f_exec($cmd, $output, $ret);
|
f_exec($cmd, $output, $ret);
|
||||||
if ($ret !== 0) {
|
if ($ret !== 0) {
|
||||||
throw new DownloaderException('failed http fetch');
|
throw new DownloaderException('failed http fetch');
|
||||||
|
|||||||
5
src/globals/tests/filter.php
Normal file
5
src/globals/tests/filter.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
exit(function_exists('filter_var') ? 0 : 1);
|
||||||
5
src/globals/tests/zip.php
Normal file
5
src/globals/tests/zip.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
exit(class_exists('\\ZipArchive') ? 0 : 1);
|
||||||
5
src/globals/tests/zlib.php
Normal file
5
src/globals/tests/zlib.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
exit(function_exists('gzcompress') ? 0 : 1);
|
||||||
Loading…
x
Reference in New Issue
Block a user