Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
automatic_updates
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
automatic_updates
Merge requests
!269
Changed the variable to virtualfilesystem from vendor
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Changed the variable to virtualfilesystem from vendor
issue/automatic_updates-3275075:3275075-change-the-name
into
8.x-2.x
Overview
4
Commits
2
Pipelines
0
Changes
1
1 unresolved thread
Hide all comments
Merged
VIGHNESH SADAGOPAL
requested to merge
issue/automatic_updates-3275075:3275075-change-the-name
into
8.x-2.x
2 years ago
Overview
4
Commits
2
Pipelines
0
Changes
55
1 unresolved thread
Hide all comments
Expand
Closes
#3275075
Made changes in the variablename
0
0
Merge request reports
Compare
version 2
version 3
c99056c4
2 years ago
version 2
010ef300
2 years ago
version 1
c02fab76
2 years ago
8.x-2.x (base)
and
version 3
latest version
c99056c4
2 commits,
2 years ago
version 3
c99056c4
2 commits,
2 years ago
version 2
010ef300
2 commits,
2 years ago
version 1
c02fab76
1 commit,
2 years ago
Show latest version
55 files
+
766
−
147
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
55
Search (e.g. *.vue) (Ctrl+P)
automatic_updates_extensions/src/Validator/UpdateReleaseValidator.php
0 → 100644
+
67
−
0
Options
<?php
namespace
Drupal\automatic_updates_extensions\Validator
;
use
Drupal\automatic_updates
\ProjectInfo
;
use
Drupal\automatic_updates_extensions
\ExtensionUpdater
;
use
Drupal\Core\StringTranslation\StringTranslationTrait
;
use
Drupal\package_manager
\Event\PreCreateEvent
;
use
Symfony\Component\EventDispatcher\EventSubscriberInterface
;
/**
* Validates that updated projects are secure and supported.
*/
class
UpdateReleaseValidator
implements
EventSubscriberInterface
{
use
StringTranslationTrait
;
/**
* Checks that the update projects are secure and supported.
*
* @param \Drupal\package_manager\Event\PreCreateEvent $event
* The event object.
*/
public
function
checkRelease
(
PreCreateEvent
$event
):
void
{
$stage
=
$event
->
getStage
();
// This check only works with Automatic Updates Extensions.
if
(
!
$stage
instanceof
ExtensionUpdater
)
{
return
;
}
$all_versions
=
$stage
->
getPackageVersions
();
$messages
=
[];
foreach
([
'production'
,
'dev'
]
as
$package_type
)
{
foreach
(
$all_versions
[
$package_type
]
as
$package_name
=>
$version
)
{
$package_parts
=
explode
(
'/'
,
$package_name
);
$project_name
=
$package_parts
[
1
];
// If the version isn't in the list of installable releases, then it
// isn't secure and supported and the user should receive an error.
$releases
=
(
new
ProjectInfo
(
$project_name
))
->
getInstallableReleases
();
if
(
empty
(
$releases
)
||
!
array_key_exists
(
$version
,
$releases
))
{
$messages
[]
=
$this
->
t
(
'Project @project_name to version @version'
,
[
'@project_name'
=>
$project_name
,
'@version'
=>
$version
,
]);
}
}
}
if
(
$messages
)
{
$summary
=
$this
->
formatPlural
(
count
(
$messages
),
'Cannot update because the following project version is not in the list of installable releases.'
,
'Cannot update because the following project versions are not in the list of installable releases.'
);
$event
->
addError
(
$messages
,
$summary
);
}
}
/**
* {@inheritdoc}
*/
public
static
function
getSubscribedEvents
()
{
return
[
PreCreateEvent
::
class
=>
'checkRelease'
,
];
}
}
Loading