summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-06-06 21:31:51 +0100
committerLester Caine <lester@lsces.co.uk>2026-06-06 21:31:51 +0100
commit1dfa27c145ae1645954f5dca9eff6efc561d0f3c (patch)
tree79a73a04eb9e5a4520b39cce4ee47636d0941b16
parent2e01e2b8ddadb7b3bf766589790975cee1fb647f (diff)
downloadinstall-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-xincludes/install_upgrade.php6
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;
}