News:

Wondering if this will always be free?  See why free is better.

Main Menu

Converting from Vanilla (MySQL problem)

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

Previous topic - Next topic

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: