View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0012006 | mantisbt | plug-ins | public | 2010-06-08 09:00 | 2014-09-23 18:05 |
Reporter | fxm | Assigned To | atrol | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.2.1 | ||||
Target Version | 1.2.9 | Fixed in Version | 1.2.9 | ||
Summary | 0012006: Mantis Graphs - Configuration - jpgraph library path not saved | ||||
Description | The value of "Jpgraph Library Path" is not saved when I try to modify it. | ||||
Additional Information | Windows XP 2003 server | ||||
Tags | No tags attached. | ||||
Attached Files | issue12006.patch (4,703 bytes)
From 4f0ce3c3d55f46cff4f3a4080cb124a06f9c9b7c Mon Sep 17 00:00:00 2001 From: Roland Becker <roland@atrol.de> Date: Mon, 6 Sep 2010 12:57:41 +0200 Subject: [PATCH] Fix #12006: Mantis Graphs - Configuration - jpgraph library path not saved --- core/config_api.php | 27 +++++++++++++++++++++------ core/plugin_api.php | 6 +++--- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/core/config_api.php b/core/config_api.php index 1fc3f45..b1eae73 100644 --- a/core/config_api.php +++ b/core/config_api.php @@ -52,13 +52,17 @@ $g_cache_config_project = null; # if not found, config_id + default user + current project # if not found, config_id + default user + all_project. # 3.use GLOBAL[config_id] -function config_get( $p_option, $p_default = null, $p_user = null, $p_project = null ) { +function config_get( $p_option, $p_default = null, $p_user = null, $p_project = null, $p_config_can_set_in_database = false ) { global $g_cache_config, $g_cache_config_access, $g_cache_db_table_exists, $g_cache_filled; global $g_cache_config_user, $g_cache_config_project, $g_project_override; # @@ debug @@ echo "lu o=$p_option "; # bypass table lookup for certain options - $t_bypass_lookup = !config_can_set_in_database( $p_option ); + if ( $p_config_can_set_in_database ) { + $t_bypass_lookup = false; + } else { + $t_bypass_lookup = !config_can_set_in_database( $p_option ); + } # @@ debug @@ if ($t_bypass_lookup) { echo "bp=$p_option match=$t_match_pattern <br />"; } @@ -307,7 +311,7 @@ function config_is_set( $p_option, $p_user = null, $p_project = null ) { # ------------------ # Sets the value of the given config option to the given value # If the config option does not exist, an ERROR is triggered -function config_set( $p_option, $p_value, $p_user = NO_USER, $p_project = ALL_PROJECTS, $p_access = DEFAULT_ACCESS_LEVEL ) { +function config_set( $p_option, $p_value, $p_user = NO_USER, $p_project = ALL_PROJECTS, $p_access = DEFAULT_ACCESS_LEVEL, $p_config_can_set_in_database = false ) { if( $p_access == DEFAULT_ACCESS_LEVEL ) { $p_access = config_get_global( 'admin_site_threshold' ); } @@ -325,7 +329,13 @@ function config_set( $p_option, $p_value, $p_user = NO_USER, $p_project = ALL_PR $c_value = $p_value; } - if( config_can_set_in_database( $p_option ) ) { + if ( $p_config_can_set_in_database ) { + $t_bypass_lookup = false; + } else { + $t_bypass_lookup = !config_can_set_in_database( $p_option ); + } + + if( !$t_bypass_lookup ) { $c_option = $p_option; $c_user = db_prepare_int( $p_user ); $c_project = db_prepare_int( $p_project ); @@ -436,11 +446,16 @@ function config_can_delete( $p_option ) { # ------------------ # delete the config entry -function config_delete( $p_option, $p_user = ALL_USERS, $p_project = ALL_PROJECTS ) { +function config_delete( $p_option, $p_user = ALL_USERS, $p_project = ALL_PROJECTS, $p_config_can_set_in_database = false ) { global $g_cache_config, $g_cache_config_access; # bypass table lookup for certain options - $t_bypass_lookup = !config_can_set_in_database( $p_option ); + if ( $p_config_can_set_in_database ) { + $t_bypass_lookup = false; + } else { + $t_bypass_lookup = !config_can_set_in_database( $p_option ); + } + # @@ debug @@ if ($t_bypass_lookup) { echo "bp=$p_option match=$t_match_pattern <br />"; } # @@ debug @@ if ( ! db_is_connected() ) { echo "no db"; } diff --git a/core/plugin_api.php b/core/plugin_api.php index 5e75da4..94a1d05 100644 --- a/core/plugin_api.php +++ b/core/plugin_api.php @@ -165,7 +165,7 @@ function plugin_config_get( $p_option, $p_default = null, $p_global = false ) { if( $p_global ) { return config_get_global( $t_full_option, $p_default ); } else { - return config_get( $t_full_option, $p_default ); + return config_get( $t_full_option, $p_default, null, null, true ); } } @@ -185,7 +185,7 @@ function plugin_config_set( $p_option, $p_value, $p_user = NO_USER, $p_project = $t_basename = plugin_get_current(); $t_full_option = 'plugin_' . $t_basename . '_' . $p_option; - config_set( $t_full_option, $p_value, $p_user, $p_project, $p_access ); + config_set( $t_full_option, $p_value, $p_user, $p_project, $p_access, true ); } /** @@ -198,7 +198,7 @@ function plugin_config_delete( $p_option, $p_user = ALL_USERS, $p_project = ALL_ $t_basename = plugin_get_current(); $t_full_option = 'plugin_' . $t_basename . '_' . $p_option; - config_delete( $t_full_option, $p_user, $p_project ); + config_delete( $t_full_option, $p_user, $p_project, true ); } /** -- 1.7.2.2 issue12006_1.patch (3,593 bytes)
From dce7638ae05aee1a7b9e8e0ba8dbdf5d2ffa1a9c Mon Sep 17 00:00:00 2001 From: Roland Becker <roland@atrol.de> Date: Thu, 8 Dec 2011 14:36:39 +0100 Subject: [PATCH] Fix #12006: Mantis Graphs - Configuration - jpgraph library path not saved --- config_defaults_inc.php | 20 ++++++++++++++------ core/config_api.php | 4 ++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/config_defaults_inc.php b/config_defaults_inc.php index 163e1f5..d0550f8 100644 --- a/config_defaults_inc.php +++ b/config_defaults_inc.php @@ -3874,13 +3874,21 @@ /** * The following list of variables should never be in the database. - * These patterns will be concatenated and used as a regular expression - * to bypass the database lookup and look here for appropriate global settings. + * It is usd to bypass the database lookup and look here for appropriate global settings. * @global array $g_global_settings */ + $g_global_settings = array( - '_table$', 'cookie', '^db_', 'hostname', 'allow_signup', 'database_name', 'show_queries_', 'admin_checks', 'version_suffix', 'global_settings', - '_path$', 'use_iis', 'language', 'use_javascript', 'minimal_jscss', 'display_errors', 'show_detailed_errors', 'stop_on_errors', 'login_method', '_file$', - 'anonymous', 'content_expire', 'html_valid_tags', 'custom_headers', 'rss_key_seed', 'plugins_enabled', 'session_', 'form_security_', - 'compress_html', '_page$', '_url$', + 'path', 'icon_path', 'short_path', 'absolute_path', 'core_path', 'class_path', 'absolute_path_default_upload_folder', + 'ldap_simulation_file_path', 'cookie_path', 'plugin_path', 'db_table_prefix', 'db_table_suffix', 'db_table', + 'cookie_time_length', 'cookie_path', 'cookie_domain', 'cookie_version', 'cookie_prefix', 'string_cookie', 'project_cookie', + 'view_all_cookie', 'manage_cookie', 'logout_cookie', 'bug_list_cookie', 'db_username', 'db_password', 'db_schema', 'db_type', + 'hostname', 'allow_signup', 'database_name', 'show_queries_count', 'show_queries_threshold', 'show_queries_list', + 'admin_checks', 'version_suffix', 'global_settings','use_iis', 'default_language', 'language_choices_arr', + 'language_auto_map', 'fallback_language', 'use_javascript', 'minimal_jscss', 'display_errors', 'show_detailed_errors', + 'stop_on_errors', 'login_method', 'fileinfo_magic_db_file', 'css_include_file', 'css_rtl_include_file', 'meta_include_file', + 'allow_anonymous_login', 'anonymous_account', 'content_expire', 'html_valid_tags', 'html_valid_tags_single_line', + 'custom_headers', 'rss_key_seed', 'plugins_enabled', 'session_handler', 'session_key', 'session_save_path', + 'session_validation', 'form_security_validation', 'compress_html', 'bottom_include_page', 'top_include_page', + 'default_home_page', 'logout_redirect_page', 'manual_url', 'logo_url', 'create_short_url', 'wiki_engine_url', ); diff --git a/core/config_api.php b/core/config_api.php index 9f363b4..239eab1 100644 --- a/core/config_api.php +++ b/core/config_api.php @@ -419,9 +419,9 @@ function config_can_set_in_database( $p_option ) { # bypass table lookup for certain options if( $g_cache_can_set_in_database == '' ) { - $g_cache_can_set_in_database = '/' . implode( '|', config_get_global( 'global_settings' ) ) . '/'; + $g_cache_can_set_in_database = config_get_global( 'global_settings' ); } - $t_bypass_lookup = ( 0 < preg_match( $g_cache_can_set_in_database, $p_option ) ); + $t_bypass_lookup = in_array( $p_option, $g_cache_can_set_in_database, true ); $g_cache_bypass_lookup[$p_option] = $t_bypass_lookup; -- 1.7.4.msysgit.0 | ||||
Reminder sent to: jreese Could you please have a look at my patch and if it's OK let it become part of next 1.2.x version? This is a fix for the problem, but IMO not a clean solution because there is also a conceptual question. First I tried a simple solution to exclude pregmatch "/^plugin/" in function config_can_set_in_database to fix the problem. My patch fixes the issue but you still can't remove or add this option by using "Manage" -> "Manage Configuration" page. To get a cleaner solution in future I think there has to be a discussion first.
|
|
Reminder sent to: dhx, giallu, grangeway This isn't really a "correct" fix, IMO. The problem is that the config option's name conflicts with the default values in $g_global_settings, specifically the "_path$" regex. Either we need to have the graph plugin use a different naming scheme, or we need to be more explicit in defining global settings. Personally, I think using a regex to define global settings is like driving a screw with a hammer... |
|
One more question:
I think no, because atm you are not able to remove an option which was allowed to be set in version 1.1.x and is not longer allowed in 1.2.x As there seems no one to find the time to have a deeper look, maybe answering my questions 1. and 4. can help to step forward without the need that everyone has to check my dirty patch and the current implementation in detail. |
|
For now, IMO the simplest fix is to rename the plugin configuration ( translations included ) . It's a 2-minute fix , I've already done it locally, and it works. As this is a pretty big usability problem, my vote is doing this now and worrying about enhancing the config api later. |
|
Added another patch for master-1.2.x. |
|
This is basically the fix I was looking for, but never had the time to deal with. This gets the thumbs up from me. |
|
Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch |
|
MantisBT: master-1.2.x 22f830c8 2012-02-26 02:49 Details Diff |
Fix 0012006: Mantis Graphs - Configuration - jpgraph library path not saved |
Affected Issues 0012006 |
|
mod - config_defaults_inc.php | Diff File | ||
mod - core/config_api.php | Diff File | ||
MantisBT: master 2e1bb5bd 2012-02-26 07:53 Details Diff |
Fix 0012006: Mantis Graphs - Configuration - jpgraph library path not saved |
Affected Issues 0012006 |
|
mod - config_defaults_inc.php | Diff File | ||
mod - core/config_api.php | Diff File |