Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config.inc.php : include local file and document variables #30

Closed
nqb opened this issue Feb 22, 2018 · 7 comments
Closed

Config.inc.php : include local file and document variables #30

nqb opened this issue Feb 22, 2018 · 7 comments

Comments

@nqb
Copy link
Contributor

nqb commented Feb 22, 2018

Hello,

I would like to suggest two improvements on config file :

adding following code at end of file to include a local config file (that overrides config.inc.php) :

# Include local config file
if (file_exists (dirname (__FILE__) . '/config.inc.local.php')) {
   include dirname (__FILE__) . '/config.inc.local.php';
}

There is more than one way to do it. This improvement will be very useful to :

  1. keep an up-to-date config.inc.php when doing WP upgrades.
  2. customize simply WP installation

syncing documentation between LTB's wiki and config.inc.php

Will be nice to have same documentation between LTB's wiki and config.inc.php. Currently, LTB's wiki documentation is the most complete.

@coudot
Copy link
Member

coudot commented Feb 22, 2018

adding following code at end of file to include a local config file

I don't know what are he best practices for that. It seems weird to have 2 config files. Maybe we should have in code all default values, and config file will just be used for modified values?

syncing documentation between LTB's wiki and config.inc.php

Not really agree too. PHP file is not a documentation file.

We can imagine to create a simple HTML export of the wiki if needed.

@coudot coudot added this to the 0.2 milestone Feb 22, 2018
@nqb
Copy link
Contributor Author

nqb commented Feb 27, 2018

I don't know what are he best practices for that. It seems weird to have 2 config files.

To my mind, it's a best practice. Many softwares use this tip : BIND9, Dokuwiki etc. Code given in my first comment comes from php-memcached-dev.

As maintainer, you have one config file to maintain. Local file is for users.

Currently, with one config file, upgrading WP is really painful :

  1. backup your config file
  2. upgrade WP
  3. restore your config file
  4. make diff between upstream config file and your config file to add new variables
  5. use WP

With two config files, you can skip steps 1, 3 et 4.

Maybe we should have in code all default values, and config file will just be used for modified values?

Not agree, users doesn't need to know PHP language to read config. Besides, you need rewrite code because you use require_once("../conf/config.inc.php"); in several files. With my solution, no patch needed.

We can imagine to create a simple HTML export of the wiki if needed.

As you want.

@nqb
Copy link
Contributor Author

nqb commented Feb 27, 2018

@coudot : if I convince you, we also need to add a note on top of config.inc.php like this :

/**
 * All the default values are kept here, you should not modify it but use
 * config.inc.local.php file instead to override the settings from here.
*/

Extract from Dokuwiki's code.

@nqb
Copy link
Contributor Author

nqb commented Feb 27, 2018

Upon reflection on syncing documentation between LTB's wiki and config.inc.php, we need to have at least one sentence for variable in config.inc.php. There is many variables, having a quick help is really useful.

@coudot
Copy link
Member

coudot commented Feb 28, 2018

I also this kind of request for Self Service Password: ltb-project/self-service-password#72

Your solution seems nice (using config.inc.local.php). This will require some changes in packaging as config.inc.php is flagged as a config file, and so is not replaced in package updates. We now need to let it as a standard program file, so it will be replaced. Users will only set configuration settings in the local file.

Regarding documentation, we can indeed put a quick help line in config.inc.php.

@coudot coudot closed this as completed in 4d54190 Mar 1, 2018
@nqb
Copy link
Contributor Author

nqb commented Mar 1, 2018

@coudot : what about Debian/RPM packaging ?

@coudot
Copy link
Member

coudot commented Mar 1, 2018

As discussed, we will not put config.inc.local.php in packages, users can create this file if they want to keep the original config.inc.php, or choose to edit config.inc.php directly and merge changes when packages are updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants