Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3338541
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-3338541
Commits
72c276f6
Unverified
Commit
72c276f6
authored
4 years ago
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3151096
by dww, jungle: Replace use of whitelist in \Drupal\Core\Utility\ProjectInfo
parent
5f61f0fb
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/lib/Drupal/Core/Utility/ProjectInfo.php
+8
-8
8 additions, 8 deletions
core/lib/Drupal/Core/Utility/ProjectInfo.php
with
8 additions
and
8 deletions
core/lib/Drupal/Core/Utility/ProjectInfo.php
+
8
−
8
View file @
72c276f6
...
...
@@ -35,11 +35,11 @@ class ProjectInfo {
* @param bool $status
* Boolean that controls what status (enabled or uninstalled) to process out
* of the $list and add to the $projects array.
* @param array $additional_
whitelist
* @param array $additional_
elements
* (optional) Array of additional elements to be collected from the .info.yml
* file. Defaults to array().
*/
public
function
processInfoList
(
array
&
$projects
,
array
$list
,
$project_type
,
$status
,
array
$additional_
whitelist
=
[])
{
public
function
processInfoList
(
array
&
$projects
,
array
$list
,
$project_type
,
$status
,
array
$additional_
elements
=
[])
{
foreach
(
$list
as
$file
)
{
// Just projects with a matching status should be listed.
if
(
$file
->
status
!=
$status
)
{
...
...
@@ -111,7 +111,7 @@ public function processInfoList(array &$projects, array $list, $project_type, $s
'name'
=>
$project_name
,
// Only save attributes from the .info.yml file we care about so we do
// not bloat our RAM usage needlessly.
'info'
=>
$this
->
filterProjectInfo
(
$file
->
info
,
$additional_
whitelist
),
'info'
=>
$this
->
filterProjectInfo
(
$file
->
info
,
$additional_
elements
),
'datestamp'
=>
$file
->
info
[
'datestamp'
],
'includes'
=>
[
$file
->
getName
()
=>
$file
->
info
[
'name'
]],
'project_type'
=>
$project_display_type
,
...
...
@@ -165,7 +165,7 @@ public function getProjectName(Extension $file) {
* @param array $info
* Array of .info.yml file data as returned by
* \Drupal\Core\Extension\InfoParser.
* @param $additional_
whitelist
* @param $additional_
elements
* (optional) Array of additional elements to be collected from the .info.yml
* file. Defaults to array().
*
...
...
@@ -174,8 +174,8 @@ public function getProjectName(Extension $file) {
*
* @see \Drupal\Core\Utility\ProjectInfo::processInfoList()
*/
public
function
filterProjectInfo
(
$info
,
$additional_
whitelist
=
[])
{
$
whitelist
=
[
public
function
filterProjectInfo
(
$info
,
$additional_
elements
=
[])
{
$
elements
=
[
'_info_file_ctime'
,
'datestamp'
,
'major'
,
...
...
@@ -185,8 +185,8 @@ public function filterProjectInfo($info, $additional_whitelist = []) {
'project status url'
,
'version'
,
];
$
whitelist
=
array_merge
(
$
whitelist
,
$additional_
whitelist
);
return
array_intersect_key
(
$info
,
array_combine
(
$
whitelist
,
$whitelist
));
$
elements
=
array_merge
(
$
elements
,
$additional_
elements
);
return
array_intersect_key
(
$info
,
array_combine
(
$
elements
,
$elements
));
}
}
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