Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
automatic_updates-3406010
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-3406010
Commits
e8e50522
Commit
e8e50522
authored
2 years ago
by
Adam G-H
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3275508
by phenaproxima: Create a validator to warn if xdebug is on
parent
e1262969
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
automatic_updates.services.yml
+4
-0
4 additions, 0 deletions
automatic_updates.services.yml
package_manager/package_manager.install
+12
-5
12 additions, 5 deletions
package_manager/package_manager.install
src/Validator/XdebugValidator.php
+39
-0
39 additions, 0 deletions
src/Validator/XdebugValidator.php
with
55 additions
and
5 deletions
automatic_updates.services.yml
+
4
−
0
View file @
e8e50522
...
@@ -129,6 +129,10 @@ services:
...
@@ -129,6 +129,10 @@ services:
-
'
@string_translation'
-
'
@string_translation'
tags
:
tags
:
-
{
name
:
event_subscriber
}
-
{
name
:
event_subscriber
}
automatic_updates.validator.xdebug
:
class
:
Drupal\automatic_updates\Validator\XdebugValidator
tags
:
-
{
name
:
event_subscriber
}
automatic_updates.validator.target_release
:
automatic_updates.validator.target_release
:
class
:
\Drupal\automatic_updates\Validator\UpdateReleaseValidator
class
:
\Drupal\automatic_updates\Validator\UpdateReleaseValidator
tags
:
tags
:
...
...
This diff is collapsed.
Click to expand it.
package_manager/package_manager.install
+
12
−
5
View file @
e8e50522
...
@@ -9,12 +9,19 @@
...
@@ -9,12 +9,19 @@
* Implements hook_requirements().
* Implements hook_requirements().
*/
*/
function
package_manager_requirements
()
{
function
package_manager_requirements
()
{
$requirements
=
[];
if
(
!
class_exists
(
'PhpTuf\ComposerStager\Domain\Beginner'
))
{
if
(
!
class_exists
(
'PhpTuf\ComposerStager\Domain\Beginner'
))
{
return
[
$requirements
[
'package_manager_composer_dependencies'
]
=
[
'package_manager'
=>
[
'description'
=>
t
(
'External dependencies for Package Manager are not available. Composer must be used to download the module with dependencies.'
),
'description'
=>
t
(
'External dependencies for Package Manager are not available. Composer must be used to download the module with dependencies.'
),
'severity'
=>
REQUIREMENT_ERROR
,
'severity'
=>
REQUIREMENT_ERROR
,
];
],
}
if
(
extension_loaded
(
'xdebug'
))
{
$requirements
[
'package_manager_xdebug'
]
=
[
'description'
=>
t
(
'Xdebug is enabled, which may have a negative performance impact on Package Manager and any modules that use it.'
),
'severity'
=>
REQUIREMENT_WARNING
,
];
];
}
}
return
$requirements
;
}
}
This diff is collapsed.
Click to expand it.
src/Validator/XdebugValidator.php
0 → 100644
+
39
−
0
View file @
e8e50522
<?php
namespace
Drupal\automatic_updates\Validator
;
use
Drupal\automatic_updates
\Event\ReadinessCheckEvent
;
use
Drupal\Core\StringTranslation\StringTranslationTrait
;
use
Symfony\Component\EventDispatcher\EventSubscriberInterface
;
/**
* Flags a warning if Xdebug is enabled.
*/
class
XdebugValidator
implements
EventSubscriberInterface
{
use
StringTranslationTrait
;
/**
* Flags a warning if Xdebug is enabled.
*
* @param \Drupal\automatic_updates\Event\ReadinessCheckEvent $event
* The event object.
*/
public
function
checkForXdebug
(
ReadinessCheckEvent
$event
):
void
{
if
(
extension_loaded
(
'xdebug'
))
{
$event
->
addWarning
([
$this
->
t
(
'Xdebug is enabled, which may cause timeout errors during automatic updates.'
),
]);
}
}
/**
* {@inheritdoc}
*/
public
static
function
getSubscribedEvents
()
{
return
[
ReadinessCheckEvent
::
class
=>
'checkForXdebug'
,
];
}
}
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