mybb / merge-system

The MyBB Merge System allows for easy merging of an existing forum (be it MyBB or another forum software) into a MyBB 1.8.x forum.
Other
32 stars 33 forks source link

[IPB3] Converting Private Messages #195

Open OzWookiee opened 8 years ago

OzWookiee commented 8 years ago

Got the following error when importing our IPB 3.1.4:


Private Message MyBB has experienced an internal SQL error and cannot continue.

SQL Error: 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND map_user_id!=1456 AND map_user_active=1' at line 1 Query: SELECT * FROM TAG_message_topic_user_map WHERE map_topic_id= AND map_user_id!=1456 AND map_user_active=1


Checking the mybb_privatemessages table a single PM was imported 3 times.

Looking in the merge\boards\ipb3\privatemessages.php it appears to be line 102: $rec_query = $this->old_db->simple_select('message_topic_user_map', '*', "map_topic_id={$data['mt_id']} AND map_user_id!={$data['msg_author_id']} AND map_user_active=1");

specifically {$data['mt_id']} has not returned any data SELECT * FROM TAG_message_topic_user_map WHERE map_topic_id= AND map_user_id!=1456 AND map_user_active=1

Looking at the original query and what it returns SELECT * FROM ".OLD_TABLE_PREFIX."message_posts m LEFT JOIN ".OLD_TABLE_PREFIX."message_topics mt ON(m.msg_topic_id=mt.mt_id) LEFT JOIN ".OLD_TABLE_PREFIX."message_topic_user_map mp ON(mp.map_topic_id=mt.mt_id AND mp.map_user_id=mt.mt_starter_id) LIMIT ".$this->trackers['start_privatemessages'].", ".$import_session['privatemessages_per_screen']

mt_id AND map_topic_id can be NULL according to my data (attached exported JSON from phpMyAdmin). TAG_message_posts.zip

I guess this would then mean that you need to check if {$data['mt_id']} IS NULL before running that section?

JN-Jones commented 8 years ago

Odd, didn't know there can be messages without a topic (which doesn't make sense normally). Need to look at the cause and how this should be handled.