mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-05 15:55:39 +08:00
Fix php74 upx bug (#450)
* fix php74 cannot compile with no-strip or with-upx-pack (including lint some code) * use captainhook installer instead of plugin composer * use captainhook installer instead of plugin composer * add [no build test] flag * update actions/cache version [no build test] * test update actions/cache version * test update actions/cache version * test update actions/cache version
This commit is contained in:
@@ -47,6 +47,13 @@ function arch2gnu(string $arch): string
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Match pattern function
|
||||
* Example: match_pattern('*.txt', 'test.txt') will return true.
|
||||
*
|
||||
* @param string $pattern Pattern string
|
||||
* @param string $subject Subject string
|
||||
*/
|
||||
function match_pattern(string $pattern, string $subject): bool
|
||||
{
|
||||
$pattern = str_replace(['\*', '\\\\.*'], ['.*', '\*'], preg_quote($pattern, '/'));
|
||||
@@ -54,6 +61,12 @@ function match_pattern(string $pattern, string $subject): bool
|
||||
return preg_match($pattern, $subject) === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Quote a string with a quote character
|
||||
*
|
||||
* @param string $str String to quote
|
||||
* @param string $quote Quote character, default: `"`
|
||||
*/
|
||||
function quote(string $str, string $quote = '"'): string
|
||||
{
|
||||
return $quote . $str . $quote;
|
||||
@@ -61,7 +74,6 @@ function quote(string $str, string $quote = '"'): string
|
||||
|
||||
/**
|
||||
* Get Family name of current OS
|
||||
*
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
function osfamily2dir(): string
|
||||
@@ -76,6 +88,41 @@ function osfamily2dir(): string
|
||||
};
|
||||
}
|
||||
|
||||
function shell(?bool $debug = null): UnixShell
|
||||
{
|
||||
/* @noinspection PhpUnhandledExceptionInspection */
|
||||
return new UnixShell($debug);
|
||||
}
|
||||
|
||||
function cmd(?bool $debug = null): WindowsCmd
|
||||
{
|
||||
/* @noinspection PhpUnhandledExceptionInspection */
|
||||
return new WindowsCmd($debug);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current builder.
|
||||
*
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
function builder(): BuilderBase
|
||||
{
|
||||
return BuilderProvider::getBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current patch point.
|
||||
*
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
function patch_point(): string
|
||||
{
|
||||
return BuilderProvider::getBuilder()->getPatchPoint();
|
||||
}
|
||||
|
||||
// ------- function f_* part -------
|
||||
// f_ means standard function wrapper
|
||||
|
||||
/**
|
||||
* Execute the shell command, and the output will be directly printed in the terminal. If there is an error, an exception will be thrown
|
||||
*
|
||||
@@ -126,33 +173,3 @@ function f_putenv(string $env): bool
|
||||
logger()->debug('Setting env: ' . $env);
|
||||
return putenv($env);
|
||||
}
|
||||
|
||||
function shell(?bool $debug = null): UnixShell
|
||||
{
|
||||
return new UnixShell($debug);
|
||||
}
|
||||
|
||||
function cmd(?bool $debug = null): WindowsCmd
|
||||
{
|
||||
return new WindowsCmd($debug);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current builder.
|
||||
*
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
function builder(): BuilderBase
|
||||
{
|
||||
return BuilderProvider::getBuilder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current patch point.
|
||||
*
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
function patch_point(): string
|
||||
{
|
||||
return BuilderProvider::getBuilder()->getPatchPoint();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user