MyBB Community Forums

Full Version: SMF 1.1.11 => MyBB attachment issues (new thread)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5
Thanks. Made the necessary change locally, and am trying the merge again.
Let me know how it goes.
Same problem persists: Merge reports no errors until complete; uploads folder is empty.

I do still find the error log somewhat troubling:
The following errors were logged during the process of the Merge System:

    * Attachments:
          o Error could not find the attachment thumbnail (ID: 1)
          o Error could not find the attachment thumbnail (ID: 2)
          o Error could not find the attachment (ID: 3)
          o Error could not find the attachment thumbnail (ID: 4)
          o Error could not find the attachment thumbnail (ID: 5)
          o Error could not find the attachment (ID: 6)
          o Error could not find the attachment thumbnail (ID: 7)

Knowing that the IDs are to the MyBB table is helpful is seeing what is fishy. ID 3 and ID 6 are actually thumbnails that are being inserted into the table as though they were regular attachments; ID 4's thumbnail is actually the file reference in the attachment with ID 3. Here are the first seven lines of the mybb_attachments table that resulted from the import:
aid 	pid 	posthash 				uid 	filename 			filetype 	filesize 	attachname 			downloads 	dateuploaded 	visible 	thumbnail				import_aid
1 	0 	c3079f3b401727d955e5893ff5d51a08 	0 	KA-24-236_01_lg.jpg 	  			63288 		post_0_1272563089.attach 	0 		0 		1 		post_0_1272563089_thumb.jpg_thumb 	2
2 	0 	a37921e48f2d89a384373e98c22b4739 	0 	KA-24-236_02_lg.jpg 	  			60985 		post_0_1272563089.attach 	0 		0 		1 		post_0_1272563089_thumb.jpg_thumb 	4
3 	13 	08ccbe292cb0305e2574804c82ef0c7f 	0 	East plan revised 2.jpg_thumb 		  	16596 		post_0_1272563089.attach 	0 		0 		1 	 					 	14
4 	13 	08ccbe292cb0305e2574804c82ef0c7f 	0 	East plan revised 2.jpg 		  	261455 		post_0_1272563089.attach 	43 		0 		1 		post_0_1272563089_thumb.jpg_thumb 	13
5 	14 	a8f51b8e4148bf78f465ae7524400e71 	0 	1 west w:riser cork croppedPOST.jpg 	  	165614 		post_0_1272563089.attach 	23 		0 		1 		post_0_1272563089_thumb.jpg_thumb 	15
6 	2 	cd99a2764a2c49ce62409e452cb9e82b 	0 	Image2.jpg_thumb 	  			12999 		post_0_1272563089.attach 	0 		0 		1 						  	11
7 	2 	cd99a2764a2c49ce62409e452cb9e82b 	0 	Image2.jpg 	  				65187 		post_0_1272563089.attach 	10 		0 		1 		post_0_1272563089_thumb.jpg_thumb 	10

and the original SMF rows being imported:
ID_ATTACH 	ID_THUMB 	ID_MSG 	ID_MEMBER 	attachmentType 	filename 				size 	downloads 	width 	height 	file_hash
2	 	3 		0 	0 		0 		KA-24-236_01_lg.jpg 			63288 	0 		500 	429 	 
3 		0 		0 	0 		3 		KA-24-236_01_lg.jpg_thumb 		29293 	0 		150 	128 	 
4 		5 		0 	0 		0 		KA-24-236_02_lg.jpg 			60985 	0 		500 	412 	 
5 		0 		0 	0 		3 		KA-24-236_02_lg.jpg_thumb 		28963 	0 		150 	123 	 
14 		0 		19 	0 		3 		East plan revised 2.jpg_thumb 		16596 	0 		108 	150 	 
13 		14 		19 	0 		0 		East plan revised 2.jpg 		261455 	43 		1268 	1746 	 
15 		16 		20 	0 		0 		1 west w:riser cork croppedPOST.jpg 	165614 	23 		1021 	492 	 
11 		0 		9 	0 		3 		Image2.jpg_thumb 			12999 	0 		150 	118 	 
10 		11 		9 	0 		0 		Image2.jpg 				65187 	10 		693 	547 	 

(is there a better way to post DB rows?)

This is just a guess, but it looks like the module is presuming that thumbnails are always preceeded by their full-sized attachment; notice that the thumbnails for "East plan revised 2.jpg" and "Image2.jpg" appear in the listing before the attachment itself, and so the thumbnails get treated as regular attachments. Perhaps that is a separate issue? Because the errors generated are not during the SQL inserts, but when trying to locate the actual file. I'm going to modify attachment.php to include the file it tried to open in addition to the row ID to see if this might help.
You're misunderstanding how MyBB puts them in the db is all. MyBB doesn't have rows for the attachment like SMF does.

Attachment 3 doesn't HAVE a thumbnail is why it doesn't say thumbnail error. The after_insert() function transfers the thumbnail first, then the actual attachment. However, this is because your SMF db does have those 2 rows backwards, having the thumbnail before the attachment instead of after like the others. So it gets a little weirded out. Basically what happens is that it wastes a little bit of db space, thats all. If SMF didn't have such a crappy way of handling their attachments... Wink

I don't know why you're still getting errors though. I've converted a dozen SMF boards and never had these issues.
(2010-04-29, 06:11 PM)ralgith Wrote: [ -> ]You're misunderstanding how MyBB puts them in the db is all. MyBB doesn't have rows for the attachment like SMF does.

Attachment 3 doesn't HAVE a thumbnail is why it doesn't say thumbnail error. The after_insert() function transfers the thumbnail first, then the actual attachment. However, this is because your SMF db does have those 2 rows backwards, having the thumbnail before the attachment instead of after like the others. So it gets a little weirded out. Basically what happens is that it wastes a little bit of db space, thats all. If SMF didn't have such a crappy way of handling their attachments... Wink

No, I see how MyBB stores attachment thumbnails, that's pretty clear (and the right way to do it in my mind). But that's precisely why I'm confused: Because the file referenced as Attachment 3 in the MyBB table is a thumbnail, and not an attachment. Why is stored in the MyBB table as though it were an attachment? Well, I know why (row reversal)…Anyway, it seems an error in the merge software, even if it can be fixed by regenerating thumbnails later. I guess it is a small thing.

Quote:I don't know why you're still getting errors though. I've converted a dozen SMF boards and never had these issues.

It is odd. I'll post the results of the latest import when it's done.
Thats what I mean, you're misunderstanding that the row 3 is just a dead row because that thumbnail is backwards in the db. Its a wasted row, and MyBB will ignore it. It correctly nabs it as the thumbnail for the next attachment. But since it comes BEFORE its attachment in SMF, it doesn't get added the the $thumbs[] array like I mentioned back in my first post.
OK, I've given it two more goes, a second one just in case there was a typo in my code. I altered the code to print hopefully more useful error messages. In after_insert():

