Go Back   vb.org Archive > vBulletin Modifications > Archive > Modification Graveyard

Reply
 
Thread Tools
oXoXo's VB Amazon S3 Hack Details »»
oXoXo's VB Amazon S3 Hack
Version: 1.00, by oxoxo oxoxo is offline
Developer Last Online: Jan 2012 Show Printable Version Email this Page

Category: Miscellaneous Hacks - Version: 4.1.7 Rating:
Released: 12-20-2011 Last Update: 12-23-2011 Installs: 3
Is in Beta Stage  
No support by the author.

With this Hack you can all Pictures und Downloadable Files, view from your S3 Account.

Step 1. backup your original attachment.php
Step 2. replace attachment.php with new hack version
Step 3. Configure in attachment.php your defines:

define('AWS_KEY', 'your aws key');
define('AWS_SECRET', 'your aws secret key');
define('AWS_Bucket', "your aws bucket");

Step 4. Upload Zend Framework to your Webserver Root Directory
Step 5. Synchronize with Tools like "Transmit" your Webserver Folder store_attachment with your AWS Bucket.

Sample copy this from Webserver:
store_attachment/2/59.attach
store_attachment/3/44.attach
store_attachment/3/44.thumb
...
To your S3 Bucket
YourBucket/2/59.attach
YourBucket/3/44.attach
YourBucket/3/44.thumb

Step 6. After Synchronize you can Remove all or only your big Files in your store_attachment Folder.
Step 7. Synchronize every day or week or not.

The attachment.php download and view your pictures and files from your S3 and when not found on this, download the File from your Webserver.

Its Simple. Its Work.

Alternative:
You can rename my attachment.php to download.php and modifier with Jquery in the headinclude template:
<script type="text/javascript" src="{vb:raw vboptions.bburl}/clientscript/jquery/jquery-1.6.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var strNewString = $('body').html().replace(/\attachment.php/g,'download.php');
$('body').html(strNewString);
});
</script>
In this Case rename in your new download.php
Row 36: #attachment\.php to #download\.php
Row 189: 'attachment.php?' to 'download.php?'


For more Comfortable Uploads i have create a Java App.
With Java App "VBS3Uploader" you can upload many big Files to your S3 Account. The App Save the File Reference in your VB Board Database. After Upload you can with Data Manager select the File in your Article und Posts. The App is designed for Webmaster and her Mods.

App Features:

-Test your Connections.
-Upload Files with 1GB size and more
-Debug Windows
-Progressbar
-Configure your Properties( AWS Keys, Bucket, VB UserID and DB Password)
-All relevant Keys and Passwords are encrypt saved

Please not forget:
Change your Properties after First Start the App.
Please Change the Database Connection in the hibernate.cfg.xml.

1. Unpack the jasypt-1.8-dist.zip.
2. Go with terminal to jasypt-1.8/bin Folder.
3. Encrypt your Database Password with call enrypt.bat or encrypt.sh
"encrypt.bat input="YOUR-DATABASE-PASSWORD" password=YOUR-ENCRYPTION-PASSWORD algorithm=PBEWithMD5AndDES"
4. Copy the Result in your hibernate.cfg.xml:
<property name="hibernate.connection.password">ENC(your result from encrypt)</property>
5. Change the values
<property name="hibernate.connection.url">jdbc:mysql://your server url:3306/your databasename</property>
<property name="hibernate.connection.username">your databaseuser</property>


Run the App: java -jar VBS3Uploader.jar

It's a First Version. Please contact me when you find Bugs or for support.
oxoxo@gamesattack.me

Donation: Please Register on www.gamesattack.me

I cant upload more as 3 Files in this post.

therefore you must download the following files from my s3 account
http://s3.amazonaws.com/amb_images/VBS3Uploader.zip
http://s3.amazonaws.com/amb_images/jasypt-1.8-dist.zip
http://s3.amazonaws.com/amb_images/Zend.zip

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
furnival

Comments
  #2  
