Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
automatic_updates-3449631
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
automatic_updates-3449631
Commits
de9413f4
Commit
de9413f4
authored
1 year ago
by
Ted Bowman
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3409519
: PackageManagerUninstallValidator needs to use dependency injection to pass on 11.x
parent
ee1286b9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
package_manager/package_manager.services.yml
+2
-3
2 additions, 3 deletions
package_manager/package_manager.services.yml
package_manager/src/PackageManagerUninstallValidator.php
+51
-14
51 additions, 14 deletions
package_manager/src/PackageManagerUninstallValidator.php
with
53 additions
and
17 deletions
package_manager/package_manager.services.yml
+
2
−
3
View file @
de9413f4
...
...
@@ -138,9 +138,8 @@ services:
Drupal\package_manager\PackageManagerUninstallValidator
:
tags
:
-
{
name
:
module_install.uninstall_validator
}
parent
:
container.trait
calls
:
-
[
'
setContainer'
,
[
'
@service_container'
]]
arguments
:
$eventDispatcher
:
'
@event_dispatcher'
lazy
:
true
Drupal\package_manager\Validator\SettingsValidator
:
tags
:
...
...
This diff is collapsed.
Click to expand it.
package_manager/src/PackageManagerUninstallValidator.php
+
51
−
14
View file @
de9413f4
...
...
@@ -4,15 +4,16 @@ declare(strict_types = 1);
namespace
Drupal\package_manager
;
use
Drupal\Component\Datetime\TimeInterface
;
use
Drupal\Core\Extension\ModuleUninstallValidatorInterface
;
use
Drupal\Core\Queue\QueueFactory
;
use
Drupal\Core\StringTranslation\StringTranslationTrait
;
use
Drupal\Core\TempStore\SharedTempStoreFactory
;
use
PhpTuf\ComposerStager\API\Core\BeginnerInterface
;
use
PhpTuf\ComposerStager\API\Core\CommitterInterface
;
use
PhpTuf\ComposerStager\API\Core\StagerInterface
;
use
PhpTuf\ComposerStager\API\Path\Factory\PathFactoryInterface
;
use
Symfony\Component\DependencyInjection\ContainerAwareInterface
;
use
Symfony\Component\DependencyInjection\ContainerAwareTrait
;
use
Symfony\Component\EventDispatcher\EventDispatcherInterface
;
/**
* Prevents any module from being uninstalled if update is in process.
...
...
@@ -22,26 +23,62 @@ use Symfony\Component\DependencyInjection\ContainerAwareTrait;
* at any time without warning. External code should not interact with this
* class.
*/
final
class
PackageManagerUninstallValidator
implements
ModuleUninstallValidatorInterface
,
ContainerAwareInterface
{
final
class
PackageManagerUninstallValidator
implements
ModuleUninstallValidatorInterface
{
use
ContainerAwareTrait
;
use
StringTranslationTrait
;
/**
* Constructs a new PackageManagerUninstallValidator object.
*
* @param \Drupal\package_manager\PathLocator $pathLocator
* The path locator service.
* @param \PhpTuf\ComposerStager\API\Core\BeginnerInterface $beginner
* The beginner service.
* @param \PhpTuf\ComposerStager\API\Core\StagerInterface $stager
* The stager service.
* @param \PhpTuf\ComposerStager\API\Core\CommitterInterface $committer
* The committer service.
* @param \Drupal\Core\Queue\QueueFactory $queueFactory
* The queue factory service.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher
* The event dispatcher service.
* @param \Drupal\Core\TempStore\SharedTempStoreFactory $sharedTempStoreFactory
* The shared temp store factory service.
* @param \Drupal\Component\Datetime\TimeInterface $time
* The time service.
* @param \PhpTuf\ComposerStager\API\Path\Factory\PathFactoryInterface $pathFactory
* The path factory service.
* @param \Drupal\package_manager\FailureMarker $failureMarker
* The failure marker service.
*/
public
function
__construct
(
private
readonly
PathLocator
$pathLocator
,
private
readonly
BeginnerInterface
$beginner
,
private
readonly
StagerInterface
$stager
,
private
readonly
CommitterInterface
$committer
,
private
readonly
QueueFactory
$queueFactory
,
private
readonly
EventDispatcherInterface
$eventDispatcher
,
private
readonly
SharedTempStoreFactory
$sharedTempStoreFactory
,
private
readonly
TimeInterface
$time
,
private
readonly
PathFactoryInterface
$pathFactory
,
private
readonly
FailureMarker
$failureMarker
)
{}
/**
* {@inheritdoc}
*/
public
function
validate
(
$module
)
{
$stage
=
new
class
(
$this
->
container
->
get
(
P
athLocator
::
class
)
,
$this
->
container
->
get
(
BeginnerInterface
::
class
)
,
$this
->
container
->
get
(
StagerInterface
::
class
)
,
$this
->
co
ntainer
->
get
(
CommitterInterface
::
class
)
,
$this
->
container
->
get
(
Q
ueueFactory
::
class
)
,
$this
->
container
->
get
(
'
event
_d
ispatcher
'
)
,
$this
->
container
->
get
(
't
emp
s
tore
.shared'
)
,
$this
->
container
->
get
(
'datetime.time'
)
,
$this
->
container
->
get
(
PathFactoryInterface
::
class
)
,
$this
->
container
->
get
(
F
ailureMarker
::
class
)
)
extends
StageBase
{};
$this
->
p
athLocator
,
$this
->
beginner
,
$this
->
stager
,
$this
->
co
mmitter
,
$this
->
q
ueueFactory
,
$this
->
event
D
ispatcher
,
$this
->
sharedT
emp
S
tore
Factory
,
$this
->
time
,
$this
->
pathFactory
,
$this
->
f
ailureMarker
)
extends
StageBase
{};
if
(
$stage
->
isAvailable
()
||
!
$stage
->
isApplying
())
{
return
[];
}
...
...
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