Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-09-18 09:03:02

Robert L.
Member
From: Amsterdam, Netherlands
Registered: 2006-07-04
Posts: 20

Uploading massive amount of articles through MySQL

For three sites I am building, an e-commerce wine site, a site for a videostore and a site that features a lot of clothing stores in the Netherlands, I would rather upload all the articles that are already available directly into the MySQL database than putting them in the systems manually through the TXP admin interface.

It is not a problem for me to realise that technically, only the database field “uid” gives me some trouble. How can I “calculate” the articles’ uid so I can do a massive upload of “working” articles?

Last edited by Robert L. (2006-09-18 09:03:37)

Offline

#2 2006-09-18 09:09:31

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: Uploading massive amount of articles through MySQL

uid='".md5(uniqid(rand(),true))."'

It is used in the unique identifier for atom-feeds.

Offline

#3 2006-09-18 09:22:08

Robert L.
Member
From: Amsterdam, Netherlands
Registered: 2006-07-04
Posts: 20

Re: Uploading massive amount of articles through MySQL

Thank you Sencer for your quick response.
But, I now have an excel file with > 1000 articles, each needing a uid. Not being a php-wizard, how do I give each line a uid using your suggested php-function?

For instance, studying the sql for a fresh txp site, the first post article has its uid already filled out

When not planning to use atom-feeds, is it a terrible thing to omit the uid’s?

Your expert response is highly appreciated!

Offline

#4 2006-09-18 09:39:01

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Uploading massive amount of articles through MySQL

The md5 string is nothing but 32 hexadecimal characters (0-9 and a-f)…. so if you can create a column in Excel and fill that with increasing numbers, starting with 12345678901234567890123456789012, increase by one for each next article. That gives you valid md5 strings.
Normally you’d want to see them spread out a bit more, but chances of md5 collisions are very small if it’s just 4000 articles.

Last edited by ruud (2006-09-18 09:42:05)

Offline

#5 2006-09-18 09:40:06

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: Uploading massive amount of articles through MySQL

Oh, it’s just a randomly generated hexadecimal string with a length of 32 characters. With Excel you can probably do it easiest by just generating random numbers of that length.

Offline

#6 2006-09-18 09:41:30

Robert L.
Member
From: Amsterdam, Netherlands
Registered: 2006-07-04
Posts: 20

Re: Uploading massive amount of articles through MySQL

Great! I will do that.
Thanks Sencer and Ruud.

Offline

Board footer

Powered by FluxBB