Properly implemented composer.enable_internal_composer
so that warnings regarding improper configuration values are not thrown
This commit is contained in:
parent
1212ab49c5
commit
da9e615418
2 changed files with 11 additions and 8 deletions
|
@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
- Bug fix where resources are not decoded correctly when installing packages [#31](https://git.n64.cc/nosial/ncc/-/issues/42)
|
||||
- Fixed issue where dependency conflicts are thrown even when `--reinstall` is used
|
||||
- Properly implemented `composer.enable_internal_composer` so that warnings regarding improper configuration values are not thrown
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
|
@ -519,14 +519,24 @@ namespace ncc\Classes\ComposerExtension;
|
|||
Console::outVerbose(sprintf('Getting composer path for %s', Functions::getConfigurationProperty('composer.path')));
|
||||
|
||||
$composer_enabled = Functions::getConfigurationProperty('composer.enabled');
|
||||
$internal_composer_enabled = Functions::getConfigurationProperty('composer.enable_internal_composer');
|
||||
if ($composer_enabled !== null && $composer_enabled === false)
|
||||
throw new ComposerDisabledException('Composer is disabled by the configuration `composer.enabled`');
|
||||
|
||||
$config_property = Functions::getConfigurationProperty('composer.executable_path');
|
||||
|
||||
Console::outDebug(sprintf('composer.enabled = %s', ($composer_enabled ?? 'n/a')));
|
||||
Console::outDebug(sprintf('composer.enable_internal_composer = %s', ($internal_composer_enabled ?? 'n/a')));
|
||||
Console::outDebug(sprintf('composer.executable_path = %s', ($config_property ?? 'n/a')));
|
||||
|
||||
if ($internal_composer_enabled && defined('NCC_EXEC_LOCATION'))
|
||||
{
|
||||
if (!file_exists(NCC_EXEC_LOCATION . DIRECTORY_SEPARATOR . 'composer.phar'))
|
||||
throw new InternalComposerNotAvailableException(NCC_EXEC_LOCATION . DIRECTORY_SEPARATOR . 'composer.phar');
|
||||
Console::outDebug(sprintf('using composer path from NCC_EXEC_LOCATION: %s', NCC_EXEC_LOCATION . DIRECTORY_SEPARATOR . 'composer.phar'));
|
||||
return NCC_EXEC_LOCATION . DIRECTORY_SEPARATOR . 'composer.phar';
|
||||
}
|
||||
|
||||
if ($config_property !== null && strlen($config_property) > 0)
|
||||
{
|
||||
if (!file_exists($config_property))
|
||||
|
@ -540,14 +550,6 @@ namespace ncc\Classes\ComposerExtension;
|
|||
}
|
||||
}
|
||||
|
||||
if (defined('NCC_EXEC_LOCATION'))
|
||||
{
|
||||
if (!file_exists(NCC_EXEC_LOCATION . DIRECTORY_SEPARATOR . 'composer.phar'))
|
||||
throw new InternalComposerNotAvailableException(NCC_EXEC_LOCATION . DIRECTORY_SEPARATOR . 'composer.phar');
|
||||
Console::outDebug(sprintf('using composer path from NCC_EXEC_LOCATION: %s', NCC_EXEC_LOCATION . DIRECTORY_SEPARATOR . 'composer.phar'));
|
||||
return NCC_EXEC_LOCATION . DIRECTORY_SEPARATOR . 'composer.phar';
|
||||
}
|
||||
|
||||
throw new ComposerNotAvailableException('No composer executable path is configured');
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue