Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
feeds
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drupal.org
feeds
Commits
d0dc5e50
Commit
d0dc5e50
authored
12 years ago
by
Chris Leppanen
Browse files
Options
Downloads
Patches
Plain Diff
Fix replace existing behavior.
parent
5f113600
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/FeedsProcessor.inc
+12
-3
12 additions, 3 deletions
plugins/FeedsProcessor.inc
with
12 additions
and
3 deletions
plugins/FeedsProcessor.inc
+
12
−
3
View file @
d0dc5e50
...
@@ -137,6 +137,8 @@ abstract class FeedsProcessor extends FeedsPlugin {
...
@@ -137,6 +137,8 @@ abstract class FeedsProcessor extends FeedsPlugin {
*/
*/
public
function
process
(
FeedsSource
$source
,
FeedsParserResult
$parser_result
)
{
public
function
process
(
FeedsSource
$source
,
FeedsParserResult
$parser_result
)
{
$state
=
$source
->
state
(
FEEDS_PROCESS
);
$state
=
$source
->
state
(
FEEDS_PROCESS
);
$entity_info
=
$this
->
entityInfo
();
$id_key
=
$entity_info
[
'entity keys'
][
'id'
];
while
(
$item
=
$parser_result
->
shiftItem
())
{
while
(
$item
=
$parser_result
->
shiftItem
())
{
...
@@ -161,8 +163,10 @@ abstract class FeedsProcessor extends FeedsPlugin {
...
@@ -161,8 +163,10 @@ abstract class FeedsProcessor extends FeedsPlugin {
try
{
try
{
$replace_existing
=
$this
->
config
[
'update_existing'
]
==
FEEDS_REPLACE_EXISTING
;
// Build a new entity.
// Build a new entity.
if
(
empty
(
$entity_id
)
)
{
if
(
!
$entity_id
||
$replace_existing
)
{
$entity
=
$this
->
newEntity
(
$source
);
$entity
=
$this
->
newEntity
(
$source
);
$this
->
newItemInfo
(
$entity
,
$source
->
feed_nid
,
$hash
);
$this
->
newItemInfo
(
$entity
,
$source
->
feed_nid
,
$hash
);
}
}
...
@@ -171,12 +175,17 @@ abstract class FeedsProcessor extends FeedsPlugin {
...
@@ -171,12 +175,17 @@ abstract class FeedsProcessor extends FeedsPlugin {
else
{
else
{
$entity
=
$this
->
entityLoad
(
$source
,
$entity_id
);
$entity
=
$this
->
entityLoad
(
$source
,
$entity_id
);
// The feeds_item table is always updated with the info for the most
recently processed entity.
// The feeds_item table is always updated with the info for the most
// The only carryover is the entity_id.
//
recently processed entity.
The only carryover is the entity_id.
$this
->
newItemInfo
(
$entity
,
$source
->
feed_nid
,
$hash
);
$this
->
newItemInfo
(
$entity
,
$source
->
feed_nid
,
$hash
);
$entity
->
feeds_item
->
entity_id
=
$entity_id
;
$entity
->
feeds_item
->
entity_id
=
$entity_id
;
}
}
if
(
$entity_id
&&
$replace_existing
)
{
$entity
->
is_new
=
FALSE
;
$entity
->
$id_key
=
$entity_id
;
}
// Set property and field values.
// Set property and field values.
$this
->
map
(
$source
,
$parser_result
,
$entity
);
$this
->
map
(
$source
,
$parser_result
,
$entity
);
$this
->
entityValidate
(
$entity
);
$this
->
entityValidate
(
$entity
);
...
...
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