diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-06-06 21:31:51 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-06-06 21:31:51 +0100 |
| commit | 1dfa27c145ae1645954f5dca9eff6efc561d0f3c (patch) | |
| tree | 79a73a04eb9e5a4520b39cce4ee47636d0941b16 | |
| parent | 2e01e2b8ddadb7b3bf766589790975cee1fb647f (diff) | |
| download | install-1dfa27c145ae1645954f5dca9eff6efc561d0f3c.tar.gz install-1dfa27c145ae1645954f5dca9eff6efc561d0f3c.tar.bz2 install-1dfa27c145ae1645954f5dca9eff6efc561d0f3c.zip | |
install: fix null gBitInstallDb in upgrade step
Each installer step is a separate HTTP request. install_packages.php
creates $gBitInstallDb but by the time install_upgrade.php runs it
is a fresh request and the variable is null, causing a fatal error
when upgrade_packages is submitted.
Re-establish the DB connection at the start of the upgrade submission
block if $gBitInstallDb is not already set.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| -rwxr-xr-x | includes/install_upgrade.php | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/includes/install_upgrade.php b/includes/install_upgrade.php index 2907c18..3fce5bd 100755 --- a/includes/install_upgrade.php +++ b/includes/install_upgrade.php @@ -13,6 +13,12 @@ $errors = $success = []; $gBitInstaller->loadAllUpgradeFiles(); if( !empty( $_REQUEST['upgrade_packages'] )) { + // install_packages.php creates $gBitInstallDb but that runs in a previous request. + // Re-establish the connection here for the upgrade step. + if( empty( $gBitInstallDb ) ) { + $gBitInstallDb = ADONewConnection( $gBitDbType ); + $gBitInstallDb->Connect( $gBitDbHost, $gBitDbUser, $gBitDbPassword, $gBitDbType != 'pdo' ? $gBitDbName : null ); + } if( !empty( $gDebug ) || !empty( $_REQUEST['debug'] ) ) { $gBitInstallDb->debug = 99; } |
