mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 12:54:52 +08:00
Add target dir to extract hook
This commit is contained in:
parent
9463cf94ca
commit
1d78a231db
@ -195,7 +195,7 @@ class FileSystem
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
self::extractArchive($filename, $target);
|
self::extractArchive($filename, $target);
|
||||||
self::emitSourceExtractHook($name);
|
self::emitSourceExtractHook($name, $target);
|
||||||
} catch (RuntimeException $e) {
|
} catch (RuntimeException $e) {
|
||||||
if (PHP_OS_FAMILY === 'Windows') {
|
if (PHP_OS_FAMILY === 'Windows') {
|
||||||
f_passthru('rmdir /s /q ' . $target);
|
f_passthru('rmdir /s /q ' . $target);
|
||||||
@ -518,10 +518,10 @@ class FileSystem
|
|||||||
return file_put_contents($filename, $file);
|
return file_put_contents($filename, $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function emitSourceExtractHook(string $name): void
|
private static function emitSourceExtractHook(string $name, string $target): void
|
||||||
{
|
{
|
||||||
foreach ((self::$_extract_hook[$name] ?? []) as $hook) {
|
foreach ((self::$_extract_hook[$name] ?? []) as $hook) {
|
||||||
if ($hook($name) === true) {
|
if ($hook($name, $target) === true) {
|
||||||
logger()->info('Patched source [' . $name . '] after extracted');
|
logger()->info('Patched source [' . $name . '] after extracted');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user