Reputation: 331
I'm working on an app using CakePHP, and I have some generic settings that admins can change that affect the whole site, but I'm not quite sure how to handle saving/editing the data. These settings are for site-control related things, such as enabling/disabling new user registrations, enabling/disabling creating of new posts/topics, etc...
Since these aren't specific to individual users and there is only 1 set of values for the entire site, is it more advantageous to just use an XML file or should I create a table (which would only have 1 row)?
If I go with the XML route, are there any security related issues I should be aware of?
I saw this post but the accepted answer was on a per-user basis. This is only 1 set for the entire site.
Upvotes: 0
Views: 149
Reputation: 805
I think it should be added in database which make easier to make changes by administrators . It should be then cached and used for faster execution of settings. You can store cache in place you like and that is all you have to do.
Use http://book.cakephp.org/2.0/en/core-libraries/caching.html
Upvotes: 0
Reputation: 163262
This sort of configuration is general best left inside a config file on disk.
Also, I wouldn't use XML. I would use JSON. It's much easier to deal with, and you get proper data types out of the box for normal things.
There are no special security issues to storing config on disk. Just keep it out of the web server's document root, like everything else that isn't intended to be loaded directly by the user. Your config and application code should be only writable by users with that privilege.
Upvotes: 1