Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rdf_sync
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
rdf_sync
Commits
e0927c51
Commit
e0927c51
authored
1 year ago
by
Claudiu Cristea
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3427554
by claudiu.cristea: Postpone URI deletion in destruction phase
parent
16591856
No related branches found
No related tags found
1 merge request
!8
Update 2 files
Pipeline
#118108
passed with warnings
1 year ago
Stage: build
Stage: validate
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
rdf_sync.module
+0
-4
0 additions, 4 deletions
rdf_sync.module
rdf_sync.services.yml
+1
-0
1 addition, 0 deletions
rdf_sync.services.yml
src/RdfSyncSynchronizer.php
+9
-0
9 additions, 0 deletions
src/RdfSyncSynchronizer.php
with
10 additions
and
4 deletions
rdf_sync.module
+
0
−
4
View file @
e0927c51
...
@@ -152,9 +152,5 @@ function rdf_sync_entity_delete(EntityInterface $entity): void {
...
@@ -152,9 +152,5 @@ function rdf_sync_entity_delete(EntityInterface $entity): void {
$mapper
=
\Drupal
::
getContainer
()
->
get
(
'rdf_sync.mapper'
);
$mapper
=
\Drupal
::
getContainer
()
->
get
(
'rdf_sync.mapper'
);
if
(
$entity
instanceof
ContentEntityInterface
&&
$mapper
->
isMappedEntity
(
$entity
))
{
if
(
$entity
instanceof
ContentEntityInterface
&&
$mapper
->
isMappedEntity
(
$entity
))
{
\Drupal
::
getContainer
()
->
get
(
'rdf_sync.synchronizer'
)
->
synchronize
(
SyncMethod
::
DELETE
,
[
$entity
]);
\Drupal
::
getContainer
()
->
get
(
'rdf_sync.synchronizer'
)
->
synchronize
(
SyncMethod
::
DELETE
,
[
$entity
]);
\Drupal
::
database
()
->
delete
(
'rdf_sync_uri'
)
->
condition
(
'entity_type'
,
$entity
->
getEntityTypeId
())
->
condition
(
'entity_id'
,
$entity
->
id
())
->
execute
();
}
}
}
}
This diff is collapsed.
Click to expand it.
rdf_sync.services.yml
+
1
−
0
View file @
e0927c51
...
@@ -45,6 +45,7 @@ services:
...
@@ -45,6 +45,7 @@ services:
-
'
@queue'
-
'
@queue'
-
'
@rdf_sync.mapper'
-
'
@rdf_sync.mapper'
-
'
@rdf_sync.normalizer'
-
'
@rdf_sync.normalizer'
-
'
@database'
tags
:
tags
:
-
{
name
:
needs_destruction
}
-
{
name
:
needs_destruction
}
rdf_sync.normalizer.subscriber
:
rdf_sync.normalizer.subscriber
:
...
...
This diff is collapsed.
Click to expand it.
src/RdfSyncSynchronizer.php
+
9
−
0
View file @
e0927c51
...
@@ -4,6 +4,7 @@ declare(strict_types=1);
...
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace
Drupal\rdf_sync
;
namespace
Drupal\rdf_sync
;
use
Drupal\Core\Database\Connection
;
use
Drupal\Core\DestructableInterface
;
use
Drupal\Core\DestructableInterface
;
use
Drupal\Core\Entity\ContentEntityInterface
;
use
Drupal\Core\Entity\ContentEntityInterface
;
use
Drupal\Core\Queue\QueueFactory
;
use
Drupal\Core\Queue\QueueFactory
;
...
@@ -35,6 +36,8 @@ class RdfSyncSynchronizer implements DestructableInterface {
...
@@ -35,6 +36,8 @@ class RdfSyncSynchronizer implements DestructableInterface {
* The RDF Sync mapper service.
* The RDF Sync mapper service.
* @param \Symfony\Component\Serializer\Normalizer\NormalizerInterface $normalizer
* @param \Symfony\Component\Serializer\Normalizer\NormalizerInterface $normalizer
* The RDF Sync normalizer.
* The RDF Sync normalizer.
* @param \Drupal\Core\Database\Connection $database
* The database connection.
*/
*/
public
function
__construct
(
public
function
__construct
(
protected
StateInterface
$state
,
protected
StateInterface
$state
,
...
@@ -42,6 +45,7 @@ class RdfSyncSynchronizer implements DestructableInterface {
...
@@ -42,6 +45,7 @@ class RdfSyncSynchronizer implements DestructableInterface {
protected
QueueFactory
$queueFactory
,
protected
QueueFactory
$queueFactory
,
protected
RdfSyncMapper
$mapper
,
protected
RdfSyncMapper
$mapper
,
protected
NormalizerInterface
$normalizer
,
protected
NormalizerInterface
$normalizer
,
protected
Connection
$database
,
)
{}
)
{}
/**
/**
...
@@ -121,6 +125,11 @@ class RdfSyncSynchronizer implements DestructableInterface {
...
@@ -121,6 +125,11 @@ class RdfSyncSynchronizer implements DestructableInterface {
$entities
,
$entities
,
);
);
RdfSyncConnection
::
deleteTriples
(
$uris
);
RdfSyncConnection
::
deleteTriples
(
$uris
);
// Update {rdf_sync_uri} table.
if
(
$method
===
SyncMethod
::
DELETE
)
{
$this
->
database
->
delete
(
'rdf_sync_uri'
)
->
condition
(
'uri'
,
$uris
,
'IN'
)
->
execute
();
}
}
}
if
(
in_array
(
$method
,
[
SyncMethod
::
INSERT
,
SyncMethod
::
UPDATE
],
TRUE
))
{
if
(
in_array
(
$method
,
[
SyncMethod
::
INSERT
,
SyncMethod
::
UPDATE
],
TRUE
))
{
...
...
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