Hello Y'all,
Like so many others who is about to use Drupal - I'm going from Cutenews to Drupal. Again like so many of those guys who do that - have a hard time converting the date (news) from Cutenews to Drupal - and I was wondering (hence there isn't a converter yet) - how difficult would it be to make a manual conversion?
What I mean is, that when installing Drupal we have to load the datebase.mysql manually into our databases. Can't you do a similar thing with Cutenews by doing som modifications?
From what I know, the unix-type time-stamp Cutenews uses isn't very suitable for MySQL. I might be wrong - but a simple converstion of the time-stamp can probably be made in Excel or any other spreadsheet with a formula.
I have no knowledge about MySQL - but can't you make an SQL-query or something where you insert the data into exciting tables in the MySQL database?
Jonas
Comments
Migration to Drupal
Actually, it shouldn't be that hard. As far as I can remember, Cutenews stores its data in a flat news.txt file, where each item is stored on a separate line.
I have to get behind my machine to give more specific instructions, but just to get your mind going: you have to do something like this:
* generate a script that loads the drupal core (you can look for devel.module for an example how to do that, namely the utility scripts packaged with it).
* load the news.txt into an array, using file() for example
* for each news item, generate a node object and add it to the database using node_save().
Users can be migrated in similar fashion. It can sound a bit complicated, but actually it is not. Drupal is very flexible.
Details and PHP code - I try to add them here. Try to invent something too, www.drupaldocs.org is your friend, as is (of course) www.drupal.org.
Good luck!
Sweet
As i mentionen most SQL is mumbojumbo to me - but I kind of understand what you say - it was exactly what I had in mind. ;o)
However, I can't do it - my skill simply aren't there - but if you could take som time then it would be awsome.
By the way, yes CuteNews stores the data in a flat file.
Jonas
Some additional information
Can you please give me a working example of 'users.db.php' and 'news.txt' files from the 'data' directory, so I can put together a migration script? It could be useful to others too, because CuteNews is quite widespread.
You can attach them right here.
Examples
Here are some examples from the CuteNews db files.
users.db.php
unix_time_stamp|type_of_user|login|password|user_name|email_address|amount_of_posts|unknown||last_login||
news.txt
unix_time_stamp|login|headline|news_content|||category||
I hope this helps a bit.
A basic migration script
I put something together. It is able to migrate users, categories and articles, also correctly connect users and categories to news articles. Doesn't include comments (yet). If it is needed, I can add this. Should be a quickie.
Explanations are in the source.
Looks good
Looks good - but how do I run it? And should the file have a specific name?
Should be simple
You have to have a full working Drupal installation.
* Log in as user with ID 1 to Drupal (the first user you created).
* Place this script in the root of your drupal installation (the directory with subdirectories like modules/, includes/, misc/ etc). Name is not important.
* Configure it. The only directive you really have to configure, is the CUTENEWS_DATA_PATH. That's the location where Cutenews data is stored, relative to this file.
* Run the script through your browser. It should do what advertised and print out a summary.
Hmmm not working
I must do something wrong - it simply doesn't work.
My CuteNews is stored under
http://www.domain.com/cutenews
And my Drupal is stored under
http://www.domain.com/cms
Therefore my CUTENEWS_DATA_PATH should be set to "http://www.domain.dk/cutenews/data" or "../cutenews/data" right?
JonasB
to '../cutenews/data',
to '../cutenews/data', indeed.
what does it say?
Blank Screen
The configuration seems to be properly set up. But I get a blank screen when I try to run the script. I've placed it in a file, which I so cleverly has named 'cutenews.php' :-)
However, I think I'm the problem here - since I'm not sure if I misunderstand you. When you say run it - it think that I log on to my Drupal using my admin password. And when I'm logged on to Drupal - it write the address http://www.domain.com/cms/cutenews.php in the address field in my browser and simply run it like I would do if I logged on the any other website. This might be where I'm wrong. Is there a special feature in Drupal where you can run scripts? Or should I do it in phpMyAdmin?
Should my username and password in Drupal be identical with the one I use on Cutenews?
JonasB
Strange
You are doing everything right.
This is strange, I tested it just a minute ago with a fresh install of Drupal 4.7 beta 4 and a fresh install of Cutenews 1.4.1. What versions are you using?
Secondly, look through the Drupal error log. Are there any errors connected to your cutenews.php file (the file you put your script in)?
The latest stable
I'm rurrently using the latest stable release of Drupal. 4.6.something - not 4.7 that might be the reason.
Is it saw to upgrade to 4.7 - even for a rookie like me? :-)
My log doesn't say anything. Can't even see I tried to run the cutenews.php file.
I really appreciate your help.
JonasB
Hmm
Try to upgrade to the latest beta (beta 4 that is). You have almost nothing to lose, moreover, freetagging and a kazillion cool features to win.
Yes
Works like a charm... Thanks a whole buch - this is a great tool. :-)
Now I just need the internationalization (i18n) to work with 4.7.0-beta4 :-)
JonasB
Thankyou!
Thanks so much for this script. It worked perfectly. Saved me a lot of time.
doesn't work in drupal
doesn't work in drupal 6
Fatal error: Call to undefined function db_next_id() on line 143
changed it to $node_id = db_last_insert_id('node','nid');
and it works.
any support for this? I
any new updates or support for this? I installed drupal 6.15 and i get this error when trying to run the script
Fatal error: Call to undefined function module_exist() on line 82
i check the file and line 82 is
if (MIGRATE_CATEGORIES && count($categories) && module_exist('taxonomy')) {
Have you solved this error?
I'm trying to transfer my database from CuteNews to Drupal 6.20, and found the same error. It is interesting to let the solution recorded here.
If anyone has any other solution, help me, please.
Thanks.
Astuto (Sergio)
CuteNews to Drupal: I got it! I need help!
Hello my friends.
Today I managed a small advance by importing data from CuteNews to Drupal.
I will share part of my success with friends, but I need help. Come on.
1) I have reviewed the code provided above and I perbes some functions that are there simply have been replaced in version 6 of Drupal. So I replaced by the equivalent versions, according to the rewritten code below.
Code:
Notes:
a) The above code I saved with the name cutenews.php at:
C:\wamp\www\drupal\cutenews.php
b) The above code will need to be modified according to the installation of each user.
2) As you can see, I'm still running my version of Drupal on localhost. So I downloaded the folder 'data', existing within my CuteNews directory on the web, to my pc. The path to the folder it was this way:
C:\wamp\www\drupal\cutenews\data
That done, I logged in Drupal and I ran the file 'cutenews.php' in the browser.
Users, the categories and stories have been imported into Drupal.
As I still had no news on my site, now the news imported are displayed on the front page.
Despite the success of importing the data, some unwanted characters were also brought to the new articles and I'll need to edit each one to the exclusion or Replacing these characters.
That occurs when I try to edit these articles, I get the following error message:
"warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'story_node_form' not found or invalid function name in C:\wamp\www\drupal\includes\form.inc on line 378."
I believe this is very important since many users of CuteNews not only migrated to Drupal yet, lack of resources to import data. I see this as a great breakthrough because it still had not found anything concrete that would allow me to such importation.
Can anyone help me decipher the above message and correct the error, so I have opportunities to edit any imported content?
Thank you in advance.
Astuto (Sergio)