Welcome, Guest. Please Login or Register.
May 02, 2024, 06:03:16 PM
Home Help Search Log in Register
News: SMF is the next generation in forum software, almost completely re-written from the ground up, make sure you don't fall for cheap imitations that suffer from feature bloat!

YaBB SE Community  |  Development  |  Converters  |  Attachments Conversion - Working on it « previous next »
Pages: [1] Reply Ignore Print
Author Topic: Attachments Conversion - Working on it  (Read 2477 times)
flaco
Noobie
*
Posts: 7


I'm a llama!

Attachments Conversion - Working on it
« on: May 22, 2003, 06:04:48 AM »
Reply with quote

I just converted to YaBBse and notcied the lack of conversion of the attachments.

Not a huge deal to some, but I have about 40000 attachments and it is a crucial part of my board.

The logic and the programming is not an issue, and I will post the slash and burn code for others to use.

I need to know a few things.

Here is a sniblet of the flat text files used by attachments.txt
1043523971|0|Mixed pics|foosh|ICC|184|01/25/03 at 14:46:11|0012.jpg
1043523971|1|Re: Mixed pics|foosh|ICC|162|01/25/03 at 14:49:50|001L.jpg
1043523971|2|Re: Mixed pics|foosh|ICC|137|01/25/03 at 14:55:21|001STRANGE.jpg
1043523971|3|Re: Mixed pics|foosh|ICC|205|01/25/03 at 15:00:31|002Strange.jpg

It appears when the converter pulls in the message, the original ID, that is referenced in attachments.txt is discarded.

Thus it would appear the only logical way of getting the attachments imported, if to grep for your domainname URL for attachments out of the original message data.

So the logic would be: when importing messages out of Messages, import message, grep for the attachments URL, if the attachments URL is there, import the file name, ls $attachments/$attachment-name for file size, import file size, import file name, next Message.

Anyone who has investigated this come to the same conclusion?

The speed os YaBBse is impressive and the elimination of the flat files alone is worth the transition.
Logged
flaco
Noobie
*
Posts: 7


I'm a llama!

Re:Attachments Conversion - Working on it
« Reply #1 on: May 22, 2003, 06:21:30 AM »
Reply with quote

Looking at the messages, there is a sleazier way of doing it, possibly.

Here is the format of  a message.txt file:

Re: New Game <A0>|user71|[email protected]|10/21/02 at 00:32:41|user71|xx|0|10.10.10.22|How come this happens<br><br>||||http://attachments.com/02pub2.jpg|02pub2.jpg

The last two | fields being the URL to the attachment and the attachment name.

If the goal was to just get the attachments imported with no future attachments maintenance possible, it appears the URL for the attachment could be moved back 4 pipes with a <br> <img src=" $attachmentsURL">

This would obviously only work with JPGs and Gifs, and I suppose PDF's, mpg, avi, etc, could be href'd with a generic "Click Here For The Attachment".

Has anyone done something like this already?
Logged
[Unknown]
Global Moderator
YaBB God
*****
Posts: 7830


ICQ - 179721867unknownbrackets@hotmail.com WWW
Re:Attachments Conversion - Working on it
« Reply #2 on: May 22, 2003, 06:32:36 AM »
Reply with quote

You could set the attachmentName field to that of the attachment filename, and you'd be done......... just make sure attachmentSize is non-zero.

-[Unknown]
Logged
flaco
Noobie
*
Posts: 7


I'm a llama!

Re:Attachments Conversion - Working on it
« Reply #3 on: May 24, 2003, 02:38:47 PM »
Reply with quote

Follow these instructions to import your attachments.

You must have a semi reasonable knowledge of vi and mysql to perform this.  Someone who is better with PHP could clean this up tremendously I am sure.

Step One:   vi converter.php

Line#   818    Change to line listed below:
insertIt("{$dbprefix}messages", "(ID_TOPIC, ID_MEMBER, subject, posterName, posterEmail, posterTime,
posterIP, smiliesEnabled, modifiedTime, modifiedName, body, icon, attachmentSize, attachmentFilename)", $insertData, 100);

Step Two:  vi converter.php

Line # 807   Change to the line listed below:
$insertData[] = "($ID_TOPIC, '$posterID', '$messageinfo[0]', '$messa
geinfo[4]', '$messageinfo[2]', '$messageinfo[3]', '$messageinfo[7]', '$messageinfo[9]', '$messageinfo[10]', '$messageinfo[11]','$mes
sageinfo[8]','$messageinfo[5]','99','$messageinfo[13]')";


Step Three:  Import

Step Four:  mysqldump yabbse messages > messages.sql

Step Five:  mysql yabbse (mysql interface - editing yabbse)
drop table messages;

Step Six:  vi messages.sql
:%s/'xx',99,'');/'xx',0,NULL);/g

The above line is kludge, as we imported all of the messages with coverterer.php as all having attachments.   The above search and replace, makes all of the messages that had a file size of 99 but no files name, back to normal messages with no attachments.

Step 7:  mysql yabbse < message.sql
--Pulling the messages table back in with the attachments data intact.

Downside:   All attachments will have a file size of 99.

Upside: You get all of your attachments and all of the speed benefits of YaBBse.

If someone is good with PHP, basically the above needs to be condensed into PHP, with the logic to ls -l a file and get its file size.

Hope this helps others.  It definately works and I have been up and running for 2 days now without issues.

« Last Edit: May 24, 2003, 02:40:07 PM by flaco » Logged
Pages: [1] Reply Ignore Print 
YaBB SE Community  |  Development  |  Converters  |  Attachments Conversion - Working on it « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.030 seconds with 19 queries.