I think something like Bèr is suggesting is probably the best way to go.
I suppose another approach is to write a script that talks directly to the web interface (a reasonable option if you are Perl programmer trying to avoid learning PHP, for example :-). I did such things a number of years ago for testing a web app. I had some Perl code that made HTTP requests to the server and parsed the relevant parts of the responses. Nowadays, I'm sure there are tools that will handle much of the dirty work for you. Sure, it'll be slower than writing directly to the database (which I agree is a bad idea, btw) or using some command-line Drupal code like Bèr suggests, but it should be relatively safe and it does satisfy the goal of automating the process.
Ray
On Jul 4, 2006, at 10:06 AM, Bèr Kessels wrote:
Have a look at sympal_scripts http://cvs.drupal.org/viewcvs/drupal/contributions/tricks/ sympal_scripts/
It contains an easy way to include Drupal on commandline.
Some form of insert content script is on my todolist, but not done yet.
in any case, including Drupal with sympal scripts is not hard, and after that you can simply say: node_save($node) to save your node object.
Anything else *will* break, talking directly to the database is a very bad idea, since a lot of modules have data that is inserted when they are called by node_save()
Bèr
Op zondag 2 juli 2006 17:45, schreef dondi_2006:
Hello,
Some days ago I had asked on this list how to add content in Drupal from the mysql command line. I only got one suggestion to try the import_HTML module (http://drupal.org/node/46008) but it really seems an overkill, and not the best approach to what I have to do.
I had also asked how to do the same thing in two different ways in the forums: http://drupal.org/node/62954 http://drupal.org/node/68605
without result so far: no feedback from others who posted, who I contacted directly, no usable documentation I could recognize, nothing...
Honestly, I can't believe this has never been done before: What I need to do is something that (OUTSIDE Drupal) reads a .txt file like this:
ARTICLE_CATEGORIES="travel/england/london, food/foreign/restaurants" TEXT="path/to/some/local/html/file/" CREATED_ON_DATE="YYYY/MM/DD" AUTHOR="John Doe"
etc etc.... (other variables like, for example, "create_a_forum_for_this_node")
and upload the node inside the Drupal database, just if I had inserted everything by hand in the proper drupal form.
I don't want to do it via drupal because I need this to happen regularly and automatically (say, a cron job on my home PC which publishes via ssh whatever file in $DRUPAL_CONTENT folder changed in the last hour): it's not a one-time job.
I've also tried to look for scripts doing this via the blogger API (or usable documentation on how to write them so they _are_ drupal compatible): nothing.
What am I missing? Is it really possible that everybody is happy pasting and changing stuff manually in a tiny textarea, EVERY darned time some node must be added or updated??
Thanks,
O.
-- [ Drupal support list | http://lists.drupal.org/ ]