0

I am programatically generating nodes in my local Drupal 6 installation. I have to do it locally because I don't have access to some of the more nifty PHP commands / modules that I need in order to create the modules on the production server.

These nodes come out properly formatted with aliases already created, and I would like to export those to the production server with aliases intact.

I have been attempting to use the Node Export module, however that doesn't preserve aliases (as far as I can see anyway). The Deployment module has never left alpha for Drupal 6, and I have been running into errors while using it. When it did work, aliases were not preserved.

Is there a method to preserve aliases available?

6
  • Please avoid cross-posting the same question.
    – apaderno
    Commented Nov 18, 2012 at 3:43
  • I only cross-posted because it got no love on SO. They closed it as off-topic.
    – erik
    Commented Nov 18, 2012 at 16:46
  • They closed it as off-topic because you asked it in two Stack Exchange sites. You didn't ask on Stack Overflow, and then here when they closed the question there. Two days are not always enough to get an answer, and you can offer a bounty, if you want to get more attention on your question, and obtain an answer. Just don't cross-post.
    – apaderno
    Commented Nov 18, 2012 at 16:52
  • Then offer a bounty I shall.
    – erik
    Commented Nov 18, 2012 at 17:06
  • 2
    Wait before doing it: It could be somebody answers. Even if you really need the answer, wait about a week. Some questions are not so easy as others are, and require time to get answered. Then, bounties are taken from your reputation, but they are the only way to get attention to your questions.
    – apaderno
    Commented Nov 18, 2012 at 17:16

5 Answers 5

1
+50

If you are using D6 why not modify your PHP scripts to generate a .CSV file with the required node information and path aliases, then use the node_import module to import the nodes into the production site.

5
  • I wasn't able to find a specification for how the CSV format should be structured...do you know of any offhand?
    – erik
    Commented Nov 25, 2012 at 22:03
  • The node_import module provides a lot of flexibility for data imports. Generally, each cck field (or unique node variable) should will be a separate column, each row is a new node. The first row should be a header row. You use the node_import wizard to interface to specify the column to node field mapping and look for errors before running the importer. If you use identical field and column names it will correctly set the initial mapping. As for the types of data, this again is trial and error. NID for node reference, date fields need a value even if not required (bug).
    – Rider_X
    Commented Nov 26, 2012 at 0:49
  • This is the best I could get. Unfortunately it doesn't preserve aliases very well, but it gets me 99% of the way there.
    – erik
    Commented Jan 12, 2013 at 21:24
  • Is pathauto overriding any of your specified aliases?
    – Rider_X
    Commented Jan 12, 2013 at 22:01
  • No...I have to manually run it from the Admin panel to get the aliasing to occur at all. Though to me that's fine...it gives me an extra bit of control over the system.
    – erik
    Commented Jan 13, 2013 at 0:13
2

I've successfully used a combination of the following modules to do similar migrations:

  • feeds (for import)
  • feeds_tamper (data normalization and mapping)
  • views_rss or views_bonus (RSS feed of nodes or CSV export)

I can see (although I've never used) a patch for the Feeds module to maintain aliases as found here http://drupal.org/node/1284522

One big bonus with using the Feeds module for import is it understands (through a hashing system) data that has already been imported. So, if you used the ViewsRSS module you can setup a timed event for Feeds to grab only the new or update existing content without having to initiate a transfer on the production server -- they just stay in sync. I've also implemented a workflow where nodes are only published in the RSS feed after they have been reviewed by an editor ...

Cheers,

Rob McCrea

1

In my experience, what I normally do is work on the exact copy of the database locally and then upload the whole database.. isn't this something you might be able to do?

On the other hand, if you are creating everything problematically, can't you execute the PHP code on the server unsing the devel module?

4
  • Unfortunately that's not an option for me. The server I'm using has extremely limited PHP functionality (with no method of enabling it), and that's why I'm generating them locally.
    – erik
    Commented Nov 25, 2012 at 22:04
  • 1
    But exporting an sql dump is beyond any PHP limitation. I would assume that the server you are using has a way to import a dump of a mysql database. If so you can do all the heavy php on your side and then just upload the sql to the server.
    – Mescalito
    Commented Nov 28, 2012 at 20:04
  • Oh, I see your point. That may actually be the easiest thing I can do...
    – erik
    Commented Nov 28, 2012 at 21:21
  • it seems I don't have access to the SQL behind the site, I don't think I'll be able to use this approach
    – erik
    Commented Dec 28, 2012 at 6:57
1

If you have complex data and you have to do the import export several times http://drupal.org/project/migrate might is an option.

Another option might be http://drupal.org/project/content_staging

If you have the possibility the route I would take is:

  • Export & Backup your live site.
  • Put it to maintaninance mode.
  • Download the current live data to your development envoironment.
  • Do the heavy lifting generation tasks locally.
  • Test locally.
  • Deploy the db to your live site.

Drush and backup and migrate can support this a lot. The other mentioned options generally work but every one will take lots of time.

1
  • Interesting procedure...I might have to look into this one
    – erik
    Commented Nov 25, 2012 at 22:05
-1

I know this is an old link but I had a similar issue: I have two drupal systems and I wanted to export nodes from one drupal install and import them into another. When exporting/importing nodes via node-export, the menu links and the node path alias were not getting imported.

I noticed settings on admin/config/content/node_export/ for each content type. There are checkboxes that allow you to "reset the values" of the alias, parent menu, etc. on import. Make sure the items you need are unchecked.

Drupal 7.

1
  • If you have similar problem, then follow the answer and if no answer does not fill up your problem, then ask new question. Commented Dec 4, 2013 at 2:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.