News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

YaBB2.1 -> SMF - Personal Messages Problem

Started by JMB, July 25, 2008, 04:37:09 PM

Previous topic - Next topic

JMB

After finally getting the forum converted (many thanks SleePy!), I've noticed that there are some issues with Personal Messages.

First, the date of all members PM's is December 31, 1969, 11:00:00 PM. Looking at the database, the msgtime field has 0 for all PM's for all members.

Second, only PM's in members inboxes where converted. All PM's in outboxes are missing. It also appears that PM's in members PM Storage are missing too.

Any ideas?

ccbtimewiz

That date is the default date when the date cannot be fetched.

I would say I could help you out, but at this point I'm afraid there is little you can do without having to do an immense amount of work.

JMB

Hi ccbtimewiz,

As I'm still in the testing phase, running everything locally, I don't mind doing the conversion from scratch again, if its something that can be fixed by editing the conversion scripts.

JMB

OK, I found an old version of yabb21_to_smf.php I'd used to convert a forum at the beginning of the year. The PM dates converted OK back then, so I compared the two files.

In cstep4, I changed:


'msgtime' => empty($userData[$i][2]) ? (int) $userData[$i][2] : '0',



to:


'msgtime' => $userData[$i][2],



which was in the old file.

I reran the converter and this time it populated the msgtime field properly.

So, that's one thing fixed. Still the Outbox and Storage PM's missing though.

SleePy

Thanks for the first one. the bug was I used "empty" instead of "!empty" in that code.

The converter forces the pms to not show in the outbox, it sets it as deleted by sender.

You can try this, I haven't tested:
Find:
                    'deleted_by_sender' => 1,

Change to:
                    'deleted_by_sender' => 0,

I am not sure of the repercussions of this though without testing it.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

JMB

Hi SleePy.

Yep, !empty works.  :D

I tried changing deleted_by_sender to 0. It populates outboxes with sent messages that haven't been deleted by the receiver. That's a good start!  ;) Is there any way to process the .outbox files and bring all the messages back into the outbox?

SleePy

All messages should be in the outbox now that the user has sent?
That change just tells SMF that the person who sent it didn't delete it, so now it shows in their outbox. So this means every message sent is now showing in their outbox.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

JMB

Quote from: SleePy on July 26, 2008, 02:19:16 PM
All messages should be in the outbox now that the user has sent?
That change just tells SMF that the person who sent it didn't delete it, so now it shows in their outbox. So this means every message sent is now showing in their outbox.

No, because only messages in the .msg files where converted. So that's only messages that members had in their inbox. Those are now in the senders outbox, but some messages are missing from the outbox. The missing messages are ones that the receiver had deleted, so they never got converted as they weren't in the .msg files. Those missing messages are in the .outbox files that don't seem to get converted.

SleePy

Hmm, I don't know how easy it would be to fix that.
The message then no longer exists in the .msg file for the user it was sent to then. So the importing would need to check that out. Or it would need to add more messages into the pms table but force the messages to always either have been deleted by sender or receiver.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

JMB

Yeah, something like that! Sounds a bit tricky, but I'm no programmer.  ;)

Then there is the PM Storage box on YaBB. That's not getting converted either. I would think that would be more simple to do. Just import all the messages in the .imstore files and add them to the users inbox. Looks like the format of the .msg and .imstore files is the same.

SleePy

Are the messages in those files the ones that where missing from the outboxes of the others?
If that is true, then that is a little easier to fix.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

JMB

I'm trying to get the logic of this clear in my head...  ;D

YaBB has an Inbox, Outbox and Storage box for PM's. The Inbox messages are in .msg files, the Outbox messages in .outbox files and the Storage messages in .imstore files.

So far, all .msg files have been converted and messages put in members inboxes on SMF. Then we changed the deleted_by_sender to 0. This made sent messages appear in members outboxes, but only messages that the receiver hadn't deleted. OK, that's were we're at...

The .outbox files, contain all messages that the member has in their outbox, so there will be duplicates with the messages that have already been imported, the ones that the receiver hadn't deleted, the ones that are now in the outboxes. But all the rest of the messages that should be in the outboxes are in this file too.

The .imstore file is like an archive for messages and contains other messages not present in either .msg or .outbox files. As SMF doesn't appear to have an archive/storage bit for PM's, it makes sense that they get put into the users inbox.

I think I understand all that! Does it make sense to you?

SleePy

I think I may have a way to fix it..
Currently working on the yabb 2.2 converter. I will test it out with the new changes once I fix other issues and backport them.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

JMB


JMB

Hi SleePy,

Any updates or news on this issue?

SleePy

I was working on this. Finals is nearby though for the summer quarter so I haven't looked at it much.

You can try it if you want. I can't say if it works for sure as I haven't even tested it.
What I did to the conversion is have it check for either a .msg or .outbox file. If it found one then it worked on that file using a variable to decide if it was in the outbox or not to tell it what to do.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

JMB

#16
Great, thanks SleePy, I'll give it a try!

I've given myself a crash course in PHP and MySQL, so I'm getting the hang of all this.  ;D

So, I may even be able to work a few things out myself!  8)

I'll give it a go and report back.

Thanks again!

JMB

#17
OK, just tried that and it doesn't work. No PM's get converted at all.  :(

The change to this line seems to kill it:


if (strrchr($entry, '.') != '.msg' || strrchr($entry, '.') != '.outbox')


If I change it to:


if (strrchr($entry, '.') != '.outbox')


It converts all the posts in .outbox as expected. But having both expressions with the OR doesn't work at all...

SleePy

Oh, logic error. It should be and :D
            if (strrchr($entry, '.') != '.msg' && strrchr($entry, '.') != '.outbox')

Did it convert them correctly and put them in the outbox of that user btw?
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

JMB

Ah ha! Logic was never my strong-point!  ;D

OK, that's better. The inbox looks fine.

The outbox has messages in it, but not the right ones. They appear to be copies of messages sent to that member that the sender has in their outbox, but with the the member listed as the sender! Does that make sense?

Example for a user called Admin.

In Admin's outbox are 16 messages, all with Admin's name next to them, as you would expect being in Admin's outbox. The messages are not ones sent by Admin, but by other members to Admin.

So, I'm assuming these are all the messages to Admin that are in other members outboxes.

Advertisement: