Add an action to bulk import feeds

Created on 20 April 2019, over 5 years ago
Updated 30 May 2023, over 1 year ago

Problem/Motivation

When you want to import content for multiple feeds, it would be handy to be able to select the feeds you want to import content for at admin/content/feed and apply an action to them to trigger an import for them all.

Proposed resolution

An action plugin and a kernel test that covers the action plugin should be written.

The action plugin

Add a file to src/Plugin/Action and implement an action plugin that triggers the batch import for every feed that is passed to the action plugin.
The action plugin should call startBatchImport() on the feed.

The kernel test

The kernel test could be written as follows:

  1. Create feed type. I think using the parser "syndication" (for parsing RSS feeds) is the easiest for this test.
  2. Create two feeds: one for which drupalplanet.rss2 is selected as a source and another whose source is googlenewstz.rss2. These RSS feeds are found in tests/resources/rss.
  3. Apply the action plugin.
  4. Assert that content for both feeds was imported.

Remaining tasks

  1. Write an action plugin
  2. Write a kernel test that covers the action plugin

User interface changes

New entry in the 'With selection' dropdown menu:

Original report by SocialNicheGuru

On admin/content/feed, I only have the option to delete feeds.

Is there a way to bulk import feeds or to update them all?

Feature request
Status

Fixed

Version

3.0

Component

Code

Created by

🇺🇸United States SocialNicheGuru

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇱Netherlands megachriz

    I've got Add an action to bulk delete imported items Fixed ready for review. I plan to pick this one up as well now, and base it on the code introduced by the other issue.

  • @megachriz opened merge request.
  • Status changed to Needs review almost 2 years ago
  • 🇳🇱Netherlands megachriz

    This is ready for review.

    • MegaChriz committed 5fceea18 on 8.x-3.x
      Issue #3049631 by MegaChriz: Added an action to bulk import feeds.
      
  • Status changed to Fixed over 1 year ago
  • 🇳🇱Netherlands megachriz

    I merged the code!

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed over 1 year ago
  • 🇮🇹Italy kopeboy Milan

    Great! Thank you @MegaCriz !!

  • 🇮🇹Italy kopeboy Milan

    Is it possible to add the "Import in background" action as well?

  • 🇳🇱Netherlands megachriz

    @kopeboy
    I had thought about that, but the issue is then that the order in which imports run could feel a bit random. When you would start multiple background imports at once, these imports are kinda run in parallel. This is namely how that would work:

    1. Import feed 1 planned.
    2. Import feed 2 planned.
    3. First chunk of feed 1 gets imported.
    4. First chunk of feed 2 gets imported.
    5. Second chunk of feed 1 gets imported.
    6. Second chunk of feed 2 gets imported.

    and so forth. So this is not pure in "parallel", but imports for multiple feeds alternate.

    The chunks can also differ in size. So maybe the import for feed 1 takes more time to process, so a single chunck for that could be 50 items on average, while for feed 2 it could be 150 items on average per chunk.

    But of course we could "fix" all this with a message "Background imports run in parallel" or something similar.

    Do you want to create a new issue for this, @kopeboy?

Production build 0.71.5 2024