Skip to content

Commit

Permalink
Merge pull request #15051 from snipe/jerm/add-upgrade-script-debugging
Browse files Browse the repository at this point in the history
upgrade.php: More helpful output when we can't read .upgrade_requirements.json
  • Loading branch information
snipe authored Jul 10, 2024
2 parents 22aca1a + 25fabcc commit bfa42ff
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,23 @@ function url_get_contents ($Url) {

// Fetching most current upgrade requirements from github. Read more here: https://github.com/snipe/snipe-it/pull/14127
$remote_requirements_file = "https://raw.githubusercontent.com/snipe/snipe-it/$branch/.upgrade_requirements.json";
$upgrade_requirements = json_decode(url_get_contents($remote_requirements_file), true);

$upgrade_requirements_raw = url_get_contents($remote_requirements_file);
$upgrade_requirements = json_decode($upgrade_requirements_raw, true);
if (! $upgrade_requirements) {
if(!$skip_php_checks){
echo "\nERROR: Failed to retrieve remote requirements from $remote_requirements_file\n\n";
if ($branch_override){
echo "NOTE: You passed a custom branch: $branch\n";
echo " If the above URL doesn't work, that may be why. Please check you branch spelling/extistance\n\n";
}

if (json_last_error()) {
print "JSON DECODE ERROR DETECTED:\n";
print json_last_error_msg() . "\n\n";
print "Raw curl output:\n";
print $upgrade_requirements_raw . "\n\n";
}

echo "We suggest correcting this, but if you can't, please verify that your requirements conform to those at that url.\n\n";
echo " -- DANGER -- DO AT YOUR OWN RISK --\n";
echo " IF YOU ARE SURE, re-run this script with --skip-php-compatibility-checks to skip this check.\n";
Expand Down

0 comments on commit bfa42ff

Please sign in to comment.