Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By MattBridger777 on
Hi guys,
I'm looking to migrate a site that has a property listing. The data for the property listing is done via an FTP import of one or more XML files that updates once every hour or so.
I'm quite taken with Drupal and would like to use it to manage the site, however I don't know if there's any module or such that is capable of doing hourly grabs of property data over FTP.
Is this possible in Drupal or would I have to code something outside of drupal and use a cron job to import the data?
My thanks for any and all assistance given,
~Matt
Comments
Check out the Feeds module,
Check out the Feeds module, it's excellent for this sort of thing: https://drupal.org/project/feeds
You can schedule imports, map XML to Drupal node fields. The. Just expose all the juicy data using views. :-)
Feeds is brilliant... but...
Found Feeds and it's brilliant and all.
There appears to be one rather significant problem however and that's that its FTP plugin doesn't appear to work. At the very least it appears to have a problem when the directory in the FTP settings is "/".
When the file its importing from is local, then it all works fine. But I need to be able to FTP the file from its origin to a local folder in this case.
I managed to use PHP's ftp_get() function successfully to copy the required file from source to the local destination. However this needs to be run every hour.
So my next question, if the FTP plugin for Feeds doesn't work, is there a way for me to run ftp_get() using cron, and if so can someone detail to me how I'd accomplish this?
My thanks and appreciation of any and all help given,
~Matt
I'm not sure about any Feeds
I'm not sure about any Feeds FTP issue, you'd have to look at the issue queue on the project page for that :-)
You can use hook_cron() for your scheduled tasks:
You'll have to forgive me if
You'll have to forgive me if I ask you guys to spell this out for me in big, bold letters, but I am quite new at this.
I'm assuming that I put this cron function in template.php (which I have done). A copy of this you can see below, where my theme is called "adorecardiff" :-
After clearing the cache and running cron, nothing happened. I even tried removing the entire contents of the function and just replacing it with a watchdog statement saying "in here?" which also did not appear in the logs.
Have I missed a step or done something wrong?
My thanks for your patience and assistance,
~Matt
No worries, You actually want
No worries,
You actually want to use hook_cron in a module file. :-)
Create a little custom module with your hook_cron implementation and you should be good to go.
Creating a module Docs: https://drupal.org/node/361112
Enjoy! :-)
*revelatory* Ah ha. Now I
*revelatory* Ah ha. Now I see.
Thanks for that.
Since I'm so new to this I haven't had cause to get involved with module building and so it never occurred to me that was what you meant in the earlier comments.
Cheers muchly, I shall try it out.
~Matt
No worries, I should have
No worries, I should have been more specific. :-)