Skip to content
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 set (database
and/or config_inc.php), for which user(s) and for which project(s), is
printed with the warning message.

To implement this functionality, it was required to alter the order in
which the checks are executed by check/index.php: the DB checks must be
performed before the Configuration checks, otherwise there is no DB
connectivity to verify values in the config table.

Fixes #13435
  • Loading branch information...
1 parent d1cd06c commit 2ef79a9d591fa812d4ac7b93ca39cdbf67e5bd32 @dregad dregad committed Nov 20, 2011
Showing with 31 additions and 9 deletions.
  1. +5 −5 admin/check/index.php
  2. +26 −4 core/config_api.php
View
10 admin/check/index.php
@@ -83,6 +83,11 @@
include( 'check_php_inc.php' );
if( !$g_failed_test ) {
+ define( 'CHECK_DATABASE_INC_ALLOW', true );
+ include( 'check_database_inc.php' );
+}
+
+if( !$g_failed_test ) {
define( 'CHECK_CONFIG_INC_ALLOW', true );
include( 'check_config_inc.php' );
}
@@ -98,11 +103,6 @@
}
if( !$g_failed_test ) {
- define( 'CHECK_DATABASE_INC_ALLOW', true );
- include( 'check_database_inc.php' );
-}
-
-if( !$g_failed_test ) {
define( 'CHECK_CRYPTO_INC_ALLOW', true );
include( 'check_crypto_inc.php' );
View
30 core/config_api.php
@@ -533,24 +533,46 @@ 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
# new config option names in the warning text)
if( config_is_set( $p_var ) ) {
$t_description = 'The configuration option <em>' . $p_var . '</em> is now obsolete';
+ $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>' . $t_option . '</li>';
}
$t_info .= '</ul>';
}
else if( !is_blank( $p_replace ) ) {
- $t_info = 'please use ' . $p_replace . ' instead.';
- } else {
- $t_info = '';
+ $t_info .= 'please use ' . $p_replace . ' instead.';
}
check_print_test_warn_row( $t_description, false, $t_info );

0 comments on commit 2ef79a9

Please sign in to comment.
Something went wrong with that request. Please try again.