Old 12-23-2011, 03:42 PM
strudinox's Avatar
strudinox strudinox is offline
 
Join Date: Mar 2010
Location: California
Posts: 147
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Interest concept. I'm running an S3 for all my static content and having it manage attachments would be very ideal. So if I'm reading this correctly, every time someone uploads an attachment, it automatically gets sent to my S3 server?
Reply With Quote
  #3  
Old 12-23-2011, 06:11 PM
oxoxo oxoxo is offline
 
Join Date: Nov 2011
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

no it's not a automatic upload to s3 server. You can synchronize with external tools your attachments every night. Or you select your favorit attachments and copy manuell to your s3 server.
The attachment.php take the attachments first from s3 server and when not found, then take the attachment from your webserver.
Best practice, all thumbs leave on your webserver and copy the pictures and attachments to your s3 Server.
Next Version, we should built an configurable cron job, which synchronizes the attachements and after synchron job run, should the job remove all these attachments from webserver.

The VBS3Uploader Tool upload your new Attachments directly to your s3 server and save the Reference in your VB Database. After Upload you can select the Attachment for your Posts in the VB Software. Alltrough the attachment is not on the webserver. Its only on s3 server.
Reply With Quote
  #4  
Old 12-24-2011, 03:08 AM
v123shine v123shine is offline
 
Join Date: Sep 2008
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

can you make this mod for vb 3.8
please!
Reply With Quote
  #5  
Old 12-24-2011, 08:48 PM
yahooooh yahooooh is offline
 
Join Date: Nov 2009
Posts: 150
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

can not be downloaded ,
http://s3.amazonaws.com/amb_images/VBS3Uploader.zip
http://s3.amazonaws.com/amb_images/jasypt-1.8-dist.zip
http://s3.amazonaws.com/amb_images/Zend.zip

access denied
Reply With Quote
  #6  
Old 12-24-2011, 08:59 PM
oxoxo oxoxo is offline
 
Join Date: Nov 2011
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

okay, sorry, i have change the access rights for downloads.
Reply With Quote
  #7  
Old 12-24-2011, 09:09 PM
oxoxo oxoxo is offline
 
Join Date: Nov 2011
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The attachment.php form my 4.17 Version and new version 4.18 or 4.19 Version are the same. The Mod is therefore full compatible.
Reply With Quote
  #8  
Old 12-24-2011, 09:46 PM
oxoxo oxoxo is offline
 
Join Date: Nov 2011
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i have an update of attachment.php Version 1.01 2011/12/24

- better Header Cache Handling for Attachmentfiles
- you can modifier two 2 lines, when you have problems with Timeout errors of big Files.

@ini_set('memory_limit', '800M');
@ini_set('max_execution_time', 0);
Reply With Quote
  #9  
Old 01-21-2012, 04:25 PM
kingdruid kingdruid is offline
 
Join Date: Nov 2011
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So this returns the S3 link to attachments.php then attachments.php serves the file from your S3 account which would save space on your web server.

It would be nice to have something return the S3 link when viewing attachments and posting, then upload to S3 when a user tries to attach a new file. Without that your webserver is still using up your traffic/Resources + S3 traffic because its being outputted from attachment.php.
Reply With Quote
  #10  
Old 06-01-2013, 05:05 AM
pelican pelican is offline
 
Join Date: Sep 2004
Posts: 103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by oxoxo View Post
The attachment.php form my 4.17 Version and new version 4.18 or 4.19 Version are the same. The Mod is therefore full compatible.
is this mod consider complete?

the idea is good.

i think we need some coding to automatically synchronize (cron job) server attachment to S3 and then remove the attachments in the server.

it is tedious to use 3rd party apps/tools to manually synchronize at regular basis.
Reply With Quote
Reply

Thread Tools

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 11:31 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.17748 seconds
  • Memory Usage 2,298KB
  • Queries Executed 25 (?)
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)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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_postinfo_query
  • fetch_postinfo
  • 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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete