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
GitLab 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
Open in Workspace
Download
Patches
Plain diff
Expand sidebar
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
Ensure that the list of new config is correct when installing modules
Alex Pott
requested to merge
issue/config_selector-3205223:3205223-installing-two-modules
into
8.x-2.x
Mar 23, 2021
Overview
0
Commits
4
Pipelines
0
Changes
5
Closes
#3205223
0
0
Merge request reports
Compare
8.x-2.x
version 6
4a59deea
Apr 12, 2021
version 5
171e1e47
Mar 24, 2021
version 4
c0058b1f
Mar 23, 2021
version 3
dc201dc5
Mar 23, 2021
version 2
9c1c23d4
Mar 23, 2021
version 1
8b1e2d91
Mar 23, 2021
8.x-2.x (base)
and
latest version
latest version
94ff415f
4 commits,
Apr 13, 2021
version 6
4a59deea
7 commits,
Apr 12, 2021
version 5
171e1e47
5 commits,
Mar 24, 2021
version 4
c0058b1f
4 commits,
Mar 23, 2021
version 3
dc201dc5
3 commits,
Mar 23, 2021
version 2
9c1c23d4
2 commits,
Mar 23, 2021
version 1
8b1e2d91
1 commit,
Mar 23, 2021
5 files
+
85
−
4
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
src/ConfigSelector.php
+
40
−
2
View file @ 94ff415f
Edit in single-file editor
Open in Web IDE
Show full file
@@ -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