Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
224
Merge Requests
224
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
5ca99d59
Unverified
Commit
5ca99d59
authored
Aug 04, 2020
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#3151096
by dww, jungle: Replace use of whitelist in \Drupal\Core\Utility\ProjectInfo
(cherry picked from commit
72c276f6
)
parent
1894efe8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
core/lib/Drupal/Core/Utility/ProjectInfo.php
core/lib/Drupal/Core/Utility/ProjectInfo.php
+8
-8
No files found.
core/lib/Drupal/Core/Utility/ProjectInfo.php
View file @
5ca99d59
...
...
@@ -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
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment