In relation to the fuel/core issue #84already 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.
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:
if the module exists, but there's no config file in it's own config folder, then create it inside the module's config folder.
if the module exists and the file exists in it's config folder, overwrite it.
if the module doesn't exist, return false as it is an error. (why namespacing the config file if we don't have a module?)
if there's no namespace then set the path to the APPPATH config directory
if namespaced: don't mess around with the global apppath config files.
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:
If were to save this configuration for future use I would do so like this:
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: