Closed (outdated)
Project:
Feeds
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
9 May 2011 at 18:53 UTC
Updated:
9 Feb 2026 at 19:11 UTC
Jump to comment: Most recent
Comments
Comment #1
emorency commentedI found a way to add default content when drupal is installed using an importer. Maybe someone will be interested by this...
I have a custom profile and I wanted to load default content stored in csv files when a site with this profile we being installed. This is what I added to the file custom_profile.profile. The following adds a new installation task that imports content in batch mode. It supports importing multiple files with their own feeds importer.
Comment #2
pcambraI couldn't make it work with startimport() programatically either.
I reached a similar solution to yours but with several batches:
Comment #3
cosmicdreams commentedThank you both, this sample code is extremely helpful!
Comment #4
twistor commentedPerhaps this should be added to the docs.
Comment #5
pcambraI'd happy to add this to the docs, but I'd need confirmation which is the right way to do so
Comment #6
DjebbZ commentedBumping the issue : is this the proper way to do ?
And a question : can we include similar code in a hook_cron ?
Comment #7
pontus_nilssonI have done a somewhat different approach. I create a feeds node with an external feed as source, save the node and start the batch. Maybe someone finds this useful. The feeds importer is exported through features, so is the target content type and the "feeds" content type. After the installation I can point remove the imported nodes, change the source feed and create some other nodes.
Just to be clear this is how I setup my installation task in the installation profile.
Comment #8
saritha.peddapuli commentedi got error saying that "Download of failed with code -1002."
Please help me. I want to import multiple xml files using cron.
Comment #9
pcambraSee #608408: Drush integration for Feeds as an alternative of importing feeds from command line.
Comment #10
saritha.peddapuli commentedThanks pcambra.
how can i give the folder name instead of single xml file. I want to execute a php script with cron, in that script i want to import all XML files in a folder.
How can i use Drush integration. I mean which patch should i install or any documentation/steps needed.
Thanks in Advance
Comment #11
saritha.peddapuli commentedHi pcambra,
I am using following code to import multiple files, but it importing a single file(first xml file).
Can you please help me to import all files in a directory
Thanks
Sari
Comment #12
pcambraI'd say you can't just throw stuff to the batch api like that, you probably need to do some DrupalQueue for that, good thing is that queue is integrated with cron for D7.
Comment #13
saritha.peddapuli commentedThanks Pcambra.. i will try to use DrupalQueue
Comment #14
POVYLAZZZ commentedIf you have succeeded in importing from multiple sources could you share the solution?
I have tried using DrupalQueues but it resulted in executing just the first source.
Comment #15
toby wild commentedBit of an old issue, but I hope this helps someone.
So my case is syndicating content from an Intranet to an Extranet on different servers.
The Intranet exports XML files and SFTP's them to the Extranet server.
Then I run:
This imports the two XML's one after the other.
POVYLAZZZ, if you are looking to import from multiple sources, simply make the $filename variable only contain the $file variable from the Array and put the full path in there instead.
One issue I do still have is that I can't import the same file twice.
This is an issue for me as the People have an entity reference field that reference other 'People', so if it looks for the reference and the Person hasn't been created yet, then it throws a Warning.
So I import it twice, once to import, once to confirm the Reference.
However, having two entries of ''people' => 'people/people.xml',' doesn't import it twice.
My work around is that I run the whole snippet twice.
Comment #16
merilainen commentedWould you mind explaining where is this code placed? How do you run it?
Comment #17
tim_marsh commentedIve found this thread after researching , maybe this answer Ive just posted will help you / someone : http://drupal.stackexchange.com/a/153434/41701 , basically if you're running this from the ui / form hook - thats fine, but if you're using it in an install , then you can either use drush, or call feeds api calls directly, bypassing the need for the batch api.
so , in a hook_install, you can call something like this.
the reason being
batch_process('import/people');is saying redirect me to import/people ... which it doesnt make sense to do in the command line / install situationComment #18
Bhaskar J commentedHi,
Is Feeds importer module works on localhost?
Comment #19
bluegeek9 commentedDrupal 7 reached end of life and the D7 version of Feeds is no longer being developed. To keep the issue queue focused on supported versions, we’re closing older D7 issues.
If you still have questions about using Feeds on Drupal 7, feel free to ask. While we won’t fix D7 bugs anymore, we’re happy to offer guidance to help you move forward. You can do so by opening (or reopening) a D7 issue, or by reaching out in the #feeds channel on Drupal Slack.
If this issue is still relevant for Drupal 10+, please open a follow-up issue or merge request with proposed changes. Contributions are always welcome!