Solved: 7 Years, 7 Months, 3 Weeks ago phpbb3 -> mybb1.8 with merge 1.8.1
#1
Solved: 7 Years, 7 Months, 3 Weeks ago
Hi there,

we've recently moved out forums from phpbb to mybb as we found it's generally better for customizations (even though we've a considerable performance drop on the server side).

The actual problem is that we've had serious problems with the user migration - out of about 2600 users (with SELECT COUNT(*) FROM phpbb_users) we've missed 250 or so, and after a couple retries we've reduced this to about 45 users.

Next up is the emoticons. PHPBB apparently stores emoticons like

<!-- s:saveme: --><img src="{SMILIES_PATH}/d33561e9.gif" alt=":saveme:" title=":saveme:" /><!-- s:saveme: -->

for emoticon :saveme:. However these were left in the above state in our forums after the migration.

I've been trying to create a PHP file to update the contents of the already migrated posts (matching up username and dateline, which works perfectly) after a few more lines of regex, but I fail to make it work ^^
Reply
#2
Solved: 7 Years, 7 Months, 3 Weeks ago
I hate the way phpbb stores messages -.- I'll take a look at those emoticons sometime this week, depending on when I've time.

About the users: phpbb also saves bots in the user table (group I'd 6) which are excluded from the merge. Also there's an user named "Anonymous" which is also ignored. If you exclude those users the number of users should be the same.
Support PMs will be ignored!
Reply
#3
Solved: 7 Years, 7 Months, 3 Weeks ago
(2014-11-02, 09:11 PM)Jones H Wrote: I hate the way phpbb stores messages -.- I'll take a look at those emoticons sometime this week, depending on when I've time.

About the users: phpbb also saves bots in the user table (group I'd 6) which are excluded from the merge. Also there's an user named "Anonymous" which is also ignored. If you exclude those users the number of users should be the same.

Thanks, though we still missed about 200 normal users on the first try.

On a sidenote, you don't import avatars, but I'd do a check on phpbb's settings and if avatar uploading is disabled, I'd migrate avatars with

UPDATE mybb_users, phpbb_users
SET mybb_users.avatar = phpbb_users.user_avatar
WHERE LOWER(phpbb_users.username) LIKE LOWER(mybb_users.username);

The moderator rights also don't come through properly as we most of our moderators never had the right to view IPs, but they had it after the merge.
Reply
#4
Solved: 7 Years, 7 Months, 3 Weeks ago
It's planned to add an avatar module in 1.8.2. Though your query might work for you it may fail for others. especially when merging to another server. And there are different avatar types: URL, upload and gravatar (not sure whether phpbb supports the latest)

Edit: moderator permissions aren't merged at all, only forum permissions (though that module is broken in 1.8.1)
Support PMs will be ignored!
Reply
#5
Solved: 7 Years, 7 Months, 3 Weeks ago
(2014-11-02, 09:23 PM)Jones H Wrote: It's planned to add an avatar module in 1.8.2. Though your query might work for you it may fail for others. especially when merging to another server. And there are different avatar types: URL, upload and gravatar (not sure whether phpbb supports the latest)

Edit: moderator permissions aren't merged at all, only forum permissions (though that module is broken in 1.8.1)

As I've said, it only works if the forum has disabled avatar upload (phpbb can be set up to only allow URLs). And no, phpbb doesn't support gravatar. So in case uploading is disabled, you can simply copy the URLs from the table. If it does, it's a bit more work ^^.

EDIT:

I've managed to finish my code. It works after the posts have been migrated, and replaces the remains of the HTML emoticon codes with the original emoticons:
<?php
	ini_set("display_errors", 1);
	error_reporting(E_ALL);
	$conn = mysqli_connect("localhost", "admin", "Royaldb", "royalroad");
	$sql = "SELECT COUNT(*) AS count FROM mybb_posts;";
	$count = $conn->query($sql);
	$count = mysqli_fetch_array($count)['count'];
	for ($i=0; $i < ceil($count/1000); $i++) {
		# code...
		$c = $i * 1000;
		$sql = "SELECT * FROM mybb_posts LIMIT $c, 1000";
		$messages = $conn->query($sql);
		while ($message = mysqli_fetch_array($messages))
		{
			//print_r($message);
			$regex = '/(?:<!-- s.* -->)?\n*<img src="\{SMILIES_PATH\}\/.*" alt="(.*)" title="[^"<>]*"( |)\/?>\n*(?:<!-- s.* -->)?/';
			$message['message'] = preg_replace($regex, '$1', $message['message']);
			$message['message'] = preg_replace("/'/", "''", $message['message']);
			$sql  = "UPDATE mybb_posts SET message='".$message['message']."' WHERE pid = ".$message['pid'];
			$conn->query($sql);
			echo $message['pid']."\n";
		}
	}

	echo "DONE";
?>
Reply
#6
Solved: 7 Years, 7 Months, 3 Weeks ago
(2014-11-02, 09:08 PM)kanadaj Wrote: Hi there,

we've recently moved out forums from phpbb to mybb as we found it's generally better for customizations (even though we've a considerable performance drop on the server side).

Very strange for me is just the opposite (21000 users and 213400 messages). 
I'm trying the new 3.1.1 and is much lighter than MyBB 1.8.1, thanks for the code Wink
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)