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
Extract INI file merging logic in Config class and move to new IniFileChain class. #7312
Conversation
@piwik/core-team This change is ready for review; don't merge for any 2.11 release, only 2.12 or later. |
Adding 2.12.0 milestone (feel free to add milestone to Pull Requests when they must be merged in particular versions) |
👍 |
…eChain class. This is an intermediate step in allowing Config/Plugin\Manager to exist in DI.
… inherit and get tests to pass.
a052b38
to
203b885
Compare
…catch the exception and augment message w/ file being read in IniFileChain. Also includes some mild refactoring to IniFileChain.
$header . "[General]\ndebug = 1\n\n[Tracker]\nanonymize = 2\n\n", | ||
)), | ||
|
||
array('sort, common sections before new section', array( | ||
/*TODO: is this test needed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this test is needed, is there an issue with it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It tests that the order of the sections is first sections that have data in common w/ global + config, and then data that is only in config.ini.php. I don't think I can easily replicate this behavior, and I'm not sure if it's important. Is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's important that sections are stored in config.ini.php in the same order as they are in global.ini.php
this is because when we write the dump to file it should put [database] at top, then general, tracker, debug, and after only the plugins etc. we could also hardcode the order of sections if that's easier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in most recent commit.
Looks good to me. I propose that we merge this for 2.13.0, to give us more time to test this. if you are confident about it and tests, we could merge it sooner |
Conflicts: core/Config.php
…onfig, the config file is erased. Also sort config sections w/ case insensitive search.
Merging in 2.13 is ok w/ me, it would be nice if it could be done as soon as the last minor 2.12 is out. Once this is merged, I will do two more refactorings to get Config + Plugin\Manager stored in DI, then I can make test related code a lot simpler. |
@mattab Forgot about a bug I found in core while doing this pull request. In
will result in
Is this the correct behavior? If not, can we fix it if it means users' common.config.ini.php might behave differently? I'm guessing not, let me know. |
It is the correct behavior. In the global.ini.php there are loads of plugins in |
…ngs file chain the expected behavior.
…ar in file chain.
It seems there is this test that fail and then we can merge: https://travis-ci.org/piwik/piwik/jobs/54478316#L610 Maybe that's expected
|
…othingIfThereAreNoChanges so it doesn't trigger failure in ReleaseCheckListTest.
…roperty has no effect'.
…ings file is completely empty and add test case. Also add type hint to IniFileChain::__construct.
UI test failures should be fixed in #7583. |
Extract INI file merging logic in Config class and move to new IniFileChain class for future re-use.
…ct order. Bug occurs due to incorrect sorting that sorts sections according to which files they appear in, but not where they appear in individual files.
This is an intermediate step in allowing Config/Plugin\Manager to exist in DI. Will allow reading conifg w/o needing to instantiate Config instance (so we can read Plugins to load list before creating Config instance).
Remaining TODO: