From 55c809027891ccf02e68b6d8e02074bd3d5d072c Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Fri, 1 Dec 2023 16:13:54 +0100 Subject: [PATCH 1/3] Only inject custom app config location when missing from parent This makes it easier to support when inside the Phar, as we can use the default config location. --- .../framework/src/Foundation/Internal/LoadConfiguration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/framework/src/Foundation/Internal/LoadConfiguration.php b/packages/framework/src/Foundation/Internal/LoadConfiguration.php index 10bf1418286..c05fa843398 100644 --- a/packages/framework/src/Foundation/Internal/LoadConfiguration.php +++ b/packages/framework/src/Foundation/Internal/LoadConfiguration.php @@ -24,7 +24,7 @@ protected function getConfigurationFiles(Application $app): array { return (array) tap(parent::getConfigurationFiles($app), function (array &$files) use ($app): void { // Inject our custom config file which is stored in `app/config.php`. - $files['app'] = $app->basePath().DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'config.php'; + $files['app'] ??= $app->basePath().DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'config.php'; $this->providePharSupportIfNeeded($files); }); From 5eaeccbff90b3df6cf5ce0bcf24e6e89a69b19e0 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Fri, 1 Dec 2023 16:14:49 +0100 Subject: [PATCH 2/3] Remove experimental Phar support from internal configuration loader This is because it is no longer needed, thanks to 55c809027891ccf02e68b6d8e02074bd3d5d072c --- .../Foundation/Internal/LoadConfiguration.php | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/packages/framework/src/Foundation/Internal/LoadConfiguration.php b/packages/framework/src/Foundation/Internal/LoadConfiguration.php index c05fa843398..db1b31e4090 100644 --- a/packages/framework/src/Foundation/Internal/LoadConfiguration.php +++ b/packages/framework/src/Foundation/Internal/LoadConfiguration.php @@ -4,16 +4,13 @@ namespace Hyde\Foundation\Internal; -use Phar; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\Config\Repository; use Illuminate\Foundation\Bootstrap\LoadConfiguration as BaseLoadConfiguration; use function getenv; use function array_merge; -use function dirname; use function in_array; -use function is_dir; use function tap; /** @internal */ @@ -25,8 +22,6 @@ protected function getConfigurationFiles(Application $app): array return (array) tap(parent::getConfigurationFiles($app), function (array &$files) use ($app): void { // Inject our custom config file which is stored in `app/config.php`. $files['app'] ??= $app->basePath().DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.'config.php'; - - $this->providePharSupportIfNeeded($files); }); } @@ -61,24 +56,6 @@ private function mergeConfigurationFile(Repository $repository, string $file): v )); } - /** - * Provide support for running Hyde in a Phar archive. - * - * @experimental - * - * @codeCoverageIgnore - */ - private static function providePharSupportIfNeeded(array &$files): void - { - // If we're running in a Phar and no project config directory exists, - // we need to adjust the path to use the bundled static Phar config file. - - /** @var array{app: string} $files */ - if (Phar::running() && (! is_dir($files['app']))) { - $files['app'] = dirname(__DIR__, 6).DIRECTORY_SEPARATOR.'config'.DIRECTORY_SEPARATOR.'app.php'; - } - } - private function loadRuntimeConfiguration(Application $app, Repository $repository): void { if ($app->runningInConsole()) { From 9759ad8beb3a587ee6c8cd1f603a94d96b632cd6 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Fri, 1 Dec 2023 16:17:10 +0100 Subject: [PATCH 3/3] Update RELEASE_NOTES.md --- RELEASE_NOTES.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 7309c20bf19..ead8bb0b1ba 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -29,3 +29,8 @@ This serves two purposes: ### Security - in case of vulnerabilities. + +### Internal + +- Internal: Only inject custom app config location when missing from parent in https://github.com/hydephp/develop/pull/1485 +- Internal: Remove experimental Phar support from internal configuration loader in https://github.com/hydephp/develop/pull/1485