MyBB Community Forums

Full Version: For Dylan - Phpbb2 to Mybb Merger PM issues
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Dylan as we discussed last night regarding that Phpbb merger I did a test run on - there is that problem with the merger and bringing over the private messages.

I had no problem with this.
The board owner had no problem with it, but apparently one of the members does.

Since he teaches computing at some college in NYC, he finds this unacceptable. Apparently the idea of downloading his private messages didn't occur to him nor did the fact that the owner of the site is not his private mailbox.

Anyway, I pretty much told him that on their live board now and hopefully it sinks in. There are hundreds of thousands of PMs to bring over and I just would rather not. It takes me 5 hours to bring the posts over as it is. But if they start to insist, I need to let you know that it may need addressing.

I told them there was no time right now for you to get to this and hopefully they will just download them and let it be. But just in case - how long of a wait can I tell them to expect to have this problem sorted? CAN it even be sorted?
This is already fixed in the dev tree

Bug #1463

And to get the file diffs on it so you can update manually: Revision 4412
Thanks. Hopefully it works!
OK there's no download there. Am I just supposed to compare the files and make the changes in the merger system?
Yup
OK thanks.
Dylan, I'm sorry but I'm totally lost here.

The path that shows in your second link has a "tree" of directories and one starts with "branches" and the other starts with "trunk"

Inside my merger download from this site there is no path like that to find the file. The ONLY privatemessages.php is in Merge > Boards > Phpbb2 and that file does not even have that code in it at all.

What am I missing here?
http://dev.mybb.com/issues/1463

This is the bit of code that does not appear in my privatemessages.php file for Phpbb2

Can you give me the exact file I need to edit?
Double checking I see that code in the file for Phpbb3 but not in 2.

Hope that helps because I'm lost.
OK Sorry to keep posting but I got it figured out I THINK.

I managed the changes to the phpbb2 file and tried to import the private messages.

I'm still getting an error:

Fatal error: Call to a member function query() on a non-object in /home/xxxxx/public_html/bb/merge/boards/phpbb2/privatemessages.php on line 30

It does not seem to be the same issue described in your links, I think.
Its the exact same error. It was originally reported on phpBB3, but its the same misplaced code for both versions of phpBB.

The changes are detailed here, with diff's available. You need the branches/1.6 one, add whats in green and remove whats in red (its just moving the code to be inside the class - its outside the closing } for the class which is why it errors)
http://dev.mybb.com/projects/mybb-import...sions/4412
ah OK. Thanks.


Well, call me thick but if I insert the bits in green and take out the bits in red, I'm not going to have a functional code.

THIS is the phpbb2 privatemessages.php code. All the bits in green are there and if you compare it to the phpbb3 file - it's completely different.

WHAT am I not grasping here?
This is the file I'm looking at from your link:
http://dev.mybb.com/projects/mybb-import...ssages.php

Note: the bits in red and green here are NOT the same as what is highlighted in the link.
<?php
/**
 * MyBB 1.6
 * Copyright © 2009 MyBB Group, All Rights Reserved
 *
 * Website: http://www.mybboard.net
  * License: http://www.mybboard.net/about/license
 *
 * $Id: privatemessages.php 4330 2009-12-16 00:24:29Z RyanGordon $
 */

// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

class PHPBB2_Converter_Module_Privatemessages extends Converter_Module_Privatemessages {

	var $settings = array(
		'friendly_name' => 'private messages',
		'progress_column' => 'privmsgs_id',
	);

	function import()
	{
		global $mybb, $output, $import_session, $db;

		$this->board->db_connect();

		// Get number of usergroups
		if(!isset($import_session['total_privatemessages']))
		{
			$query = $this->old_db->simple_select("privmsgs", "COUNT(*) as count");
			$import_session['total_privatemessages'] = $this->old_db->fetch_field($query, 'count');
			$this->old_db->free_result($query);	
		}

		if($this->board->check_if_done())
		{
			return "finished";
		}

		$output->print_header($this->board->modules[$import_session['module']]['name']);

		// Get number of posts per screen from form
		if(isset($mybb->input['privatemessages_per_screen']))
		{
			$import_session['privatemessages_per_screen'] = intval($mybb->input['privatemessages_per_screen']);
		}
		
		if(empty($import_session['privatemessages_per_screen']))
		{
			$output->print_per_screen_page(1000);
		}
		else
		{
			// A bit of stats to show the progress of the current import
			$output->calculate_stats();
			
			$query = $this->old_db->query("
				SELECT * 
				FROM ".OLD_TABLE_PREFIX."privmsgs p
				LEFT JOIN ".OLD_TABLE_PREFIX."privmsgs_text pt ON(p.privmsgs_id=pt.privmsgs_text_id)
				WHERE p.privmsgs_type IN (0,1,2)
				LIMIT ".$import_session['start_privatemessages'].", ".$import_session['privatemessages_per_screen']
			);			
			while($pm = $this->old_db->fetch_array($query))
			{
				$this->insert($pm);
			}
			
			if($this->old_db->num_rows($query) == 0)
			{
				$output->print_none_left_message();
			}
		}
		$import_session['start_privatemessages'] += $import_session['privatemessages_per_screen'];
		$output->print_footer();
	}
	
	function convert_data($data)
	{		
		$insert_data = array();
		
		// phpBB 2 values
		$insert_data['pmid'] = null;
		$insert_data['import_pmid'] = $data['privmsgs_id'];
		$insert_data['uid'] = $this->get_import->uid($data['privmsgs_to_userid']);
		$insert_data['fromid'] = $this->get_import->uid($data['privmsgs_from_userid']);
		$insert_data['toid'] = $this->get_import->uid($data['privmsgs_to_userid']);
		$insert_data['recipients'] = 'a:1:{s:2:"to";a:1:{i:0;s:'.strlen($insert_data['toid']).':"'.$insert_data['toid'].'";}}'; 
		$insert_data['subject'] = encode_to_utf8($data['privmsgs_subject'], "privmsgs", "privatemessages");
		$insert_data['status'] = $this->get_pm_status($data['privmsgs_type']);
		$insert_data['dateline'] = $data['privmsgs_date'];
		$insert_data['message'] = encode_to_utf8($this->bbcode_parser->convert($data['privmsgs_text'], $data['privmsgs_bbcode_uid']), "privmsgs_text", "privatemessages");
		$insert_data['includesig'] = $data['privmsgs_attach_sig'];
		$insert_data['smilieoff'] = int_to_01($data['privmsgs_enable_smilies']);
		
		if($data['privmsgs_type'] != 1)
		{
			$insert_data['readtime'] = $insert_data['dateline'];
		}
		else
		{
			$insert_data['readtime'] = 0;
		}
		
		if($data['privmsgs_type'] != 2)
		{
			$insert_data['folder'] = 1;
		}
		else
		{
			$insert_data['folder'] = 2;
		}
		
		return $insert_data;
	}
}

function get_pm_status($type)
{
	switch($type)
	{
		case 0:
		case 2:
		case 3:
		case 4:
			return 1;
			break;
		case 1:
		case 5:
			return 0;
			break;
	}
}

?>
I'm sorry, I was giving you the link to phpBB2 when you needed 3?

phpBB3 Fix is in Revision 4403

I was just being thick and stuck on phpBB2 for some reason. doh!
I'm marking this solved. It seems to work now.

Again, thanks Dylan.