Skip to content

Commit

Permalink
Standardize access of option database_version
Browse files Browse the repository at this point in the history
Fixes #26821
  • Loading branch information
atrol authored and dregad committed Apr 1, 2020
1 parent 0d46b29 commit 025210a
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion admin/index.php
Expand Up @@ -79,7 +79,7 @@ function print_info_row( $p_description, $p_value ) {
</td>
</tr>
<?php
print_info_row( lang_get( 'schema_version' ), config_get( 'database_version' ) );
print_info_row( lang_get( 'schema_version' ), config_get( 'database_version', 0, ALL_USERS, ALL_PROJECTS ) );
print_info_row( lang_get( 'adodb_version' ), $g_db->Version() );
?>
<tr>
Expand Down
4 changes: 2 additions & 2 deletions admin/install.php
Expand Up @@ -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;
Expand Down Expand Up @@ -1101,7 +1101,7 @@ function print_test( $p_test_description, $p_result, $p_hard_fail = true, $p_mes
echo '</td>';
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 ) {
Expand Down
4 changes: 2 additions & 2 deletions admin/upgrade_unattended.php
Expand Up @@ -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 );
}
Expand Down Expand Up @@ -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() ) ) {
Expand Down
2 changes: 1 addition & 1 deletion core/html_api.php
Expand Up @@ -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';
}

Expand Down
2 changes: 1 addition & 1 deletion login_page.php
Expand Up @@ -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' );
}
Expand Down
2 changes: 1 addition & 1 deletion login_password_page.php
Expand Up @@ -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' );
}
Expand Down
2 changes: 1 addition & 1 deletion manage_overview_page.php
Expand Up @@ -73,7 +73,7 @@
</tr>
<tr>
<th class="category"><?php echo lang_get( 'schema_version' ) ?></th>
<td><?php echo config_get( 'database_version' ) ?></td>
<td><?php echo config_get( 'database_version', 0, ALL_USERS, ALL_PROJECTS ) ?></td>
</tr>
<tr class="spacer">
<td colspan="2"></td>
Expand Down

0 comments on commit 025210a

Please sign in to comment.