Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Perform obsolete check against db config also

Previously the check for usage of obsolete configuration variables was
only performed against global variables (defined in config_inc.php).
With this change, a more thorough verification is done, including
values with an override in mantis_config_table.

Detailed information about where the config option is used is printed
with the warning message.

Fixes #13435
  • Loading branch information...
commit 5e9b83428d32ea47386c2dfc5bdb4910a3e6f693 1 parent dbbd3cf
@dregad dregad authored
Showing with 28 additions and 6 deletions.
  1. +2 −2 admin/check.php
  2. +26 −4 core/config_api.php
View
4 admin/check.php
@@ -226,8 +226,6 @@ function test_database_utf8() {
<?php
- require_once( 'obsolete.php' );
-
print_test_row( 'MantisBT requires at least <b>PHP ' . PHP_MIN_VERSION . '</b>. You are running <b>PHP ' . phpversion(), $result = version_compare( phpversion(), PHP_MIN_VERSION, '>=' ) );
if ( !print_test_row( 'Checking Config File Exists', file_exists( $g_absolute_path . 'config_inc.php' ), array( false => 'Please use install.php to perform initial installation <a href="install.php">Click here</a>' ) ) ) {
@@ -239,6 +237,8 @@ function test_database_utf8() {
print_info_row( 'Database is not connected - Can not continue checks' );
}
+require_once( 'obsolete.php' );
+
if( isset( $ADODB_vers ) ) {
# ADOConnection::Version() is broken as it treats v5.1 the same as v5.10
# Therefore we must extract the correct version ourselves
View
30 core/config_api.php
@@ -522,6 +522,7 @@ function config_flush_cache( $p_option = '', $p_user = ALL_USERS, $p_project = A
# Checks if an obsolete configuration variable is still in use. If so, an error
# will be generated and the script will exit. This is called from admin_check.php.
function config_obsolete( $p_var, $p_replace = '' ) {
+ global $g_cache_config;
# @@@ we could trigger a WARNING here, once we have errors that can
# have extra data plugged into them (we need to give the old and
@@ -529,17 +530,38 @@ function config_obsolete( $p_var, $p_replace = '' ) {
if( config_is_set( $p_var ) ) {
$t_description = '<p><b>Warning:</b> The configuration option <tt>$g_' . $p_var . '</tt> is now obsolete</p>';
+ $t_info = '';
+
+ // Check if set in the database
+ if( is_array( $g_cache_config ) && array_key_exists( $p_var, $g_cache_config ) ) {
+ $t_info .= 'it is currently defined in ';
+ if( isset( $GLOBALS['g_' . $p_var] ) ) {
+ $t_info .= 'config_inc.php, as well as in ';
+ }
+ $t_info .= 'the database configuration for: <ul>';
+
+ foreach( $g_cache_config[$p_var] as $t_user_id => $t_user ) {
+ $t_info .= '<li>'
+ . (($t_user_id == 0)? lang_get('all_users') : user_get_name( $t_user_id ))
+ . ': ';
+ foreach ( $t_user as $t_project_id => $t_project ) {
+ $t_info .= project_get_name( $t_project_id ) . ', ';
+ }
+ $t_info = rtrim( $t_info, ', ') . '</li>';
+ }
+ $t_info .= '</ul>';
+ }
+
+ // Replacement defined
if( is_array( $p_replace ) ) {
- $t_info = 'please see the following options: <ul>';
+ $t_info .= 'please see the following options: <ul>';
foreach( $p_replace as $t_option ) {
$t_info .= '<li>$g_' . $t_option . '</li>';
}
$t_info .= '</ul>';
}
else if( !is_blank( $p_replace ) ) {
- $t_info = 'please use <tt>$g_' . $p_replace . '</tt> instead.';
- } else {
- $t_info = '';
+ $t_info .= 'please use <tt>$g_' . $p_replace . '</tt> instead.';
}
print_test_warn_row( $t_description, false, $t_info );
Please sign in to comment.
Something went wrong with that request. Please try again.