fuel / core

Fuel PHP Framework - The core of the Fuel v1 framework
http://fuelphp.com
813 stars 345 forks source link

\Config::save + modules #85

Closed axelitus closed 13 years ago

axelitus commented 13 years ago

In relation to the fuel/core issue #84 already fixed in the develop branch, the save method of the \Config class has the same problem:

In the documentation it says: "The save method saves a config file into the system. It searches through the config directories for the requested file. If no existing file is found, the config file is created in the APPPATH config directory." and the function works as described, but having modules should change this a little bit.

Let's say I have a global config file named 'ldap.php' which has the configuration details for an LDAP connection. I then add a module 'mod1' and (humor me) I create at runtime a special configuration for an LDAP connection to be used only in that module which differs from the previous one described in the global config folder. Currently, in 'mod1' there's no 'ldap.php' file in the module's config folder, as I want to create it at runtime.

So Let's see some code of what I'm doing here:

\Config::set('mod1cfg.ldap.server', 'testserver.fuelphp.com');
\Config::set('mod1cfg.ldap.user', 'myldapuser');
\Config::set('mod1cfg.ldap.pwd', 'myldappwd');

If were to save this configuration for future use I would do so like this:

\Config::save('mod1\\ldap', 'mod1cfg');

What will happen is that the save process will see if there's an 'ldap.php' file inside the module's mod1 config folder but there won't be so it sets the save path automatically to the 'APPPATH config directory' which will effectively overwrite the configuration I don't want to overwrite.

I think the way it should work is:

WanWizard commented 13 years ago

Duplicate of #97.