easier upgrade for config.php

Issue #56 resolved
Robert Chavers created an issue

Could you implement a config-custom.php file?

My thinking is this would allow us users to keep our custom config.php changes in this one file. This way we can download the newest source and simply copy your newest version of config.php from source and not have to change all those lines back again.

I suppose I could make a list of my changes and simply append them to the bottom of config.php, but a config-custom.php might be slightly easier.

Comments (4)

  1. Janos SUTO repo owner

    Hmm, it makes sense, so we can create a site-config.php or so then put all local stuff in that file. Unfortunately defined constants cannot be redefined so it will generate 20-30 notice error messages either onscreen or to the error file.

    One possible workaround is to you something similar at the beginning of config.php, so it will suppress these notices.

    require_once 'site-config.php'; ini_set("error_reporting", E_ALL & ~E_NOTICE);

    Another and probably more correct solution can be to put the following prefix to every line in config.php:

    if(!defined('ABCDE')) define('ABCDE', ...);

    But I have to check the performance loss of either of these workarounds. What do you think?

  2. Janos SUTO repo owner

    Yet another solution could be an upgrade script that saves your current config.php, then appends new variables from the source tree to your running config.php

  3. Janos SUTO repo owner

    OK, it's ready. From now on, config.php contains an array with the same variable names with the default values, just as before.

    The custom config is config-site.php. You can put any config.php variables from the NEW config.php file, and you can replace its value. Then whenever an upgrade has to be done, just overwrite config.php, and you are up to date, and your local settings are saved.

  4. Log in to comment