Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drupal Environment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Composer
plugin
Drupal Environment
Commits
f6aa6da0
Commit
f6aa6da0
authored
8 months ago
by
GitLab CI
Browse files
Options
Downloads
Plain Diff
Merge branch 'develop' into 'main'
Merging develop into main See merge request
!251
parents
fecd3925
7c083271
No related branches found
No related tags found
1 merge request
!251
Merging develop into main
Pipeline
#1278954
passed
8 months ago
Stage: release
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/AuditIgnoreReportCommand.php
+44
-0
44 additions, 0 deletions
src/AuditIgnoreReportCommand.php
src/CommandProvider.php
+1
-0
1 addition, 0 deletions
src/CommandProvider.php
src/Handler.php
+48
-0
48 additions, 0 deletions
src/Handler.php
with
93 additions
and
0 deletions
src/AuditIgnoreReportCommand.php
0 → 100644
+
44
−
0
View file @
f6aa6da0
<?php
namespace
LakeDrops\DrupalEnvironment
;
use
LakeDrops\Component\Composer\BaseCommand
;
use
Symfony\Component\Console\Input\InputInterface
;
use
Symfony\Component\Console\Output\OutputInterface
;
/**
* Composer Audit Ignore Report Command for LakeDrops Drupal environments.
*
* @package LakeDrops\DrupalEnvironment
*/
class
AuditIgnoreReportCommand
extends
BaseCommand
{
/**
* {@inheritdoc}
*/
protected
function
configure
():
void
{
parent
::
configure
();
$this
->
setName
(
'lakedrops:audit-ignore-report'
)
->
setDescription
(
'Report about status of all ignored CVEs during audit.'
);
}
/**
* {@inheritdoc}
*/
public
function
getHandlerClass
():
string
{
return
Handler
::
class
;
}
/**
* {@inheritdoc}
*/
protected
function
execute
(
InputInterface
$input
,
OutputInterface
$output
):
int
{
parent
::
execute
(
$input
,
$output
);
/** @var Handler $handler */
$handler
=
$this
->
handler
;
$handler
->
auditIgnoreReport
();
return
0
;
}
}
This diff is collapsed.
Click to expand it.
src/CommandProvider.php
+
1
−
0
View file @
f6aa6da0
...
...
@@ -20,6 +20,7 @@ class CommandProvider implements CommandProviderCapability {
public
function
getCommands
():
array
{
return
[
new
ConfigCommand
(),
new
AuditIgnoreReportCommand
(),
];
}
...
...
This diff is collapsed.
Click to expand it.
src/Handler.php
+
48
−
0
View file @
f6aa6da0
...
...
@@ -2,6 +2,7 @@
namespace
LakeDrops\DrupalEnvironment
;
use
GuzzleHttp\Client
;
use
LakeDrops\Component\Composer\BaseHandler
;
use
Symfony\Component\Filesystem\Filesystem
;
...
...
@@ -187,4 +188,51 @@ class Handler extends BaseHandler {
}
}
/**
* Generates a report for ignored projects during audit.
*
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public
function
auditIgnoreReport
():
void
{
$audit
=
$this
->
composer
->
getConfig
()
->
get
(
'audit'
);
if
(
empty
(
$audit
[
'ignore'
]))
{
$this
->
io
->
info
(
'There are no ignored CVEs in the configuration.'
);
return
;
}
$client
=
new
Client
();
$ignore
=
$audit
[
'ignore'
];
$report
=
[];
foreach
(
$ignore
as
$item
)
{
print
(
'.'
);
$parts
=
explode
(
'-'
,
$item
);
if
(
count
(
$parts
)
<
5
||
$parts
[
0
]
!==
'DDQG'
||
$parts
[
2
]
!==
'drupal'
)
{
$report
[]
=
$item
.
': Not Drupal related'
;
continue
;
}
$project
=
json_decode
(
$client
->
get
(
'https://www.drupal.org/api-d7/node.json?type=project_module&field_project_machine_name='
.
$parts
[
3
])
->
getBody
(),
TRUE
);
if
(
empty
(
$project
[
'list'
]))
{
$project
=
json_decode
(
$client
->
get
(
'https://www.drupal.org/api-d7/node.json?type=project_theme&field_project_machine_name='
.
$parts
[
3
])
->
getBody
(),
TRUE
);
}
if
(
empty
(
$project
[
'list'
]))
{
$report
[]
=
$parts
[
3
]
.
': Drupal project not found'
;
}
$nid
=
$project
[
'list'
][
0
][
'nid'
];
$releases
=
json_decode
(
$client
->
get
(
'https://www.drupal.org/api-d7/node.json?type=project_release&field_release_update_status=0&field_release_category=current&field_release_project='
.
$nid
)
->
getBody
(),
TRUE
);
if
(
empty
(
$releases
[
'list'
]))
{
$report
[]
=
$parts
[
3
]
.
': No releases available for Drupal project'
;
continue
;
}
$used
=
$parts
[
4
]
.
(
isset
(
$parts
[
5
])
?
'-'
.
$parts
[
5
]
:
''
);
$used_version_major
=
(
int
)
$parts
[
4
][
0
];
$available
=
[];
foreach
(
$releases
[
'list'
]
as
$release
)
{
if
((
int
)
$release
[
'field_release_version_major'
]
>=
$used_version_major
)
{
$available
[]
=
$release
[
'field_release_version'
];
}
}
$report
[]
=
$parts
[
3
]
.
': '
.
$used
.
' - '
.
implode
(
' '
,
$available
);
}
print_r
(
$report
);
}
}
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