From 025210a3d50f7eca0489cf80dda80cdbbd999cbc Mon Sep 17 00:00:00 2001 From: Roland Becker Date: Sun, 12 Jan 2020 22:06:26 +0100 Subject: [PATCH] Standardize access of option database_version Fixes #26821 --- admin/index.php | 2 +- admin/install.php | 4 ++-- admin/upgrade_unattended.php | 4 ++-- core/html_api.php | 2 +- login_page.php | 2 +- login_password_page.php | 2 +- manage_overview_page.php | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/admin/index.php b/admin/index.php index 50f458b89a..b8d52bb0e2 100644 --- a/admin/index.php +++ b/admin/index.php @@ -79,7 +79,7 @@ function print_info_row( $p_description, $p_value ) { Version() ); ?> diff --git a/admin/install.php b/admin/install.php index 0aaed43ed0..305452afff 100644 --- a/admin/install.php +++ b/admin/install.php @@ -264,7 +264,7 @@ function print_test( $p_test_description, $p_result, $p_hard_fail = true, $p_mes $g_db_connected = true; } - $t_cur_version = config_get( 'database_version', -1 ); + $t_cur_version = config_get( 'database_version', -1, ALL_USERS, ALL_PROJECTS); if( $t_cur_version > 1 ) { $g_database_upgrade = true; @@ -1101,7 +1101,7 @@ function print_test( $p_test_description, $p_result, $p_hard_fail = true, $p_mes echo ''; if( $t_ret == 2 ) { print_test_result( GOOD ); - config_set( 'database_version', $i ); + config_set( 'database_version', $i, ALL_USERS, ALL_PROJECTS ); } else { $t_all_sql = ''; if( $t_sql ) { diff --git a/admin/upgrade_unattended.php b/admin/upgrade_unattended.php index 180b5284fb..0382d225d3 100644 --- a/admin/upgrade_unattended.php +++ b/admin/upgrade_unattended.php @@ -88,7 +88,7 @@ function print_test_result( $p_result, $p_hard_fail = true, $p_message = '' ) { # TODO: Enhance this check to support the mode where this script is called on an empty database. # check to see if the new installer was used -if( -1 == config_get( 'database_version', -1 ) ) { +if( -1 == config_get( 'database_version', -1, ALL_USERS, ALL_PROJECTS ) ) { echo 'Upgrade from the current installed MantisBT version is no longer supported. If you are using MantisBT version older than 1.0.0, then upgrade to v1.0.0 first.'; exit( 1 ); } @@ -180,7 +180,7 @@ function print_test_result( $p_result, $p_hard_fail = true, $p_message = '' ) { if( $t_ret == 2 ) { print_test_result( GOOD ); - config_set( 'database_version', $i ); + config_set( 'database_version', $i, ALL_USERS, ALL_PROJECTS ); } else { $t_msg = $t_sqlarray[0]; if( !is_blank( $g_db->ErrorMsg() ) ) { diff --git a/core/html_api.php b/core/html_api.php index f33aa30095..2c9534144a 100644 --- a/core/html_api.php +++ b/core/html_api.php @@ -898,7 +898,7 @@ function print_admin_menu_bar( $p_page ) { } else { global $g_upgrade; include_once( 'schema.php' ); - if( count( $g_upgrade ) - 1 != config_get( 'database_version' ) ) { + if( count( $g_upgrade ) - 1 != config_get( 'database_version', -1, ALL_USERS, ALL_PROJECTS ) ) { $t_menu_items['install.php'] = 'Upgrade your installation'; } diff --git a/login_page.php b/login_page.php index 95ab091e7b..8bd7417bbc 100644 --- a/login_page.php +++ b/login_page.php @@ -172,7 +172,7 @@ function debug_setting_message ( $p_type, $p_setting, $p_value ) { # since admin directory and db_upgrade lists are available check for missing db upgrades # if db version is 0, we do not have a valid database. - $t_db_version = config_get( 'database_version', 0 ); + $t_db_version = config_get( 'database_version', 0, ALL_USERS, ALL_PROJECTS ); if( $t_db_version == 0 ) { $t_warnings[] = lang_get( 'error_database_no_schema_version' ); } diff --git a/login_password_page.php b/login_password_page.php index 1bebca54ab..29bc2dc446 100644 --- a/login_password_page.php +++ b/login_password_page.php @@ -173,7 +173,7 @@ if( config_get_global( 'admin_checks' ) == ON && file_exists( dirname( __FILE__ ) .'/admin/.' ) ) { # since admin directory and db_upgrade lists are available check for missing db upgrades # if db version is 0, we do not have a valid database. - $t_db_version = config_get( 'database_version', 0 ); + $t_db_version = config_get( 'database_version', 0, ALL_USERS, ALL_PROJECTS ); if( $t_db_version == 0 ) { $t_warnings[] = lang_get( 'error_database_no_schema_version' ); } diff --git a/manage_overview_page.php b/manage_overview_page.php index 03afced295..9093324d81 100644 --- a/manage_overview_page.php +++ b/manage_overview_page.php @@ -73,7 +73,7 @@ - +