Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3495531
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Issue forks
drupal-3495531
Commits
d9ccf86f
Unverified
Commit
d9ccf86f
authored
6 years ago
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3005689
by foxtrotcharlie, joachim, alexpott: improve docs for _install_select_profile()
parent
7151900f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/includes/install.core.inc
+16
-7
16 additions, 7 deletions
core/includes/install.core.inc
with
16 additions
and
7 deletions
core/includes/install.core.inc
+
16
−
7
View file @
d9ccf86f
...
@@ -1270,12 +1270,19 @@ function install_select_profile(&$install_state) {
...
@@ -1270,12 +1270,19 @@ function install_select_profile(&$install_state) {
/**
/**
* Determines the installation profile to use in the installer.
* Determines the installation profile to use in the installer.
*
*
* A profile will be selected in the following order of conditions:
* Depending on the context from which it's being called, this method
* may be used to:
* - Automatically select a profile under certain conditions.
* - Indicate which profile has already been selected.
* - Indicate that a profile still needs to be selected.
*
* A profile will be selected automatically if one of the following conditions
* is met. They are checked in the given order:
* - Only one profile is available.
* - Only one profile is available.
* - A specific profile name is requested in installation parameters:
* - A specific profile name is requested in installation parameters:
* - For interactive installations via request query parameters.
* - For interactive installations via request query parameters.
* - For non-interactive installations via install_drupal() settings.
* - For non-interactive installations via install_drupal() settings.
* -
A discovered
profile
that
is a distribution. If multiple profiles are
* -
One of the available
profile
s
is a distribution. If multiple profiles are
* distributions, then the first discovered profile will be selected.
* distributions, then the first discovered profile will be selected.
* - Only one visible profile is available.
* - Only one visible profile is available.
*
*
...
@@ -1283,35 +1290,37 @@ function install_select_profile(&$install_state) {
...
@@ -1283,35 +1290,37 @@ function install_select_profile(&$install_state) {
* The current installer state, containing a 'profiles' key, which is an
* The current installer state, containing a 'profiles' key, which is an
* associative array of profiles with the machine-readable names as keys.
* associative array of profiles with the machine-readable names as keys.
*
*
* @return
* @return
string|null
* The machine-readable name of the selected profile or NULL if no profile was
* The machine-readable name of the selected profile or NULL if no profile was
* selected.
* selected.
*
* @see install_select_profile()
*/
*/
function
_install_select_profile
(
&
$install_state
)
{
function
_install_select_profile
(
&
$install_state
)
{
//
Don't need to choose profile if only one available
.
//
If there is only one profile available it will always be the one selected
.
if
(
count
(
$install_state
[
'profiles'
])
==
1
)
{
if
(
count
(
$install_state
[
'profiles'
])
==
1
)
{
return
key
(
$install_state
[
'profiles'
]);
return
key
(
$install_state
[
'profiles'
]);
}
}
// If a valid profile has already been selected, return the selection.
if
(
!
empty
(
$install_state
[
'parameters'
][
'profile'
]))
{
if
(
!
empty
(
$install_state
[
'parameters'
][
'profile'
]))
{
$profile
=
$install_state
[
'parameters'
][
'profile'
];
$profile
=
$install_state
[
'parameters'
][
'profile'
];
if
(
isset
(
$install_state
[
'profiles'
][
$profile
]))
{
if
(
isset
(
$install_state
[
'profiles'
][
$profile
]))
{
return
$profile
;
return
$profile
;
}
}
}
}
//
Check for a distribution profil
e.
//
If any of the profiles are distribution profiles, return the first on
e.
foreach
(
$install_state
[
'profiles'
]
as
$profile
)
{
foreach
(
$install_state
[
'profiles'
]
as
$profile
)
{
$profile_info
=
install_profile_info
(
$profile
->
getName
());
$profile_info
=
install_profile_info
(
$profile
->
getName
());
if
(
!
empty
(
$profile_info
[
'distribution'
]))
{
if
(
!
empty
(
$profile_info
[
'distribution'
]))
{
return
$profile
->
getName
();
return
$profile
->
getName
();
}
}
}
}
// Get all visible (not hidden) profiles.
// Get all visible (not hidden) profiles.
$visible_profiles
=
array_filter
(
$install_state
[
'profiles'
],
function
(
$profile
)
{
$visible_profiles
=
array_filter
(
$install_state
[
'profiles'
],
function
(
$profile
)
{
$profile_info
=
install_profile_info
(
$profile
->
getName
());
$profile_info
=
install_profile_info
(
$profile
->
getName
());
return
!
isset
(
$profile_info
[
'hidden'
])
||
!
$profile_info
[
'hidden'
];
return
!
isset
(
$profile_info
[
'hidden'
])
||
!
$profile_info
[
'hidden'
];
});
});
// If there is only one visible profile, return it.
if
(
count
(
$visible_profiles
)
==
1
)
{
if
(
count
(
$visible_profiles
)
==
1
)
{
return
(
key
(
$visible_profiles
));
return
(
key
(
$visible_profiles
));
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment