Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 06-16-2011, 01:36 PM
konstance's Avatar
konstance konstance is offline
 
Join Date: Dec 2002
Location: oklahoma
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Storing attachments in Amazon Cloud (S3)

Hello!

I'm trying to figure out a way to store forum (and all other) attachments in the Amazon Cloud (S3). Has anyone tried to do something like this or has any pointers?

I think a possible workflow could be to write a plugin that runs after the file / attachment has been uploaded, gets its file path and then pushes the files to the cloud. This last bit I already know how to do, I'm just having difficulty with figuring out:

- what hook to use for the plugin
- what variable(s) store the attachment filepath

Thank you all in advance for any help you can provide!
Reply With Quote
  #2  
Old 06-16-2011, 07:10 PM
konstance's Avatar
konstance konstance is offline
 
Join Date: Dec 2002
Location: oklahoma
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The attachments are currently stored locally on the server. There's no way in vBulletin to specify upload paths that aren't local. Besides, Amazon S3 is a different file storage type, so upload to it is different than what vBulletin has.

I wouldn't want to store attachments in the database.

Not sure what else to try...
Reply With Quote
  #3  
Old 06-16-2011, 07:11 PM
nhawk nhawk is offline
 
Join Date: Jan 2011
Posts: 1,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, I just deleted my post because I wasn't paying attention to the "s3" part. Sorry.

You might be able to use the attachment_complete hook to know when the upload has completed, then build your script to run then.

The file path is built with the assigned directory, userid and filedataid.

So, if you're assigned directory is: uploads and the userid is 21 and the filedataid is 897 the full path would be /uploads/2/1/897.attach

The actual filename is stored in the database.
Reply With Quote
  #4  
Old 06-21-2013, 01:03 PM
furnival furnival is offline
 
Join Date: Mar 2008
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For anyone reading this thread in the future see https://vborg.vbsupport.ru/showthread.php?p=2429574

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

My idea related to this is to somehow make use of the attachments.php file provided here. Then set up a cron job to run every night using http://s3tools.org/s3cmd-sync to transfer all newly uploaded attachments to my Amazon s3 account and another cron job to delete all image attachments older than, say, 2 weeks.
That way I will only have to store 2 weeks' worth of attachments on my server.
Reply With Quote
  #5  
Old 09-05-2014, 10:36 PM
dougdirac's Avatar
dougdirac dougdirac is offline
 
Join Date: Nov 2011
Posts: 208
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Any good solutions for this? That mod you link to is no longer available.
Reply With Quote
  #6  
Old 09-08-2014, 06:09 PM
konstance's Avatar
konstance konstance is offline
 
Join Date: Dec 2002
Location: oklahoma
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I ended up using S3FS (https://code.google.com/p/s3fs/) to mount an S3 bucket to a local folder, and everything worked great!
Reply With Quote
  #7  
Old 09-08-2014, 06:12 PM
tpearl5's Avatar
tpearl5 tpearl5 is offline
 
Join Date: Nov 2001
Location: PA
Posts: 1,014
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by konstance View Post
I ended up using S3FS (https://code.google.com/p/s3fs/) to mount an S3 bucket to a local folder, and everything worked great!
ah, I hadn't thought of that! Thanks for the tip.
Reply With Quote
Reply

Thread Tools
Display Modes

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 03:19 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04053 seconds
  • Memory Usage 2,210KB
  • 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)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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