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

API Substitute silverstripe/config module for core config #6641

Merged
merged 11 commits into from
Feb 28, 2017

Conversation

tractorcow
Copy link
Contributor

@tractorcow tractorcow commented Feb 22, 2017

Implements #6477

Config module work available for review at silverstripe/silverstripe-config#4

Note that this change includes a few other api enhancements and changes designed to support the updated API. This includes a new module registration system (allowing modules to be referenced by full composer name), and changes to Director.

Non-trivial documentation updates will follow.

other PR:

/**
* Factory for silverstripe configs
*/
class CoreConfigCreator
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between a "factory" and a "creator"? We seem to use both terms in core

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Synonyms.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Preference is to say "Factory"

$instance = new CachedConfigCollection();

// Set root cache
$instance->setPool(new FilesystemAdapter('configcache', 0, getTempFolder()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a plan for how to make this more pluggable? I guess it'll be easier once we create an App object as part of main.php bootstrap, where you could manually set services before relying on DI?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem with that is the config is already built before it gets to the users code. You'd need to restructure how SS is bootstrapped.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a little explanation and discussion here: #6252 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do setup .env prior to this stage, so it's possible we could use non-yml/statics to configure this. maybe use getenv?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that different backends have different constructors. eg. filesystem has none, redis has url, username, password etc.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend that we park config-cache-pluggability until after we have an app object.

* @param string $class
* @param mixed $options
* @param callable $next
* @return string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return string|array|boolean|numeric I assume?

Copy link
Member

@sminnee sminnee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noted a few minor points but I'm happy with this.

@sminnee
Copy link
Member

sminnee commented Feb 26, 2017

@chillu Once silverstripe/silverstripe-config#4 is merged, can you nudge the tests on this and assuming they pass merge it on Monday?

@tractorcow
Copy link
Contributor Author

@sminnee I'll do a rebase and do the factory class rename at the same time.

@tractorcow tractorcow force-pushed the pulls/4.0/micmania-config branch from 0e5219d to 0b3b868 Compare February 26, 2017 03:52
@tractorcow
Copy link
Contributor Author

Rebased and renamed that class.

@tractorcow
Copy link
Contributor Author

Oops, rebase didn't remove Zend_Cache from new ModuleManifest. Fixed now. :D

@tractorcow
Copy link
Contributor Author

tractorcow commented Feb 26, 2017

Need a merge on silverstripe/silverstripe-config#4 then we can restart this build. (after adding to packagist of course).

@tractorcow
Copy link
Contributor Author

Restarting with fix applied to testsession module

@tractorcow tractorcow force-pushed the pulls/4.0/micmania-config branch from a810461 to 40aed4e Compare February 27, 2017 03:55
@tractorcow
Copy link
Contributor Author

Attempting to run with an experimental version of behat-extension to debug out of memory issues.

@tractorcow
Copy link
Contributor Author

Please note that I've added a few "experimental" commits that should NOT be merged into the final PR. I'll remove these once I get tests green.

@tractorcow
Copy link
Contributor Author

Added a new fix for silverstripe/silverstripe-config#5

@tractorcow
Copy link
Contributor Author

I've added two new bugfix PRs (see first comment) and pushed another change to this PR that should address certain issues.

@sminnee
Copy link
Member

sminnee commented Feb 27, 2017

I've merged config#5 and re-triggered one of the builds on this PR to confirm that it doesn't break anything: https://travis-ci.org/silverstripe/silverstripe-framework/jobs/205966670#L210

@sminnee
Copy link
Member

sminnee commented Feb 27, 2017

Please note that I've added a few "experimental" commits that should NOT be merged into the final PR. I'll remove these once I get tests green.

@tractorcow can you confirm that these have now been removed and you're in principle happy to see this merged?

@sminnee sminnee merged commit 5388ff4 into silverstripe:master Feb 28, 2017
@tractorcow
Copy link
Contributor Author

Yes those are removed. :)

@tractorcow tractorcow deleted the pulls/4.0/micmania-config branch February 28, 2017 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants