MyBB Community Forums

Full Version: Merge System Attachments Not Copied
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11
Hello,
I had the same problem with my attachments.
After a fresh install myBB 1.6.6 with MyBB Merge System - Version: 1.6.3, PHP 5.3.10, MySQLi 5.1.61, I have merged all topics from my phpBB 3.0.10.
Everything was imported OKAY, without any errors, but the attached images were gone and the error on click was : The image attachment.php?aid=XX cannot be displayed because it contains errors.
Meanwhile, the new forum is made default and got new posts and users.
I didn't knew how to skip all steps and import only Attachments, so I have installed on my localhost WampServer with PHP 5.3.5 and SQL MySQLi 5.5.8 the old forum and a fresh copy of myBB 1.6.6 in different data bases, ofc.
I have deleted from the old_forum/files/ .htaccess file and I have edited merge/resources/functions.php
On Database Configuration, I have marked as NO the question "Automatically convert messages to UTF8?:"
Now on localhost, the new forum looks great and on /uploads/ directory all attach files and thumbs are there.
I have deleted from ftp all .attach files from my-new-forum/uploads/ and I have replace them with the localhost ones.
After that, I have exported my localhost mybb_attachments table and I overwrited her on my host database.

That's it! Smile
Pls help me, i convert vbb 3.x to mybb 1.6.7 no error but not download Attachments.
This info hosting http://ketnoiquantri.com/mybb/info.php
Attachments 0kb
Pls help me
Windows 7 HP / Xampp / Apache 2.2.21 / PHP 5.3.8 / MySQL 5.5

After conversion, 2 911 attachements have been added but not copied to uploads/ directory. I am doing it under Windows so there is not chmod problem for sure!

Error could not find the attachment

I can share some part of mybb_debuglogs via PM.

Looking for forward to You!
My Server info:
Apache version 2.2.22
PHP version 5.3.13
MySQL version 5.1.63-cll
Architecture i686
Operating system linux

My issue:
Merged from SMF - Attachments names/sizes/stats are showing up in the admin Cpanel but are no longer linked in threads, and I'm not sure if they were imported at all. You can register with facebook on my forum, so its real quick & easy to take a peek!

Here is a thread with a few attachments: http://acsforums.com/mybb/showthread.php?tid=43

I have a backup of my old attachments directory,... is it possible to manually upload & link them?
if you have this problem migrating from phpBB3 to mybb you can try this script:
<?php
/* mybb connect */
define("IN_MYBB", 1);
define("NO_ONLINE", 1);
require("global.php");

/* phpBB3 connect */
$username = "phpbb3_username";
$password = "phpbb3_password";
$hostname = "localhost";	
$dbh = mysql_connect($hostname, $username, $password) 
	or die("Unable to connect to MySQL");
mysql_set_charset('utf8',$dbh); 

$selected = mysql_select_db("phpbb3_database",$dbh) 
	or die("Could not select database");

$no_encontrados = 0;

$query=$db->query("SELECT * FROM mybb_attachments");
while($result=$db->fetch_array($query))
{
	$file_phpbb3 = getFileData( $result['filename'] );
	if ( !empty($file_phpbb3) ) {
		echo "MYBB: id: " . $result['aid'] . " name: " .$result['filename'] . "<br/>";
		echo "PHPBB: id: ".$file_phpbb3['attach_id']." physical_filename: ".$file_phpbb3['physical_filename']." <br/>";
		//uncomment this line once you are sure you want to copy files
		//copyFile( $file_phpbb3['physical_filename'], $result['attachname'] );
	} else {
		echo "File id: ".$result['aid']." (".$result['filename'].") was not found in phpbb3<br/>";
		$no_encontrados++;
	}
	echo "<br/>";
}

echo $no_encontrados." files not found in total";

function getFileData( $name ) {
	$sql = "SELECT attach_id, physical_filename
			  FROM phpbb_attachments
				 WHERE real_filename LIKE '".mysql_real_escape_string($name)."'";

	$result = mysql_query($sql);
	if (!$result) {
		return;
	} else {
		$row = mysql_fetch_array($result);
		return $row;
	}
}

function copyFile( $from, $to ) {
	$from_folder = "/home/your_folder/phpbb3/files/";
	$to_folder = "/home/your_folder/mybb/uploads/";
	//echo "copiando archivo ".$from_folder.$from." a ".$to_folder.$to;
	if (!copy($from_folder.$from, $to_folder.$to)) {
		echo "Error copying<br/>";
	} else {
		echo "File copied<br/>";
	}
}
?>  

All my files were 4kb size, damaged of course.

Deleted all of them. Paste this code in a file and name it for example "migrate-attachments.php" and upload it to mybb root. Please, read the comments in the script, change your phpbb3 database credentials, and the path of both phpbb3 and mybb attachment folders.

Hope it helps, it worked for me.
(2012-09-30, 07:00 PM)Salvatore Wrote: [ -> ]if you have this problem migrating from phpBB3 to mybb you can try this script:
<?php
/* mybb connect */
define("IN_MYBB", 1);
define("NO_ONLINE", 1);
require("global.php");

/* phpBB3 connect */
$username = "phpbb3_username";
$password = "phpbb3_password";
$hostname = "localhost";	
$dbh = mysql_connect($hostname, $username, $password) 
	or die("Unable to connect to MySQL");
mysql_set_charset('utf8',$dbh); 

$selected = mysql_select_db("phpbb3_database",$dbh) 
	or die("Could not select database");

$no_encontrados = 0;

$query=$db->query("SELECT * FROM mybb_attachments");
while($result=$db->fetch_array($query))
{
	$file_phpbb3 = getFileData( $result['filename'] );
	if ( !empty($file_phpbb3) ) {
		echo "MYBB: id: " . $result['aid'] . " name: " .$result['filename'] . "<br/>";
		echo "PHPBB: id: ".$file_phpbb3['attach_id']." physical_filename: ".$file_phpbb3['physical_filename']." <br/>";
		//uncomment this line once you are sure you want to copy files
		//copyFile( $file_phpbb3['physical_filename'], $result['attachname'] );
	} else {
		echo "File id: ".$result['aid']." (".$result['filename'].") was not found in phpbb3<br/>";
		$no_encontrados++;
	}
	echo "<br/>";
}

echo $no_encontrados." files not found in total";

function getFileData( $name ) {
	$sql = "SELECT attach_id, physical_filename
			  FROM phpbb_attachments
				 WHERE real_filename LIKE '".mysql_real_escape_string($name)."'";

	$result = mysql_query($sql);
	if (!$result) {
		return;
	} else {
		$row = mysql_fetch_array($result);
		return $row;
	}
}

function copyFile( $from, $to ) {
	$from_folder = "/home/your_folder/phpbb3/files/";
	$to_folder = "/home/your_folder/mybb/uploads/";
	//echo "copiando archivo ".$from_folder.$from." a ".$to_folder.$to;
	if (!copy($from_folder.$from, $to_folder.$to)) {
		echo "Error copying<br/>";
	} else {
		echo "File copied<br/>";
	}
}
?>  

All my files were 4kb size, damaged of course.

Deleted all of them. Paste this code in a file and name it for example "migrate-attachments.php" and upload it to mybb root. Please, read the comments in the script, change your phpbb3 database credentials, and the path of both phpbb3 and mybb attachment folders.

Hope it helps, it worked for me.

i wasnt sure how to replace the roots with my info. i got the username and pass. any more detail?

do i name the root

www.mysite.com/forums/phpbb3/files
and
www.mysite.com/mybb/uploads

???? then i place the move-photos.php to mybb root then i type
www.mywebsite.com/mybb/move-photos.php? how do i run the script after i figure out how to edit properly.
i am redoing my merge. i think the errors occurs when importing large photos 20 at a time. i changed to 1 photo merge at a time...hope this works. my old forum has large attachments up to 2mb, imagine leaving the settings at 20 attachments at a time...never gonna work...hope this fixes my problem...

impossible fix, and zero support. i dont know how mybb gets so many votes. it looks great but not even a fresh install allows me to use attachments. it goes white screen..........
(2012-09-30, 07:00 PM)Salvatore Wrote: [ -> ]if you have this problem migrating from phpBB3 to mybb you can try this script:
<?php
/* mybb connect */
define("IN_MYBB", 1);
define("NO_ONLINE", 1);
require("global.php");

/* phpBB3 connect */
$username = "phpbb3_username";
$password = "phpbb3_password";
$hostname = "localhost";	
$dbh = mysql_connect($hostname, $username, $password) 
	or die("Unable to connect to MySQL");
mysql_set_charset('utf8',$dbh); 

$selected = mysql_select_db("phpbb3_database",$dbh) 
	or die("Could not select database");

$no_encontrados = 0;

$query=$db->query("SELECT * FROM mybb_attachments");
while($result=$db->fetch_array($query))
{
	$file_phpbb3 = getFileData( $result['filename'] );
	if ( !empty($file_phpbb3) ) {
		echo "MYBB: id: " . $result['aid'] . " name: " .$result['filename'] . "<br/>";
		echo "PHPBB: id: ".$file_phpbb3['attach_id']." physical_filename: ".$file_phpbb3['physical_filename']." <br/>";
		//uncomment this line once you are sure you want to copy files
		//copyFile( $file_phpbb3['physical_filename'], $result['attachname'] );
	} else {
		echo "File id: ".$result['aid']." (".$result['filename'].") was not found in phpbb3<br/>";
		$no_encontrados++;
	}
	echo "<br/>";
}

echo $no_encontrados." files not found in total";

function getFileData( $name ) {
	$sql = "SELECT attach_id, physical_filename
			  FROM phpbb_attachments
				 WHERE real_filename LIKE '".mysql_real_escape_string($name)."'";

	$result = mysql_query($sql);
	if (!$result) {
		return;
	} else {
		$row = mysql_fetch_array($result);
		return $row;
	}
}

function copyFile( $from, $to ) {
	$from_folder = "/home/your_folder/phpbb3/files/";
	$to_folder = "/home/your_folder/mybb/uploads/";
	//echo "copiando archivo ".$from_folder.$from." a ".$to_folder.$to;
	if (!copy($from_folder.$from, $to_folder.$to)) {
		echo "Error copying<br/>";
	} else {
		echo "File copied<br/>";
	}
}
?>  

All my files were 4kb size, damaged of course.

Deleted all of them. Paste this code in a file and name it for example "migrate-attachments.php" and upload it to mybb root. Please, read the comments in the script, change your phpbb3 database credentials, and the path of both phpbb3 and mybb attachment folders.

Hope it helps, it worked for me.

This worked great for me, thank you Cool

I had 12 attachments (at the end) which failed, but I can edit those manually. Thanks for the script Smile
Hello!
I'm very impressed with this merge system because all conversion passed seamlessly but attachments.
I have latest MyBB installation and old SMF forum 1.1.x
Attachments are assigned to the posts but are non displayed.
When I click on an attachment (say, http://..../forum/attachment.php?aid=4) file blank window appears with the message "Waiting for www......com".
Can anybody help me to get it working?
Pages: 1 2 3 4 5 6 7 8 9 10 11