Converting from Vanilla (MySQL problem)

Started by Phizinza, October 01, 2008, 07:46:33 PM

Previous topic - Next topic

Phizinza

I'm trying to convert over to SMF from my Vanilla, just a testing convert at the moment. So I have my MySQL database for Vanilla and I have one for the test forum. When I try and convert it says it needs user access to the vanilla forum or what ever. I couldn't find how to create a user for the SMF database in the Vanilla database so I asked my host provider (DomainRightNow) and they said because of "shared hosting" I cannot have that feature. I remember making sure I had a dedicated linux server and not their shared option but it must be shared mysql or something I guess?
Anyhow, back to SMF. How can I convert my Vanilla to SMF with this problem? Can I put SMF in the same database? Will this cause problems, screw up my old forum which is still in use, or slow things down?
Thank you.

SleePy

As long as you use different prefixes you will be fine.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Phizinza

Is this something I have to make sure of when installing SMF or what? My knowledge in MySQL is limited at best, same with all this scripting and php. I'm no wiz at any of it so please bear with me. Thanks

ThorstenE

while installing SMF you can choose a table prefix for your SMF.. the default value is smf_ (tables are named like smf_members, smf_categories, smf_attachements and so on)

this prefix must be different from your vanilla installation.

Phizinza

Cool, cheers guys I'll install it again and see how the conversion goes then. Thanks

ThorstenE

Phizinza, Do you still need help with this?

Phizinza

I still haven't got around to it. Had a big week leading into a race on the weekend. I've got a lot of video and photos to go through before I can work on the website. I'll give it a go soon though and see how I go.

Phizinza

Ok. I've got around to working on this again. I installed SMF in another folder but put it in the same MySQL database as My Vanilla installation. I run the converter and I get this

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/content/P/h/i/Phizinza/html/phizinza/forum/convert.php on line 799

Notice: Undefined index: DATABASE_TABLE_PREFIX in /home/content/P/h/i/Phizinza/html/phizinza/forum/convert.php(407) : eval()'d code on line 1

And then in red box this:
Sorry, the database connection information used in the specified installation of SMF cannot access the installation of Vanilla. This may either mean that the installation doesn't exist, or that the MySQL account used does not have permissions to access it.

The error MySQL gave was: Table 'phizinza.User' doesn't exist


I still get very confused looking at all this stuff. But I get a feeling where it says "Table 'phizinza.User' doesn't exist" there is something wrong there. Shouldn't it be 'phizinza' not phizinza.User? Because my databases name is only phizinza and the user name for the database is only phizinza. I dunno. Anyhow if someone could help me out and tell me what I'm doing wrong please do..

I've just spent 3 and a half hours making a theme (editing someone elses) so I would like this to work.

Thanks!

ThorstenE

#8
phizinza.User means: databasename.tablename

Can you pleae check with phpMyAdmin ( What is phpMyAdmin? ) if the table named Users in your database exists? maybe it's an uppercase problem because the table is named "users" (not "Users")

Edit: noticed a similar problem, maybe it's an bug in the convert.php you are using.. try the convert.php attached on this topic:
http://www.simplemachines.org/community/index.php?topic=140741.0
(is attached, scroll down)

Phizinza

#9
Only tables that are close to User are:
LUM_User
poc_user_account
poc_user_data
poc_user_groups
poc_user_notes
wp_usermeta
wp_users

Is it looking for the table of SMF or Vanilla "User"?

ThorstenE

#10
the table check at the beginning is for the vanilla users table..
---~ settings: "/conf/database.php", "/conf/settings.php"
---~ from_prefix: "`$Configuration[DATABASE_NAME]`.$Configuration[DATABASE_TABLE_PREFIX]"
---~ table_test: "{$from_prefix}User"

the converter reads the /conf/database.php and /conf/settings.php and builds then the db.tablename infos..

can you open both with a text-editor and check for
$Configuration[DATABASE_NAME]
$Configuration[DATABASE_TABLE_PREFIX]


Phizinza

#11
There is a $Configuration[DATABASE_NAME] in vanilla's conf/database.php but no $Configuration[DATABASE_TABLE_PREFIX] in either of the of the files.
Do I need to put it in, or what?

I found this http://lussumo.com/community/discussion/8774/two-vanilla-forums-using-the-same-user-table-for-both/
Looks like I might need to "add" it

ThorstenE

the configuration.php from vanilla seems to be modified in their new version..
edit it and append this line (before the closing php-tag ?> )

$Configuration['DATABASE_TABLE_PREFIX'] = 'LUM_';

the block at the end of that file should look like:...
$Configuration['DATABASE_CHARACTER_ENCODING'] = 'utf8';
$DatabaseTables['User'] = 'LUM_User';
$Configuration['DATABASE_TABLE_PREFIX'] = 'LUM_';
?>


Phizinza

My Vanilla install doesn't have a configuration.php file.

Phizinza

#14
I put the $Configuration['DATABASE_TABLE_PREFIX'] = 'LUM_'; in database.php and it worked.. but didn't. It thru this error:
-------
Converting members... Successful.
Converting boards... Successful.
Converting topics... Successful.
Converting posts... Unsuccessful!
-------
Theres more to the error, should I post it up, its quite lengthy

It says this at the end
"Caused the error:

    Duplicate entry '6198' for key 1"

Most of the error is parts of recent posts

EDIT::: It looks like all the posts have come over, but aren't in their categories. When you go posts by user you can see all the posts.

Phizinza

#15
Its also picked up "real names" on some users and replaced the username with the real name. I might have to go through vanilla and delete all the real names?
I think I found the problem, first names and last names Fields come before the user name fields.. I wonder if I could just delete the data from the First names and Last name fields without screwing vanilla up?

