Merge pull request #1774 from devenbansod/disable_edit_for_readonly_var

Edit link should be active only for non read-only system variables
This commit is contained in:
Isaac Bennetch 2015-07-11 10:51:23 -04:00
commit 447a66be95
3 changed files with 397 additions and 2 deletions

View File

@ -218,6 +218,9 @@ function PMA_getHtmlForServerVariablesItems($variable_doc_links)
= $GLOBALS['dbi']->fetchResult('SHOW SESSION VARIABLES;', 0, 1);
$serverVars = $GLOBALS['dbi']->fetchResult('SHOW GLOBAL VARIABLES;', 0, 1);
// list of Dynamic System variables
$dynamic_variables = PMA_getDynamicSystemVariables();
$output = '<tbody>';
$odd_row = true;
foreach ($serverVars as $name => $value) {
@ -229,8 +232,22 @@ function PMA_getHtmlForServerVariablesItems($variable_doc_links)
$output .= '<tr class="var-row' . $row_class . '">';
$output .= '<td class="var-action">';
$output .= '<a href="#" class="editLink">'
. PMA_Util::getIcon('b_edit.png', __('Edit')) . '</a>';
// Edit Link active only for Dynamic System variables
if (in_array(strtolower($name), $dynamic_variables)) {
$output .= '<a href="#" class="editLink">'
. PMA_Util::getIcon('b_edit.png', __('Edit')) . '</a>';
} else {
$output .= '<span title="'
. __('This is a read-only variable and can not be edited')
. '" class="read_only_var" >'
. PMA_Util::getImage(
's_error2.png',
''
)
. '</span>';
}
$output .= '</td>';
$output .= '<td class="var-name">';
@ -2226,4 +2243,374 @@ function PMA_getArrayForDocumentLinks()
return $variable_doc_links;
}
/**
* Returns Array of dynamic system variables (i.e. not read-only)
*
* @return array
*/
function PMA_getDynamicSystemVariables()
{
$dynamic_variables = array(
'auto_increment_increment',
'auto_increment_offset',
'autocommit',
'automatic_sp_privileges',
'avoid_temporal_upgrade',
'big_tables',
'binlog_cache_size',
'binlog_checksum',
'binlog_direct_non_transactional_updates',
'binlog_error_action',
'binlog_format',
'binlog_group_commit_sync_delay',
'binlog_group_commit_sync_no_delay_count',
'binlog_max_flush_queue_time',
'binlog_order_commits',
'binlog_row_image=image_type',
'binlog_rows_query_log_events',
'binlog_stmt_cache_size',
'binlogging_impossible_mode',
'block_encryption_mode',
'bulk_insert_buffer_size',
'character_set_client',
'character_set_connection',
'character_set_database',
'character_set_filesystem',
'character_set_results',
'character_set_server',
'check_proxy_users',
'collation_connection',
'collation_database',
'collation_server',
'completion_type',
'concurrent_insert',
'connect_timeout',
'debug',
'debug_sync',
'default_password_lifetime',
'default_storage_engine',
'default_tmp_storage_engine',
'default_week_format',
'delay_key_write',
'delayed_insert_limit',
'delayed_insert_timeout',
'delayed_queue_size',
'div_precision_increment',
'end_markers_in_json',
'enforce_gtid_consistency',
'enforce_gtid_consistency',
'eq_range_index_dive_limit',
'event_scheduler',
'executed_gtids_compression_period',
'expire_logs_days',
'flush',
'flush_time',
'foreign_key_checks',
'ft_boolean_syntax',
'general_log',
'general_log_file',
'group_concat_max_len',
'gtid_executed_compression_period',
'gtid_mode',
'gtid_mode',
'gtid_next',
'gtid_purged',
'host_cache_size',
'identity',
'init_connect',
'init_slave',
'innodb_adaptive_flushing',
'innodb_adaptive_flushing_lwm',
'innodb_adaptive_hash_index',
'innodb_adaptive_max_sleep_delay',
'innodb_api_bk_commit_interval',
'innodb_api_trx_level',
'innodb_autoextend_increment',
'innodb_buffer_pool_dump_at_shutdown',
'innodb_buffer_pool_dump_now',
'innodb_buffer_pool_dump_pct',
'innodb_buffer_pool_filename',
'innodb_buffer_pool_load_abort',
'innodb_buffer_pool_load_now',
'innodb_buffer_pool_size',
'innodb_change_buffer_max_size',
'innodb_change_buffering',
'innodb_checksum_algorithm',
'innodb_cmp_per_index_enabled',
'innodb_commit_concurrency',
'innodb_compression_failure_threshold_pct',
'innodb_compression_level',
'innodb_compression_pad_pct_max',
'innodb_concurrency_tickets',
'innodb_create_intrinsic',
'innodb_disable_sort_file_cache',
'innodb_fast_shutdown',
'innodb_file_format',
'innodb_file_format_max',
'innodb_file_per_table',
'innodb_fill_factor',
'innodb_flush_log_at_timeout',
'innodb_flush_log_at_trx_commit',
'innodb_flush_neighbors',
'innodb_flush_sync',
'innodb_flushing_avg_loops',
'innodb_ft_aux_table',
'innodb_ft_enable_diag_print',
'innodb_ft_enable_stopword',
'innodb_ft_num_word_optimize',
'innodb_ft_result_cache_limit',
'innodb_ft_server_stopword_table',
'innodb_ft_user_stopword_table',
'innodb_io_capacity',
'innodb_io_capacity_max',
'innodb_large_prefix',
'innodb_lock_wait_timeout',
'innodb_log_checksum_algorithm',
'innodb_log_compressed_pages',
'innodb_log_write_ahead_size',
'innodb_lru_scan_depth',
'innodb_max_dirty_pages_pct',
'innodb_max_dirty_pages_pct_lwm',
'innodb_max_purge_lag',
'innodb_max_purge_lag_delay',
'innodb_max_undo_log_size',
'innodb_monitor_disable',
'innodb_monitor_enable',
'innodb_monitor_reset',
'innodb_monitor_reset_all',
'innodb_old_blocks_pct',
'innodb_old_blocks_time',
'innodb_online_alter_log_max_size',
'innodb_optimize_fulltext_only',
'innodb_optimize_point_storage',
'innodb_print_all_deadlocks',
'innodb_purge_batch_size',
'innodb_purge_rseg_truncate_frequency',
'innodb_random_read_ahead',
'innodb_read_ahead_threshold',
'innodb_replication_delay',
'innodb_rollback_segments',
'innodb_spin_wait_delay',
'innodb_stats_auto_recalc',
'innodb_stats_method',
'innodb_stats_on_metadata',
'innodb_stats_persistent',
'innodb_stats_persistent_sample_pages',
'innodb_stats_sample_pages',
'innodb_stats_transient_sample_pages',
'innodb_status_output',
'innodb_status_output_locks',
'innodb_strict_mode',
'innodb_support_xa',
'innodb_sync_spin_loops',
'innodb_table_locks',
'innodb_thread_concurrency',
'innodb_thread_sleep_delay',
'innodb_undo_log_truncate',
'innodb_undo_logs',
'insert_id',
'interactive_timeout',
'internal_tmp_disk_storage_engine',
'join_buffer_size',
'keep_files_on_create',
'key_buffer_size',
'key_cache_age_threshold',
'key_cache_block_size',
'key_cache_division_limit',
'last_insert_id',
'lc_messages',
'lc_time_names',
'local_infile',
'lock_wait_timeout',
'log_backward_compatible_user_definitions',
'log_bin_trust_function_creators',
'log_error_verbosity',
'log_output',
'log_queries_not_using_indexes',
'log_slow_admin_statements',
'log_slow_slave_statements',
'log_syslog',
'log_syslog_facility',
'log_syslog_include_pid',
'log_syslog_tag',
'log_throttle_queries_not_using_indexes',
'log_timestamps',
'log_warnings',
'long_query_time',
'low_priority_updates',
'master_info_repository',
'master_verify_checksum',
'max_allowed_packet',
'max_binlog_cache_size',
'max_binlog_size',
'max_binlog_stmt_cache_size',
'max_connect_errors',
'max_connections',
'max_delayed_threads',
'max_error_count',
'max_heap_table_size',
'max_insert_delayed_threads',
'max_join_size',
'max_length_for_sort_data',
'max_points_in_geometry',
'max_prepared_stmt_count',
'max_relay_log_size',
'max_seeks_for_key',
'max_sort_length',
'max_sp_recursion_depth',
'max_statement_time',
'max_user_connections',
'max_write_lock_count',
'min_examined_row_limit',
'myisam_data_pointer_size',
'myisam_max_sort_file_size',
'myisam_repair_threads',
'myisam_sort_buffer_size',
'myisam_stats_method',
'myisam_use_mmap',
'mysql_native_password_proxy_users',
'ndb_blob_write_batch_bytes',
'ndb_deferred_constraints',
'ndb_deferred_constraints',
'ndb_distribution={KEYHASH|LINHASH}',
'ndb_distribution',
'ndb_eventbuffer_free_percent',
'ndb_eventbuffer_max_alloc',
'ndb_force_send',
'ndb_index_stat_enable',
'ndb_index_stat_option',
'ndb_join_pushdown',
'ndb_log_binlog_index',
'ndb_log_empty_epochs',
'ndb_log_updated_only',
'ndb_optimization_delay',
'ndb_recv_thread_cpu_mask',
'ndb_show_foreign_key_mock_tables',
'ndb_table_no_logging',
'ndb_use_transactions',
'ndbinfo_max_rows',
'ndbinfo_show_hidden',
'net_buffer_length',
'net_read_timeout',
'net_retry_count',
'net_write_timeout',
'new',
'offline_mode',
'old_alter_table',
'old_passwords',
'optimizer_prune_level',
'optimizer_search_depth',
'optimizer_switch',
'optimizer_trace',
'optimizer_trace_features',
'optimizer_trace_limit',
'optimizer_trace_max_mem_size',
'optimizer_trace_offset',
'preload_buffer_size',
'profiling',
'profiling_history_size',
'pseudo_slave_mode',
'pseudo_thread_id',
'query_alloc_block_size',
'query_cache_limit',
'query_cache_min_res_unit',
'query_cache_size',
'query_cache_type',
'query_cache_wlock_invalidate',
'query_prealloc_size',
'rand_seed1',
'rand_seed2',
'range_alloc_block_size',
'rbr_exec_mode',
'read_buffer_size',
'read_only',
'read_rnd_buffer_size',
'relay_log_info_repository',
'relay_log_purge',
'rewriter_enabled',
'rewriter_verbose',
'rpl_semi_sync_master_enabled',
'rpl_semi_sync_master_timeout',
'rpl_semi_sync_master_trace_level',
'rpl_semi_sync_master_wait_for_slave_count',
'rpl_semi_sync_master_wait_no_slave',
'rpl_semi_sync_master_wait_point',
'rpl_semi_sync_slave_enabled',
'rpl_semi_sync_slave_trace_level',
'rpl_stop_slave_timeout',
'secure_auth',
'server_id',
'session_track_gtids',
'session_track_schema',
'session_track_state_change',
'session_track_system_variables',
'sha256_password_proxy_users',
'show_compatibility_56',
'show_old_temporals',
'slave_allow_batching',
'slave_checkpoint_group=#',
'slave_checkpoint_period=#',
'slave_compressed_protocol',
'slave_exec_mode',
'slave_max_allowed_packet',
'slave_net_timeout',
'slave_parallel_type',
'slave_parallel_workers',
'slave_pending_jobs_size_max',
'slave_preserve_commit_order',
'slave_rows_search_algorithms=list',
'slave_sql_verify_checksum',
'slave_transaction_retries',
'slow_launch_time',
'slow_query_log',
'slow_query_log_file',
'sort_buffer_size',
'sql_auto_is_null',
'sql_big_selects',
'sql_buffer_result',
'sql_log_bin',
'sql_log_off',
'sql_mode',
'sql_notes',
'sql_quote_show_create',
'sql_safe_updates',
'sql_select_limit',
'sql_slave_skip_counter',
'sql_warnings',
'storage_engine',
'stored_program_cache',
'super_read_only',
'sync_binlog',
'sync_frm',
'sync_master_info',
'sync_relay_log',
'sync_relay_log_info',
'table_definition_cache',
'table_open_cache',
'thread_cache_size',
'time_zone',
'timed_mutexes',
'timestamp',
'tmp_table_size',
'transaction_alloc_block_size',
'transaction_allow_batching',
'transaction_prealloc_size',
'transaction_write_set_extraction',
'tx_isolation',
'tx_read_only',
'unique_checks',
'updatable_views_with_limit',
'validate_password_dictionary_file',
'validate_password_length',
'validate_password_mixed_case_count',
'validate_password_number_count',
'validate_password_policy',
'validate_password_special_char_count',
'wait_timeout'
);
return $dynamic_variables;
}
?>

View File

@ -247,6 +247,10 @@ fieldset .formelement {
white-space: nowrap;
}
.read_only_var {
padding: 20%;
}
/* revert for Gecko */
fieldset div[class=formelement] {
white-space: normal;

View File

@ -530,6 +530,10 @@ fieldset .formelement {
white-space: nowrap;
}
.read_only_var {
padding: 20%;
}
/* revert for Gecko */
fieldset div[class=formelement] {
white-space: normal;