Permalink
Browse files

Minor changes to make it work with Google Cloud Storage instead

  • Loading branch information...
timwhite committed Oct 5, 2015
1 parent 87bd0a0 commit 8b55698c8e937a585646d8ecd0682db088c8dc76
Showing with 6 additions and 6 deletions.
  1. +4 −4 classes/amazon-s3-and-cloudfront.php
  2. +2 −2 view/domain-setting.php
@@ -55,7 +55,7 @@ class Amazon_S3_And_CloudFront extends AWS_Plugin_Base {
const DEFAULT_ACL = 'public-read';
const PRIVATE_ACL = 'private';
const DEFAULT_EXPIRES = 900;
const DEFAULT_REGION = 'us-east-1';
const DEFAULT_REGION = 'global';
const SETTINGS_KEY = 'tantan_wordpress_s3';
@@ -998,7 +998,7 @@ function get_file_prefix( $time = null, $post_id = null ) {
* @return string
*/
function get_s3_url_prefix( $region = '', $expires = null ) {
$prefix = 's3';
$prefix = 'storage';
if ( '' !== $region ) {
$delimiter = '-';
@@ -1046,10 +1046,10 @@ function get_s3_url_domain( $bucket, $region = '', $expires = null, $args = arra
$s3_domain = $bucket;
}
elseif ( 'path' === $args['domain'] || $this->use_ssl( $args['ssl'] ) ) {
$s3_domain = $prefix . '.amazonaws.com/' . $bucket;
$s3_domain = $prefix . '.googleapis.com/' . $bucket;
}
else {
$s3_domain = $bucket . '.' . $prefix . '.amazonaws.com';
$s3_domain = $bucket . '.' . $prefix . '.googleapis.com';
}
return $s3_domain;
@@ -21,12 +21,12 @@
<label class="subdomain-wrap <?php echo $subdomain_class; // xss ok?>">
<input type="radio" name="domain" value="subdomain" <?php checked( $domain, 'subdomain' ); ?> <?php echo $subdomain_disabled; // xss ok ?>>
<?php _e( 'Bucket name as subdomain', 'amazon-s3-and-cloudfront' ); ?>
<p>http://bucket-name.s3.amazon.com/&hellip;</p>
<p>http://bucket-name.storage.googleapis.com/&hellip;</p>
</label>
<label>
<input type="radio" name="domain" value="path" <?php checked( $domain, 'path' ); ?>>
<?php _e( 'Bucket name in path', 'amazon-s3-and-cloudfront' ); ?>
<p>http://s3.amazon.com/bucket-name/&hellip;</p>
<p>http://storage.googleapis.com/bucket-name/&hellip;</p>
</label>
<label>
<input type="radio" name="domain" value="virtual-host" <?php checked( $domain, 'virtual-host' ); ?>>

2 comments on commit 8b55698

@jiji0806

This comment has been minimized.

jiji0806 replied Jan 11, 2016

Hi, not sure if you will check this comment, but there was no way reach you.

I was looking for this exactly.

  1. I tried with azure blob storage(there is plugin for azure). but, there was no way to import my existing wordpress media library files to the azure storage, which is size about 200GB ( there are azcopy and few more tools but they are only for windows machine, I need linux CLI so that I can command upload files directly from my live server to the cloud storage.)

google and aws s3 has linux CLI that I can upload my heavy media library to the cloud storage.

so now, I try to look up any existing plugin for google cloud storage connect to wordpress media library.but no luck except this one. every one seems to build plugin for google drop box, not for "google cloud storage".

r u planning to build native Google Cloud Storage plugin for wordpress??

I may wait for it...

if you are not planning, I have to work with aws S3...

any replying will be appreciate, thanks

@timwhite

This comment has been minimized.

Owner

timwhite replied Jan 11, 2016

https://tim.purewhite.id.au/2015/10/wordpress-google-cloud-storage/

Have a look at that blog post. That shows how with the AWS plugin (and this one because it uses Google's S3 API as well) can upload your existing media library easily. Just this plugin and wp-cli required and a simple bash script.

Ideally I'd like to build a native Google Cloud Storage plugin, or Backblaze B2 plugin. Realistically that won't happen for awhile due to time constraints.

Hope that helps. Easiest way to respond to the blog post is to open an issue on the post (https://github.com/timwhite/technicallytim/issues)

Please sign in to comment.