Commit 3f1e62c5 authored by Fränk Klein's avatar Fränk Klein
Browse files

Always require AWS Autoloader

The AWS SDK includes its own autoloader. As such, we should load this
file in the plugin’s bootstrap.

Only loading the autoloader file when needed leads to little gains, but
it results in bugs. This changes fixes #60.
parent 64737c87
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -139,8 +139,6 @@ class S3_Uploads_WP_CLI_Command extends WP_CLI_Command {
	 */
	public function create_iam_user( $args, $args_assoc ) {

		require_once dirname( __FILE__ ) . '/aws-sdk/aws-autoloader.php';

		if ( empty( $args_assoc['username'] ) ) {
			$username = 's3-uploads-' . sanitize_title( home_url() );
		} else {
+0 −2
Original line number Diff line number Diff line
@@ -69,8 +69,6 @@ class S3_Uploads {
		if ( defined( 'S3_UPLOADS_USE_LOCAL' ) && S3_UPLOADS_USE_LOCAL ) {
			stream_wrapper_register( 's3', 'S3_Uploads_Local_Stream_Wrapper', STREAM_IS_URL );
		} else {
			require_once dirname( dirname( __FILE__ ) ) . '/lib/aws-sdk/aws-autoloader.php';

			S3_Uploads_Stream_Wrapper::register_streamwrapper( $this );
			stream_context_set_option( stream_context_get_default(), 's3', 'ACL', 'public-read' );
		}
+3 −0
Original line number Diff line number Diff line
@@ -72,3 +72,6 @@ function s3_uploads_autoload( $class_name ) {
}

spl_autoload_register( 's3_uploads_autoload');

// Require AWS Autoloader file.
require_once dirname( __FILE__ ) . '/lib/aws-sdk/aws-autoloader.php';