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
6f4105c1
Commit
6f4105c1
authored
14 years ago
by
Alex Barth
Browse files
Options
Downloads
Patches
Plain Diff
#853194 andrewlevine, alex_b: Mapping: don't reset all targets.
parent
442a6990
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.txt
+1
-0
1 addition, 0 deletions
CHANGELOG.txt
plugins/FeedsNodeProcessor.inc
+4
-0
4 additions, 0 deletions
plugins/FeedsNodeProcessor.inc
plugins/FeedsProcessor.inc
+5
-5
5 additions, 5 deletions
plugins/FeedsProcessor.inc
tests/feeds.test
+22
-3
22 additions, 3 deletions
tests/feeds.test
with
32 additions
and
8 deletions
CHANGELOG.txt
+
1
−
0
View file @
6f4105c1
...
...
@@ -3,6 +3,7 @@
Feeds 6.x 1.X XXXX
------------------
- #853194 andrewlevine, alex_b: Mapping: don't reset all targets.
- #853144 alex_b: Consistent use of "replace" vs "update".
- #850998 alex_b: Clean up file upload form. Note: If you supply file paths
directly in the textfield rather than uploading them through the UI, you will
...
...
This diff is collapsed.
Click to expand it.
plugins/FeedsNodeProcessor.inc
+
4
−
0
View file @
6f4105c1
...
...
@@ -259,6 +259,10 @@ class FeedsNodeProcessor extends FeedsProcessor {
);
}
$targets
+=
array
(
'uid'
=>
array
(
'name'
=>
t
(
'User ID'
),
'description'
=>
t
(
'The Drupal user ID of the node author.'
),
),
'status'
=>
array
(
'name'
=>
t
(
'Published status'
),
'description'
=>
t
(
'Whether a node is published or not. 1 stands for published, 0 for not published.'
),
...
...
This diff is collapsed.
Click to expand it.
plugins/FeedsProcessor.inc
+
5
−
5
View file @
6f4105c1
...
...
@@ -108,12 +108,12 @@ abstract class FeedsProcessor extends FeedsPlugin {
$target_item
=
(
object
)
$target_item
;
$convert_to_array
=
TRUE
;
}
foreach
(
$t
argets
[
$this
->
id
]
as
$target_name
=>
$target
)
{
if
(
isset
(
$target
[
'real_target'
])
&&
isset
(
$target_item
->
$
target
[
'real_target'
]))
{
unset
(
$target_item
->
$target
[
'real_target'
]);
foreach
(
$t
his
->
config
[
'mappings'
]
as
$mapping
)
{
if
(
isset
(
$target
s
[
$mapping
[
'
target
'
]]
[
'real_target'
]))
{
unset
(
$target_item
->
{
$target
s
[
$mapping
[
'target'
]]
[
'real_target'
]
}
);
}
else
if
(
isset
(
$target_item
->
$
target
_name
))
{
unset
(
$target_item
->
$
target
_name
);
elseif
(
isset
(
$target_item
->
{
$mapping
[
'
target
'
]}
))
{
unset
(
$target_item
->
{
$mapping
[
'
target
'
]}
);
}
}
if
(
$convert_to_array
)
{
...
...
This diff is collapsed.
Click to expand it.
tests/feeds.test
+
22
−
3
View file @
6f4105c1
...
...
@@ -33,7 +33,7 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase {
$this
->
drupalLogin
(
$this
->
drupalCreateUser
(
array
(
'administer feeds'
,
'administer nodes'
,
'administer feeds'
,
'administer nodes'
,
'administer content types'
,
)
)
);
...
...
@@ -133,7 +133,7 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase {
$this
->
assertText
(
'The first major change is switching'
);
// Assert DB status.
$count
=
db_result
(
db_query
(
"SELECT COUNT(*) FROM
{
feeds_node_item
}
"
));
$count
=
db_result
(
db_query
(
"SELECT COUNT(*) FROM
{
node
}
n INNER JOIN
{
feeds_node_item
}
fn ON n.nid = fn.nid
"
));
$this
->
assertEqual
(
$count
,
10
,
'Accurate number of items in database.'
);
// Assert default input format on first imported feed node.
...
...
@@ -145,10 +145,29 @@ class FeedsRSStoNodesTest extends FeedsWebTestCase {
$this
->
assertText
(
'There is no new content.'
);
// Assert DB status, there still shouldn't be more than 10 items.
$count
=
db_result
(
db_query
(
"SELECT COUNT(*) FROM
{
feeds_node_item
}
"
));
$count
=
db_result
(
db_query
(
"SELECT COUNT(*) FROM
{
node
}
n INNER JOIN
{
feeds_node_item
}
fn ON n.nid = fn.nid
"
));
$this
->
assertEqual
(
$count
,
10
,
'Accurate number of items in database.'
);
// All of the above tests should have produced published nodes, set default
// to unpublished, import again.
$count
=
db_result
(
db_query
(
"SELECT COUNT(*) FROM
{
node
}
n INNER JOIN
{
feeds_node_item
}
fn ON n.nid = fn.nid WHERE n.status = 1"
));
$this
->
assertEqual
(
$count
,
10
,
'All items are published.'
);
$edit
=
array
(
'node_options[status]'
=>
FALSE
,
);
$this
->
drupalPost
(
'admin/content/node-type/story'
,
$edit
,
t
(
'Save content type'
));
$this
->
drupalPost
(
'node/'
.
$nid
.
'/delete-items'
,
array
(),
'Delete'
);
$this
->
drupalPost
(
'node/'
.
$nid
.
'/import'
,
array
(),
'Import'
);
$count
=
db_result
(
db_query
(
"SELECT COUNT(*) FROM
{
node
}
n INNER JOIN
{
feeds_node_item
}
fn ON n.nid = fn.nid WHERE n.status = 0"
));
$this
->
assertEqual
(
$count
,
10
,
'No items are published.'
);
$edit
=
array
(
'node_options[status]'
=>
TRUE
,
);
$this
->
drupalPost
(
'admin/content/node-type/story'
,
$edit
,
t
(
'Save content type'
));
$this
->
drupalPost
(
'node/'
.
$nid
.
'/delete-items'
,
array
(),
'Delete'
);
// Enable replace existing and import updated feed file.
$this
->
drupalPost
(
'node/'
.
$nid
.
'/import'
,
array
(),
'Import'
);
$this
->
setSettings
(
'syndication'
,
'FeedsNodeProcessor'
,
array
(
'update_existing'
=>
1
));
$feed_url
=
$GLOBALS
[
'base_url'
]
.
'/'
.
drupal_get_path
(
'module'
,
'feeds'
)
.
'/tests/feeds/developmentseed_changes.rss2'
;
$this
->
editFeedNode
(
$nid
,
$feed_url
);
...
...
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