* Setup: fix installation check to correctly detect installed packages with Composer 2.x

This commit is contained in:
ralf 2022-05-25 10:05:53 +02:00
parent 61b09363af
commit 963eb9e916

View File

@ -76,7 +76,7 @@ $checks = array(
), ),
'display_errors' => array( 'display_errors' => array(
'func' => 'php_ini_check', 'func' => 'php_ini_check',
'value' => 0, 'value' => '',
'verbose_value' => 'Off', 'verbose_value' => 'Off',
'warning' => lang('%1 is set to %2. This is NOT recommeded for a production system, as displayed error messages can contain passwords or other sensitive information!','display_errors',ini_get('display_errors')), 'warning' => lang('%1 is set to %2. This is NOT recommeded for a production system, as displayed error messages can contain passwords or other sensitive information!','display_errors',ini_get('display_errors')),
), ),
@ -337,9 +337,10 @@ function composer_check($package)
if (!isset($installed)) if (!isset($installed))
{ {
$installed = array(); $installed = array();
if (file_exists(EGW_SERVER_ROOT.'/vendor') && file_exists($json=EGW_SERVER_ROOT.'/vendor/composer/installed.json')) if (file_exists(EGW_SERVER_ROOT.'/vendor') && file_exists($path=EGW_SERVER_ROOT.'/vendor/composer/installed.json'))
{ {
foreach(json_decode(file_get_contents($json), true) as $package_data) $json = json_decode(file_get_contents($path) ?: '{"packages": []}', true);
foreach($json['packages'] as $package_data)
{ {
$installed[strtolower($package_data['name'])] = $package_data['version']; $installed[strtolower($package_data['name'])] = $package_data['version'];
} }
@ -840,4 +841,4 @@ if ($run_by_webserver)
} }
$setup_tpl->pparse('out','T_footer'); $setup_tpl->pparse('out','T_footer');
//echo "</body>\n</html>\n"; //echo "</body>\n</html>\n";
} }