Solved: 7 Years, 9 Months ago phpbb3 -> mybb1.8 with merge 1.8.1
#5
Solved: 7 Years, 9 Months 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


Messages In This Thread
phpbb3 -> mybb1.8 with merge 1.8.1 - by kanadaj - 2014-11-02, 09:08 PM
RE: phpbb3 -> mybb1.8 with merge 1.8.1 - by kanadaj - 2014-11-02, 11:54 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)