mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-07 00:35:41 +08:00
Update redis to 6.0.2, add alternative license file searcher (#539)
* Update redis to 6.0.2, add alternative license file searcher * Update docs about source module
This commit is contained in:
@@ -30,7 +30,7 @@ use Symfony\Component\Console\Application;
|
||||
*/
|
||||
final class ConsoleApplication extends Application
|
||||
{
|
||||
public const VERSION = '2.3.3';
|
||||
public const VERSION = '2.3.4';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@@ -118,20 +118,26 @@ class LicenseDumper
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
private function loadSourceFile(string $source_name, int $index, ?string $in_path, ?string $custom_base_path = null): string
|
||||
private function loadSourceFile(string $source_name, int $index, null|array|string $in_path, ?string $custom_base_path = null): string
|
||||
{
|
||||
if (is_null($in_path)) {
|
||||
throw new RuntimeException('source [' . $source_name . '] license file is not set, please check config/source.json');
|
||||
}
|
||||
|
||||
if (file_exists(SOURCE_PATH . '/' . ($custom_base_path ?? $source_name) . '/' . $in_path)) {
|
||||
return file_get_contents(SOURCE_PATH . '/' . ($custom_base_path ?? $source_name) . '/' . $in_path);
|
||||
if (!is_array($in_path)) {
|
||||
$in_path = [$in_path];
|
||||
}
|
||||
|
||||
foreach ($in_path as $item) {
|
||||
if (file_exists(SOURCE_PATH . '/' . ($custom_base_path ?? $source_name) . '/' . $item)) {
|
||||
return file_get_contents(SOURCE_PATH . '/' . ($custom_base_path ?? $source_name) . '/' . $item);
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists(BUILD_ROOT_PATH . '/source-licenses/' . $source_name . '/' . $index . '.txt')) {
|
||||
return file_get_contents(BUILD_ROOT_PATH . '/source-licenses/' . $source_name . '/' . $index . '.txt');
|
||||
}
|
||||
|
||||
throw new RuntimeException('source [' . $source_name . '] license file [' . $in_path . '] not exist');
|
||||
throw new RuntimeException('Cannot find any license file in source [' . $source_name . '] directory!');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user