Loading inc/class-s3-uploads-stream-wrapper.php 0 → 100644 +23 −0 Original line number Diff line number Diff line <?php class S3_Uploads_Stream_Wrapper extends Aws\S3\StreamWrapper { /** * Register the 's3://' stream wrapper * * @param S3Client $client Client to use with the stream wrapper */ public static function register( Aws\S3\S3Client $client) { if (in_array('s3', stream_get_wrappers())) { stream_wrapper_unregister('s3'); } stream_wrapper_register('s3', __CLASS__, STREAM_IS_URL); static::$client = $client; } public function stream_metadata( $path, $option, $value ) { // not implemented } } No newline at end of file inc/class-s3-uploads.php +3 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,8 @@ class S3_Uploads { require_once dirname( __FILE__ ) . '/class-s3-uploads-local-stream-wrapper.php'; stream_wrapper_register( 's3', 'S3_Uploads_Local_Stream_Wrapper', STREAM_IS_URL ); } else { $this->s3()->registerStreamWrapper(); $s3 = $this->s3(); S3_Uploads_Stream_Wrapper::register( $s3 ); } stream_context_set_option( stream_context_get_default(), 's3', 'seekable', true ); Loading Loading @@ -80,6 +81,7 @@ class S3_Uploads { public function s3() { require_once dirname( __FILE__ ) . '/aws-sdk/aws-autoloader.php'; require_once dirname( __FILE__ ) . '/class-s3-uploads-stream-wrapper.php'; if ( ! empty( $this->s3 ) ) return $this->s3; Loading Loading
inc/class-s3-uploads-stream-wrapper.php 0 → 100644 +23 −0 Original line number Diff line number Diff line <?php class S3_Uploads_Stream_Wrapper extends Aws\S3\StreamWrapper { /** * Register the 's3://' stream wrapper * * @param S3Client $client Client to use with the stream wrapper */ public static function register( Aws\S3\S3Client $client) { if (in_array('s3', stream_get_wrappers())) { stream_wrapper_unregister('s3'); } stream_wrapper_register('s3', __CLASS__, STREAM_IS_URL); static::$client = $client; } public function stream_metadata( $path, $option, $value ) { // not implemented } } No newline at end of file
inc/class-s3-uploads.php +3 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,8 @@ class S3_Uploads { require_once dirname( __FILE__ ) . '/class-s3-uploads-local-stream-wrapper.php'; stream_wrapper_register( 's3', 'S3_Uploads_Local_Stream_Wrapper', STREAM_IS_URL ); } else { $this->s3()->registerStreamWrapper(); $s3 = $this->s3(); S3_Uploads_Stream_Wrapper::register( $s3 ); } stream_context_set_option( stream_context_get_default(), 's3', 'seekable', true ); Loading Loading @@ -80,6 +81,7 @@ class S3_Uploads { public function s3() { require_once dirname( __FILE__ ) . '/aws-sdk/aws-autoloader.php'; require_once dirname( __FILE__ ) . '/class-s3-uploads-stream-wrapper.php'; if ( ! empty( $this->s3 ) ) return $this->s3; Loading