[Phpmyadmin-devel] Config import proposal

Marc Delisle Marc.Delisle at cegepsherbrooke.qc.ca
Thu Sep 8 05:58:13 CEST 2005


Hi Michal and all,

indeed I would love to get rid of the $cfg['FileRevision'] mechanism.

I agree with your first idea. We could even do this: at run time, if 
config.inc.php is not there, try to create it from config.default.php 
and inform the user if it works or if it fails (could fail because of 
safe mode restrictions or just permission problems).

This way, we keep the current behavior that a default PMA installation 
works immediately without doing anything, permitting to connect to a 
default MySQL installation with root and no password (yeah!).

Note that at some places in the code we set some parts of $cfg 
dynamically based on the MySQL version, but this should not be a problem.

Let's not forget also config.inc.developer.php :)

See also
https://sourceforge.net/tracker/index.php?func=detail&aid=1253493&group_id=23067&atid=377410

Marc

Michal Čihař a écrit :
> 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.
> 
> Comments?
> 





More information about the Developers mailing list