ThorstenE

Try the attached versions.. I'v fixed the messages-conversion and replaced the member's real name conversion with their login-names

Phizinza

Mate!!! That done the trick!

I assume there is no way to converting the "attachments" over as well?

Do you have PayPal TE? I would like to buy you a drink!
Thank you so much.

ThorstenE

the converter does not convert attachments at this time but maybe this feature can be implemented.. I can take a look it this later this day..

Phizinza

Quote from: Phizinza on November 01, 2008, 03:14:15 AMDo you have PayPal TE? I would like to buy you a drink!
Thank you so much.
I'm serious about that mate!


Phizinza

I'll try but I'm not good with php so I don't know how good I will be. Cya around

Phizinza

#22
Ok.. Could you please help me make the converter bring the Avatar's from Vanilla over as avatar's instead of copying the account picture as an avatar? I'm sure it's easy but I don't know where to look for it.

edit: I may have spoken to soon. I opened vanilla_to_smf.sql and found Avatar in there. It said *m.Picture AS Avatar*. I looked in my MySQL database and found that Icon was the one with the avatar pics and Picture has the account pictures. I haven't tested it yet but I will in a couple of days.

I'm still testing and setting it up, so I have to 'convert' it when I'm ready to put the new forum in place of the old one. Talking about that, when I 'convert' it again will it just delete all the old posts and replace them with new ones? Also does it erase settings I have for things like how many posts per page?
Thanks


edit2: Sorry, I'm just full of questions.. If the Vanilla install has its attachment file names in the MySQL stored under "LUM_Attachments" then "Path"
And the SMF has it under "smf_attachments" then "filename"
does this mean I can put a
TRUNCATE {$to_prefix}attachments;
---* {$to_prefix}attachments
SELECT
m.Path AS filename
FROM {$from_prefix}Attachments AS m;
---*


?

SleePy

yes, that could be done.

But there are some issues with doing that with the attachments table.

  • Attachments are not moved to SMF
  • They are not being linked to to their posts (although you could do that by adding more complications to the query there
  • The file name is not encrypted. It is Preferred the file name is encrypted for security reasons.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

ThorstenE

Phizinza,

try this for the attachments (add at the end of vanilla_to_smf.sql:
There are different attachments plugins for the vanilla, don't know which one you are using..


/******************************************************************************/
--- Converting attachments...
/******************************************************************************/
TRUNCATE {$to_prefix}attachments;

---* {$to_prefix}attachments
---{
$no_add = true;
$keys = array('ID_ATTACH', 'size', 'filename', 'ID_MSG', 'downloads');

$newfilename = getAttachmentFilename(basename($row['filename']), $ID_ATTACH);
$pos = strpos($row['filepath'], 'uploads');
$row['filepath'] = substr($row['filepath'], $pos, 999);
$oldfile = $_POST['path_from'] . '/'.$row['filepath'];

if (file_exists($oldfile) && strlen($newfilename) <= 255 && copy($_POST['path_from'] . '/'.$row['filepath'], $attachmentUploadDir . '/' . $newfilename))
{
@touch($attachmentUploadDir . '/' . $newfilename, filemtime($row['filename']));
$rows[] = "$ID_ATTACH, " . filesize($attachmentUploadDir . '/' . $newfilename) . ", '" . addslashes(basename($row['filename'])) . "', $row[ID_MSG], 0";
$ID_ATTACH++;
}
---}
SELECT CommentID AS ID_MSG, Title as filename, Path as filepath
FROM {$from_prefix}attachment;
---*


Phizinza

Cheers, I'll give that a go. I'm using "Attachments  2.1" by  Maurice (Jazzman) Krijtenberg  www.krijtenberg.nl


Phizinza

---}
SELECT CommentID AS ID_MSG, Title as filename, Path as filepath
FROM {$from_prefix}[b]a[/b]ttachment;
---*

I had to change that code to Attachments, then it said it was successful, but it didn't work as the attachments don't show on the new forum. It did however copy all the images over to smf but with names like
318_ford-gt-back_jpg288d1662754eb26430d7e16ae6cd81f2
Instead of
ford-gt-back.jpg

But I think the main problem is the posts don't have any attachments on them so they aren't even looking for the images?


ThorstenE

have you checked this after login to SMF? attachments are by default only visible for registered users.. the copy is implemented in my above solution.. you can also check the table smf_attachments. are there any entries?

Phizinza

Quote from: TE on November 04, 2008, 06:33:19 AM
have you checked this after login to SMF?
I'm such a lame brain! Yes, they are working. Except no thumbnail and why does the browser (IE7 and FF 3) require you to download the image to view it from the link supplied?

ThorstenE


Phizinza

I put that file in the root directory of the forum and ran it. Came up with a heep of successful things and then that all disappeared. I went to a thread with attachments and no change.
Here is the thread which has attachments from the old Vanilla on the first post and on the last post on page 3 there is an attachment that works which was made with SMF. http://phizinza.com/forum/index.php?topic=366.0
You can login with username "Test" and password "bananas"

This isn't an issue really. The attachments are there and view able. Just a miner problem really.

Got most of the things sorted out now... Almost ready to move it over to replace the old forum. How would you suggest that? I have it at phizinza.com/forum and I want it at offroadingsubarus.com. These websites use the same hosting and offroadingsubarus.com is under /webmaster while phizinza.com is under /phizinza. Can I just adjust the SMF installation in the Admin to the new address and copy all the data over to replace the Vanilla installation?

ThorstenE

changing the folder / domain is not difficult, you should use repair_settings.php from our downloads page.. What is repair_settings.php?

Advertisement: