Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
config_selector
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
config_selector
Merge requests
!1
Ensure that the list of new config is correct when installing modules
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Ensure that the list of new config is correct when installing modules
issue/config_selector-3205223:3205223-installing-two-modules
into
8.x-2.x
Overview
0
Commits
4
Pipelines
0
Changes
5
Merged
Alex Pott
requested to merge
issue/config_selector-3205223:3205223-installing-two-modules
into
8.x-2.x
4 years ago
Overview
0
Commits
4
Pipelines
0
Changes
5
Expand
Closes
#3205223
0
0
Merge request reports
Compare
8.x-2.x
version 6
4a59deea
4 years ago
version 5
171e1e47
4 years ago
version 4
c0058b1f
4 years ago
version 3
dc201dc5
4 years ago
version 2
9c1c23d4
4 years ago
version 1
8b1e2d91
4 years ago
8.x-2.x (base)
and
latest version
latest version
94ff415f
4 commits,
4 years ago
version 6
4a59deea
7 commits,
4 years ago
version 5
171e1e47
5 commits,
4 years ago
version 4
c0058b1f
4 commits,
4 years ago
version 3
dc201dc5
3 commits,
4 years ago
version 2
9c1c23d4
2 commits,
4 years ago
version 1
8b1e2d91
1 commit,
4 years ago
5 files
+
85
−
4
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
src/ConfigSelector.php
+
40
−
2
Options
@@ -71,6 +71,24 @@ class ConfigSelector {
*/
protected
$messenger
;
/**
* Ensures ::selectConfig() has the correct list of configuration.
*
* Prevents multiple triggers of ::setCurrentConfigList() causing the list of
* new configuration to be calculated incorrectly.
*
* Records the name of the module that first triggered
* config_selector_module_preinstall().
*
* @var string
*
* @see \Drupal\config_selector\ConfigSelector::setCurrentConfigList()
* @see \Drupal\config_selector\ConfigSelector::selectConfig()
* @see config_selector_module_preinstall()
* @see config_selector_modules_installed()
*/
private
static
$modulePreinstallTriggered
;
/**
* ConfigSelector constructor.
*
@@ -110,6 +128,13 @@ class ConfigSelector {
* @see config_selector_module_preinstall()
*/
public
function
setCurrentConfigList
(
$module
)
{
// This should only trigger once per set of modules passed to the
// ModuleInstaller to install. As service will be rebuild during the module
// install a private static variable is used to store this information.
if
(
static
::
$modulePreinstallTriggered
!==
NULL
)
{
return
$this
;
}
static
::
$modulePreinstallTriggered
=
$module
;
if
(
$module
===
'config_selector'
)
{
// If the Configuration Selector module is being installed, process all
// existing configuration in
@@ -212,13 +237,26 @@ class ConfigSelector {
}
/**
* Selects configuration to enable and disable after installing a module.
* Selects configuration to enable and disable after installing modules.
*
* Ensures config selection works when multiple modules are installed or
* when a module's hook_install() also installs modules.
*
* @param string[] $modules
* The list of modules being installed.
*
* @return $this
*
* @see config_selector_modules_installed()
*/
public
function
selectConfig
()
{
public
function
selectConfigOnInstall
(
array
$modules
)
{
if
(
static
::
$modulePreinstallTriggered
!==
NULL
&&
!
in_array
(
static
::
$modulePreinstallTriggered
,
$modules
))
{
return
$this
;
}
// Reset the flag as we're now selecting config based on the new config that
// has been created.
static
::
$modulePreinstallTriggered
=
NULL
;
$new_configuration_list
=
array_diff
(
$this
->
configFactory
->
listAll
(),
$this
->
state
->
get
(
'config_selector.current_config_list'
,
[])
Loading