Welcome Guest, Not a member yet? Register   Sign In
What the logic behind config files being classes?

(06-08-2016, 02:59 AM)InsiteFX Wrote: What I meant about writing to the config files was being able to create and keep our own configs on the fly, say from an Admin Dashboard.

I see the new class CI configs and current as the core and "unchangeable" but...

For any that need to change I currently have a GUI/database layer.

The columns are:
group (old config filename)
name (old config array key)
value (text - convert to "real" value and JSON string for arrays)

When I load the first page it first loads the core configs (both base and then ENV) then.
merges OVER that the database layer and stores it internally as an array for easy access.

To speed up that entire process I cache the entire array.

I then have a simple function $default_id = setting('auth.default id');

That then returns $configs['auth']['default id'] from the array.

Anytime the GUI is updated the cached file is deleted and of course regenerated automatic.

I think the cache is key because it speed up the merging and database calls etc.. into a single cache call


Theme © iAndrew 2016 - Forum software by © MyBB