From b8619ad1ad90c9aef3dccf89a28848eca2278f09 Mon Sep 17 00:00:00 2001 From: Sebastian Mendel Date: Mon, 5 Dec 2005 15:50:25 +0000 Subject: [PATCH] correctly reset config variables on changes in config.inc.php --- ChangeLog | 4 +++- libraries/Config.class.php | 29 ++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cd3ddf27e..88a209de6 100755 --- a/ChangeLog +++ b/ChangeLog @@ -7,7 +7,9 @@ $Source$ 2005-12-05 Sebastian Mendel * libraries/common.lib.php: added PMA_array_merge_recursive() - * libraries/Config.class.php: make use of PMA_array_merge_recursive() + * libraries/Config.class.php: + - make use of PMA_array_merge_recursive() + - correctly reset config variables on changes in config.inc.php * sql.php: hide edit/delete links for information_schema (bug #1373201) 2005-12-05 Michal Čihař diff --git a/libraries/Config.class.php b/libraries/Config.class.php index a22b67dfa..044c7bd5c 100644 --- a/libraries/Config.class.php +++ b/libraries/Config.class.php @@ -62,7 +62,14 @@ class PMA_Config { // PMA_Config::load() $this->load( $source ); - // other settings, independant from config file, comes here + // other settings, independant from config file, comes in + $this->checkSystem(); + } + + /** + * sets system and application settings + */ + function checkSystem() { $this->set( 'PMA_VERSION', '2.7.1-dev' ); /** * @deprecated @@ -83,6 +90,9 @@ class PMA_Config { $this->checkOutputCompression(); } + /** + * wether to use gzip output compression or not + */ function checkOutputCompression() { // If zlib output compression is set in the php configuration file, no // output buffering should be run @@ -226,6 +236,9 @@ class PMA_Config { } } + /** + * detects PHP version + */ function checkPhpVersion() { $match = array(); if ( ! preg_match( '@([0-9]{1,2}).([0-9]{1,2}).([0-9]{1,2})@', @@ -248,10 +261,15 @@ class PMA_Config { $this->set( 'PMA_PHP_STR_VERSION', phpversion() ); } + /** + * re-init object after loadiong from session file + * checks config file for changes and relaods if neccessary + */ function __wakeup() { if ( $this->source_mtime !== filemtime( $this->getSource() ) || $this->error_config_file || $this->error_config_default_file ) { $this->load( $this->getSource() ); + $this->checkSystem(); } $this->checkCollationConnection(); @@ -296,6 +314,8 @@ class PMA_Config { return false; } + $cfg = array(); + /** * Parses the configuration file */ @@ -364,6 +384,13 @@ class PMA_Config { return NULL; } + /** + * sets configuration variable + * + * @uses $this->settings + * @param string $setting configuration option + * @param string $value new value for configuration option + */ function set( $setting, $value ) { $this->settings[$setting] = $value; }