Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
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
drupal
Commits
304da11c
Commit
304da11c
authored
11 years ago
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2081609
by yched: Fixed field purge should bail out on unknown entity types.
parent
a4870dd1
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/field/field.purge.inc
+15
-0
15 additions, 0 deletions
core/modules/field/field.purge.inc
with
15 additions
and
0 deletions
core/modules/field/field.purge.inc
+
15
−
0
View file @
304da11c
...
...
@@ -78,6 +78,13 @@ function field_purge_batch($batch_size) {
foreach
(
$instances
as
$instance
)
{
$entity_type
=
$instance
[
'entity_type'
];
// We cannot purge anything if the entity type is unknown (e.g. the
// providing module was uninstalled).
// @todo Revisit after https://drupal.org/node/2080823.
if
(
!
isset
(
$info
[
$entity_type
]))
{
continue
;
}
// EntityFieldQuery currently fails on conditions on comment bundle.
// Remove when http://drupal.org/node/731724 is fixed.
if
(
$entity_type
==
'comment'
)
{
...
...
@@ -117,6 +124,14 @@ function field_purge_batch($batch_size) {
$deleted_fields
=
Drupal
::
state
()
->
get
(
'field.field.deleted'
)
?:
array
();
foreach
(
$deleted_fields
as
$field
)
{
$field
=
new
Field
(
$field
);
// We cannot purge anything if the entity type is unknown (e.g. the
// providing module was uninstalled).
// @todo Revisit after https://drupal.org/node/2080823.
if
(
!
isset
(
$info
[
$field
->
entity_type
]))
{
continue
;
}
$instances
=
field_read_instances
(
array
(
'field_id'
=>
$field
[
'uuid'
]),
array
(
'include_deleted'
=>
1
));
if
(
empty
(
$instances
))
{
field_purge_field
(
$field
);
...
...
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