- Issue created by @tormi
- Status changed to Postponed: needs info
almost 2 years ago 8:30am 31 January 2023 - 🇳🇱Netherlands megachriz
Can you give more information about the source you were trying to import and how the the feeds importer looks like?
Can it be that the source was completely empty? That would be my first guess. Because assuming it is about
$state->removeList
, that variable gets set inFeedsProcessor::process()
, but maybe there is a situation whereFeedsProcessor::process()
never gets called? - 🇪🇪Estonia tormi Tallinn
MegaChriz, you're correct - the source was completely empty :)
Should I close the issue or should we check if
$state->removeList
is countable (and give some feedback if not)? - Status changed to Active
almost 2 years ago 9:10am 31 January 2023 - 🇳🇱Netherlands megachriz
I think this is worth to fix. What I think we need to do is:
- Add a test that imports an empty source. The test should fail with the error given. The test would ensure that the error doesn't accidentally come back in the future.
- In FeedsProcessor::clean() we should probably check if
$state->removeList
is not null before proceeding further.
I thought too about that the clean stage should perhaps be entirely skipped (so no calls to
clean()
would happen) when the source is empty, but there there is also a feature request for cleaning data in that case: ✨ Add an option to delete all nodes when the feed source is empty RTBC . - Status changed to Needs review
over 1 year ago 8:42pm 5 April 2023 - last update
over 1 year ago 536 pass - last update
over 1 year ago 536 pass - last update
over 1 year ago 535 pass, 19 fail - last update
over 1 year ago 536 pass, 17 fail - last update
over 1 year ago 534 pass, 2 fail - 🇺🇸United States cboyden
There's another instance of the potential PHP error in FeedsNodeProcessor.inc. I've attached an updated patch that includes this.
The last submitted patch, 7: feeds-clean-empty-3337811-7.patch, failed testing. View results →
- Status changed to Needs work
over 1 year ago 6:17am 7 June 2023 - 🇨🇦Canada Nathan Tsai
#7 Worked for me (although I don't know why the tests are not passing)
- First commit to issue fork.
- last update
over 1 year ago 528 pass, 4 fail - 🇨🇦Canada Nathan Tsai
@bharath-kondeti, did you intentionally leave out the tests that were in #6 and #7?
Note: When using Feeds Extensible Parsers → , an empty response still results in no nodes being deleted or unpublished.
- 🇨🇦Canada Nathan Tsai
Also, on a side note: When using Feeds Extensible Parsers → , an empty response still results in no nodes being deleted or unpublished.
E.g. I have 10 nodes with the feed importer setting "Delete missing nodes". If I then delete all of them (and thus, the response is empty), none of the nodes are deleted.
Don't know if this issue belongs here or on the Feeds Extensible Parsers → module.
- 🇮🇳India bharath-kondeti Hyderabad
@Nathan Tsai
I have missed them, while creating the patch. I will hide the file from #12. Here is the updated patch. - last update
over 1 year ago 535 pass, 5 fail - 🇮🇳India bharath-kondeti Hyderabad
The patch seems to be not failing more test cases. Let me re-work.
- Status changed to Fixed
over 1 year ago 7:42am 7 June 2023 - 🇳🇱Netherlands megachriz
- 🇳🇱Netherlands megachriz
@Nathan Tsai
Also, on a side note: When using Feeds Extensible Parsers, an empty response still results in no nodes being deleted or unpublished.
E.g. I have 10 nodes with the feed importer setting "Delete missing nodes". If I then delete all of them (and thus, the response is empty), none of the nodes are deleted.
For your issue there exist an other open issue: ✨ Add an option to delete all nodes when the feed source is empty RTBC
It is intentional that an empty source doesn't delete everything - to account for the situation where the source was temporary unavailable. The issue there is marked RTBC, but it still needs tests to be accepted.
Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
over 1 year ago 5:22pm 11 July 2023 - 🇨🇦Canada Nathan Tsai
@MegaChriz, thank you for pointing that out. I did not realize that feeds do not import nodes when the response is empty or there are no items.
For future reference, I added the following code for my REST Export to ensure there is always at least one item in my response.
use Drupal\views\ViewExecutable; use Drupal\views\ResultRow; use Drupal\node\Entity\Node; /** * Implements hook_views_post_execute(). */ function HOOK_views_post_execute(ViewExecutable $view) { if ($view->id() == 'MY_VIEW_ID') { // Feeds does not import an empty response. Therefore, add a // dummy feeds item if ($view->total_rows === 0) { $dummyNode = Node::create([ 'type' => 'job_posting', 'nid' => -1, // This is valid because we never save the node 'title' => 'PLACEHOLDER NODE', 'status' => 0, // Be unpublished, so it doesn't appear on the website ]); $view->result[] = new ResultRow([ '_entity' => $dummyNode, ]); } } }
- 🇨🇦Canada Nathan Tsai
Oh wait, my issue was technically different. Removing the "related" issue.