function after_insert($data, $insert_data, $aid)
        {
                global $import_session, $mybb, $db;

                // Transfer attachment thumbnail
                $thumb_not_exists = "";
                if($data['ID_THUMB'] != 0)
                {
                        // Transfer attachment thumbnail
                        $attachment_thumbnail_file = merge_fetch_remote_file($import_session['uploadspath'].$this->generate_raw_filename($data));

                        if(!empty($attachment_thumbnail_file))
                        {
...etc.
                        }
                        else
                        {
                                $this->board->set_error_notice_in_progress("Error could not find the attachment thumbnail (ID: {$attachment_thumbnail_file})");
                        }

And likewise for regular attachments.

The idea is that, rather than reporting which row errored out (all rows trigger an error, so that's not useful), to show the filename that triggered the error. Here's what I got:

he following errors were logged during the process of the Merge System:

    * Attachments:
          o Error could not find the attachment thumbnail (ID: )
          o Error could not find the attachment thumbnail (ID: )
          o Error could not find the attachment (ID: )
          o Error could not find the attachment thumbnail (ID: )
          o Error could not find the attachment thumbnail (ID: )
...etc.

That's…not right. Is that a bug in my change? Or a genuine problem?
Ya know, this info should already be logged in the actual conversion log files.

Empty the convert/logs folder and run one more merge. Then open up some of the logs dealing with the attachments Smile
Actually, you need to look for a file like this also:
import_session_debug_data_140_1262486505.log
In order to see the path used and make sure its legit.
Oh! That's good to know! Doing that now.
(2010-04-29, 07:22 PM)CaptOblivious Wrote: [ -> ]Oh! That's good to know! Doing that now.

The actual filename of each attachment isn't logged at all Sad

from attachment_debug_data_oldbb_140_1272568978.log
array (
  'ID_ATTACH' => '2',
  'ID_THUMB' => '3',
  'ID_MSG' => '0',
  'ID_MEMBER' => '0',
  'attachmentType' => '0',
  'filename' => 'KA-24-236_01_lg.jpg',
  'size' => '63288',
  'downloads' => '0',
  'width' => '500',
  'height' => '429',
  'file_hash' => '',
)array (
  'ID_ATTACH' => '4',
  'ID_THUMB' => '5',
  'ID_MSG' => '0',
  'ID_MEMBER' => '0',
  'attachmentType' => '0',
  'filename' => 'KA-24-236_02_lg.jpg',
  'size' => '60985',
  'downloads' => '0',
  'width' => '500',
  'height' => '412',
  'file_hash' => '',
)...etc.

and attachment_debug_data_140_1272568978.log
array (
  'import_aid' => '2',
  'pid' => '',
  'posthash' => '58bc022ee5be8b3627cb4c051516d768',
  'uid' => '0',
  'filename' => 'KA-24-236_01_lg.jpg',
  'filetype' => '',
  'filesize' => '63288',
  'attachname' => 'post_0_1272569470.attach',
  'downloads' => '0',
  'dateuploaded' => '0',
  'visible' => '1',
  'thumbnail' => 'post_0_1272569470_thumb.jpg_thumb',
)array (
  'import_aid' => '4',
  'pid' => '',
  'posthash' => '3d831747d0fc9021c6e26827d58e5655',
  'uid' => '0',
  'filename' => 'KA-24-236_02_lg.jpg',
  'filetype' => '',
  'filesize' => '60985',
  'attachname' => 'post_0_1272569470.attach',
  'downloads' => '0',
  'dateuploaded' => '0',
  'visible' => '1',
  'thumbnail' => 'post_0_1272569470_thumb.jpg_thumb',
)...etc.

finally, the relevent bits of import_session_debug_data_140_1272568978.log
  'uploadspath' => '/Users/dgoodman/Sites/attachments/',
  'total_attachments' => '5334',
  'uploads_test' => 1,
  'start_attachments' => 1100,
  'attachments_per_screen' => 20,
  'error_logs' => 
  array (
    'import_attachments' => 
    array (
      0 => 'Error could not find the attachment thumbnail (ID: )',
      1 => 'Error could not find the attachment thumbnail (ID: )',
      2 => 'Error could not find the attachment (ID: )',
...etc.
(I didn't bother reverting my changes to the error logging, figuring it wasn't important to this question.)

Finally, just to answer the one obvious question that could totally embarrass me: the attachments folder does contain the actual files, really, I promise Wink
Bacon:attachments dgoodman$ pwd
/Users/dgoodman/Sites/attachments
Bacon:attachments dgoodman$ ls *KA-*
3_KA-24-236_01_lg_jpg_thumb863c29fe4834864dbcc8813aea600745
4_KA-24-236_02_lg_jpg6c438ae7f49b64c273e23eacd7f690a6
2_KA-24-236_01_lg_jpgee3bcaecf39f06549b68a93163f99740
5_KA-24-236_02_lg_jpg_thumb44bd1e61a1bb4390d070131fd2c07c11

BTW, this deep into the conversation, I should say THANK YOU!, even though the issue hasn't been resolved yet, as you've been tremendously responsive and patient with me.
Ok, I see the issue. Hold on a few minutes and I'll provide you the fix. I remember this issue now from the SMF2 module I wrote. Do you see how there is a hash concatenated to the filename? That was something new added to more recent versions of SMF. And you need to add it to the code to concatenate it to the filename. I'll post that here shortly.
Pages: 1 2 3 4 5