Extracted from #1626584: Combine configuration system changes to verify they are compatible

Problem

  • Various code needs to check whether the config object returned by config('foo.bar') already exists or not, but has no way to do so.

Goal

  • Allow code to check $config->isNew() to determine storage status.

Proposed solution

  1. Add public Config::isNew() method.
  2. Change configuration storage controllers to make a difference between non-existing and existing storage items/records/entries.

Notes

Files: 
CommentFileSizeAuthor
#3 config.isnew_.3.patch11.15 KBsun
PASSED: [[SimpleTest]]: [MySQL] 37,015 pass(es). View
#3 interdiff.txt908 bytessun
#2 1666632_2.patch10.45 KBchx
PASSED: [[SimpleTest]]: [MySQL] 37,016 pass(es). View
#2 interdiff.txt669 byteschx
#1 config.isnew_.1.patch10.28 KBsun
PASSED: [[SimpleTest]]: [MySQL] 36,977 pass(es). View
#1 interdiff.txt597 bytessun
config.isnew_.0.patch10.09 KBsun
FAILED: [[SimpleTest]]: [MySQL] Failed to run tests: PHP Fatal error encountered during run_tests.sh. See review log for details.. View

Comments

sun’s picture

FileSize
597 bytes
10.28 KB
PASSED: [[SimpleTest]]: [MySQL] 36,977 pass(es). View

bd79424 Fixed fatal error in image_style_load().

chx’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
669 bytes
10.45 KB
PASSED: [[SimpleTest]]: [MySQL] 37,016 pass(es). View

I like this but I have made Config::load() just a little bit more explicit to make it more readable. (Previous patch was testing for $data === FALSE twice)

sun’s picture

FileSize
908 bytes
11.15 KB
PASSED: [[SimpleTest]]: [MySQL] 37,015 pass(es). View

Just ran across another @todo that should be killed by this patch.

3d05a48 Leverage isNew() in image_style_save(), too.

Leaving RTBC, since that change is trivial.

chx’s picture

Oh great!

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Makes sense to me.

Committed and pushed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.