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
b4b55221
Commit
b4b55221
authored
14 years ago
by
Alex Barth
Browse files
Options
Downloads
Patches
Plain Diff
Fix creating new item info on the fly if there is no existing one.
parent
1d37a78a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
feeds.module
+11
-6
11 additions, 6 deletions
feeds.module
plugins/FeedsProcessor.inc
+3
-1
3 additions, 1 deletion
plugins/FeedsProcessor.inc
with
14 additions
and
7 deletions
feeds.module
+
11
−
6
View file @
b4b55221
...
@@ -495,7 +495,7 @@ function feeds_node_insert($node) {
...
@@ -495,7 +495,7 @@ function feeds_node_insert($node) {
*/
*/
function
feeds_node_update
(
$node
)
{
function
feeds_node_update
(
$node
)
{
// Node produced by source.
// Node produced by source.
feeds_item_info_
updat
e
(
$node
,
$node
->
nid
);
feeds_item_info_
sav
e
(
$node
,
$node
->
nid
);
// Source attached to node.
// Source attached to node.
if
(
$importer_id
=
feeds_get_importer_id
(
$node
->
type
))
{
if
(
$importer_id
=
feeds_get_importer_id
(
$node
->
type
))
{
...
@@ -534,7 +534,7 @@ function feeds_taxonomy_term_insert($term) {
...
@@ -534,7 +534,7 @@ function feeds_taxonomy_term_insert($term) {
* Implements hook_taxonomy_term_update().
* Implements hook_taxonomy_term_update().
*/
*/
function
feeds_taxonomy_term_update
(
$term
)
{
function
feeds_taxonomy_term_update
(
$term
)
{
feeds_item_info_
updat
e
(
$term
,
$term
->
tid
);
feeds_item_info_
sav
e
(
$term
,
$term
->
tid
);
}
}
/**
/**
...
@@ -558,7 +558,7 @@ function feeds_user_insert(&$edit, $account, $category) {
...
@@ -558,7 +558,7 @@ function feeds_user_insert(&$edit, $account, $category) {
* Implements hook_user_update().
* Implements hook_user_update().
*/
*/
function
feeds_user_update
(
&
$edit
,
$account
,
$category
)
{
function
feeds_user_update
(
&
$edit
,
$account
,
$category
)
{
feeds_item_info_
updat
e
(
$account
,
$account
->
uid
);
feeds_item_info_
sav
e
(
$account
,
$account
->
uid
);
}
}
/**
/**
...
@@ -764,12 +764,17 @@ function feeds_item_info_insert($entity, $entity_id) {
...
@@ -764,12 +764,17 @@ function feeds_item_info_insert($entity, $entity_id) {
}
}
/**
/**
*
U
pdates an item info object in he feeds_item table.
*
Inserts or u
pdates an item info object in he feeds_item table.
*/
*/
function
feeds_item_info_
updat
e
(
$entity
,
$entity_id
)
{
function
feeds_item_info_
sav
e
(
$entity
,
$entity_id
)
{
if
(
isset
(
$entity
->
feeds_item
))
{
if
(
isset
(
$entity
->
feeds_item
))
{
$entity
->
feeds_item
->
entity_id
=
$entity_id
;
$entity
->
feeds_item
->
entity_id
=
$entity_id
;
drupal_write_record
(
'feeds_item'
,
$entity
->
feeds_item
,
array
(
'entity_type'
,
'entity_id'
));
if
(
feeds_item_info_load
(
$entity
->
feeds_item
->
entity_type
,
$entity_id
))
{
drupal_write_record
(
'feeds_item'
,
$entity
->
feeds_item
,
array
(
'entity_type'
,
'entity_id'
));
}
else
{
feeds_item_info_insert
(
$entity
,
$entity_id
);
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
plugins/FeedsProcessor.inc
+
3
−
1
View file @
b4b55221
...
@@ -120,8 +120,10 @@ abstract class FeedsProcessor extends FeedsPlugin {
...
@@ -120,8 +120,10 @@ abstract class FeedsProcessor extends FeedsPlugin {
}
}
else
{
else
{
$entity
=
$this
->
entityLoad
(
$source
,
$entity_id
);
$entity
=
$this
->
entityLoad
(
$source
,
$entity_id
);
if
(
$this
->
loadItemInfo
(
$entity
))
{
// If an existing item info can't be loaded, create one.
if
(
!
$this
->
loadItemInfo
(
$entity
))
{
$this
->
newItemInfo
(
$entity
,
$source
->
feed_nid
,
$hash
);
$this
->
newItemInfo
(
$entity
,
$source
->
feed_nid
,
$hash
);
$entity
->
feeds_item
->
entity_id
=
$entity_id
;
}
}
}
}
$this
->
map
(
$source
,
$parser_result
,
$entity
);
$this
->
map
(
$source
,
$parser_result
,
$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