Can a package override site.php?

Permalink
I'm looking at packages as a way to configure a site in one go, add pages, blocks and set permissions etc.

Install C5, drop a package in and install that - job done. A template in effect.

So is it possible to set configuration constants in a package that augment site.php. One example would be to disable Marketplace, for non techy endusers.

Thanks

Ollie

olliephillips
 
12345j replied on at Permalink Reply
12345j
I don't think it could, but i'm not sure. It has to be able to access it, but i don't know if it can change it or not, and I don't think so.
hereNT replied on at Permalink Reply
hereNT
The Domain Mapper package has this functionality, so it is possible. Not sure if it's cool for me to post the code from that package's install function or not...

Basically it's checking for a constant to be defined, and if it is defined (or not defined, which then returns true), then it's using fopen/fwrite/fclose to define it as false in site.php...
olliephillips replied on at Permalink Reply
olliephillips
Thanks for this - I had considered fopen - it will do exactly what I need, but thought there might be a less hacky approach.

However, if other packages do it this way and it's acceptable in the marketplace then it's good enough for me.

Thanks for the information!
olliephillips replied on at Permalink Reply
olliephillips
Still wasn't happy with the Fopen approach to be honest (seemed much too hacky for an app as well designed as C5), so have been routing through the application flow tonight.

Glad I did.

It looks like any package or even block, should be able to add their own (or update existing) config info using the config table.

The process goes via site.php, then to the database (config table), then app.php for defaults. Hope I'm right on this.

Hats off again to the C5 guys.

Ollie
Mnkras replied on at Permalink Best Answer Reply
Mnkras
you can use Config::Save, the order of priority lowest to highest,
Base.php/app.php->site.php->DB
focus43 replied on at Permalink Reply
focus43
Just making sure I'm understanding this... so you guys are saying that, from a package, it IS possible to add configuration stuff to site.php?

As in I could turn on Advanced Permissions automatically?

If so, do you guys mind posting the code on how you did this.

Thanks