[Phpmyadmin-devel] Config import proposal

Michal Čihař michal at cihar.com
Thu Sep 8 04:13:09 CEST 2005

Hi all

current state when default values are written at two places 
(config.inc.php and libraries/config_import.lib.php) makes easy to make 
one of them different. And then we copy config file to 
config.default.php when releasing tarballs. So on each release 
configuration in placed on three places, in CVS "just" on two.

This could be IMO handled better way. I can currently see two 
possibilities, one quite easy to implement:

1. Manage just config.default.php in CVS.
2. User has to create config.inc.php.
3. Include config.inc.php.
4. Call fix up function, that will add missing values to configration 
based on config.default.php.

Function could look something like this (just to show how it could look 
like, I even haven't tested whether this code actually works):

function fixup_array(&$src, &$dst) {
	foreach($src as $key => $val) {
		if (!isset($dst($key)){
			$dst[$key] = $val;
		} elseif (is_array($val)) {
			fixup_array($src[$key], $dst[$key]);

function fixup() {
	include './config.default.php';
	fixup_array($cfg, $GLOBALS['cfg']);

Second possible solution would be do to this fixup only when that 
configuration options is actually needed. This would mean no direct 
reading of $cfg, but using some function instead, that will deal with 
default values. This definitely needs more modification to all code.


    Michal Čihař | http://cihar.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20050908/a4136ed1/attachment.sig>

More information about the Developers mailing list