From c604f886855637b639085f9176a539454511fe49 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 17 Jul 2025 12:21:50 +0800 Subject: [PATCH] Disallow alt for php-src --- config/source.json | 3 ++- src/SPC/command/DownloadCommand.php | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/config/source.json b/config/source.json index b3c9cd62..d31a9af2 100644 --- a/config/source.json +++ b/config/source.json @@ -4,7 +4,8 @@ "license": { "type": "file", "path": "LICENSE" - } + }, + "alt": false }, "amqp": { "type": "url", diff --git a/src/SPC/command/DownloadCommand.php b/src/SPC/command/DownloadCommand.php index 1e895bdb..27360bb9 100644 --- a/src/SPC/command/DownloadCommand.php +++ b/src/SPC/command/DownloadCommand.php @@ -245,11 +245,15 @@ class DownloadCommand extends BaseCommand } // if download failed, we will try to download alternative sources logger()->warning("Download failed: {$e->getMessage()}"); - logger()->notice("Trying to download alternative sources for {$source}"); $alt_sources = Config::getSource($source)['alt'] ?? null; if ($alt_sources === null) { + logger()->warning("No alternative sources found for {$source}, using default alternative source"); $alt_config = array_merge($config, $this->getDefaultAlternativeSource($source)); - } else { + } elseif ($alt_sources === false) { + logger()->warning("No alternative sources found for {$source}, skipping alternative download"); + throw $e; + } else{ + logger()->notice("Trying to download alternative sources for {$source}"); $alt_config = array_merge($config, $alt_sources); } Downloader::downloadSource($source, $alt_config, $force_all || in_array($source, $force_list));