Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-11-2015, 06:54 PM
Abubaker87 Abubaker87 is offline
 
Join Date: Jan 2015
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default vBulletin attachments table structure

I am importing posts from a custom forum to vBulletin 4. I have done most of the work. Now only photos/videos needs to be copied.

For that I will replace [img] tags (old Forum tags) to vBulletin tags such as [ATTACH]ID[/ATTACH]. But I need to know how does vB manages attachments? What is the table structure? Which tables are involved?

So far I have found that following tables are involved

filedata

attachmentcategoryuser

attachment
Reply With Quote
  #2  
Old 02-11-2015, 07:12 PM
AusPhotography's Avatar
AusPhotography AusPhotography is offline
 
Join Date: Nov 2007
Location: Hobart & Adelaide .au
Posts: 521
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It also depends on storing attachments in the database (Bad) or the file system (Good)

I.e. the file system comes into play

To import the image has to be local to the vB system - if IMG tags were used then they need to stay that way as the image is likely to not be on your server
Reply With Quote
  #3  
Old 02-11-2015, 07:15 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't know all the details, but basically each file has a row in filedata. If you are storing files in the database, then the actual file contents go in there, otherwise they go in the filesystem, and I believe the filename is related to the fileid. Then there's a row in attachment for each place it's attached (the same file can be attached more than one place). contenttype tells what it's attached to (a post or somewhere else, I'm no sure what all the possibilities are), and contentid has the postid or whateevr other id is appropriate. Also, in the post table I believe the attach column is the count of attachments to each post.

I don't know what attachmentcategoryuser is for.

Sorry I don't have more details off the top of my head, maybe someone else will have more to say.
Reply With Quote
  #4  
Old 02-11-2015, 07:24 PM
Abubaker87 Abubaker87 is offline
 
Join Date: Jan 2015
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you both. I have an external PHP external that gets the image from URL and create records in the 3 tables I mentioned. However, I am not creating posthash column. Then I am replacing [img] tags with [ATTACH=CONFIG] tags so that VBulletin can understand that it is an attachment. But attachments are not being shown as photos. THere is only a link shown in the posts.

Attachment are stored in DB in my VB forum. I read it that database is a better option because of performance.
Reply With Quote
  #5  
Old 02-11-2015, 07:24 PM
AusPhotography's Avatar
AusPhotography AusPhotography is offline
 
Join Date: Nov 2007
Location: Hobart & Adelaide .au
Posts: 521
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

On the file system the path to the files is based on the userid then the attachment id as the file.

Eg for me the path would be ./attachments/2/2/8/7/8/1/123.attach and also .thumb depending of where you setup the attachments folder.

The attachment renderer handles the file types
Reply With Quote
  #6  
Old 02-11-2015, 07:31 PM
Abubaker87 Abubaker87 is offline
 
Join Date: Jan 2015
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am stuck as to how Can i get the photos in the post from custom forums to vB Forums.

--------------- Added [DATE]1423690944[/DATE] at [TIME]1423690944[/TIME] ---------------

Need help from vB experts!!
Reply With Quote
  #7  
Old 02-11-2015, 07:55 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did you include the thumbnail info? If not you might try Maintenance > General Update Tools > Rebuild Attachment Thumbnails.
Reply With Quote
  #8  
Old 02-11-2015, 07:55 PM
AusPhotography's Avatar
AusPhotography AusPhotography is offline
 
Join Date: Nov 2007
Location: Hobart & Adelaide .au
Posts: 521
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Best is to download impex (free on GitHUB) and look at the import code and adapt that.

See https://members.vbulletin.com/import.php
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:10 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03839 seconds
  • Memory Usage 2,223KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete