Loading data/composer.json +1 −7 Original line number Diff line number Diff line { "type": "project", "license": "MPL-2.0", "repositories": [ { "type": "gitlab", "url": "https://code.kodo.org.uk/singing-chimes.co.uk/s3-uploads" } ], "require": { "humanmade/s3-uploads": "dev-develop", "humanmade/s3-uploads": "3.0.7", "ayesh/wordpress-password-hash": "2.*" }, "config": { Loading plugins/docker-integration.php +31 −21 Original line number Diff line number Diff line <?php /** * Copyright 2019-2021 Dominik Sekotill <dom.sekotill@kodo.org.uk> * Copyright 2019-2021, 2024 Dominik Sekotill <dom.sekotill@kodo.org.uk> * * Plugin Name: Docker Image Integration * Plugin URI: https://code.kodo.org.uk/singing-chimes.co.uk/wordpress/tree/master/plugins Loading @@ -12,25 +12,6 @@ */ // Media URL Fix add_action( 'plugins_loaded', function() { add_filter( 'upload_dir', function( $paths ) { $baseurl = parse_url( $paths['baseurl'] ); $fullurl = parse_url( $paths['url'] ); $subdir = $paths['subdir']; $baseurl['path'] = '/media'; $fullurl['path'] = '/media' . ($subdir ? "/{$subdir}" : ''); $paths['baseurl'] = unparse_url( $baseurl ); $paths['url'] = unparse_url( $fullurl ); return $paths; }); }); // Block File Modification add_filter( Loading Loading @@ -84,7 +65,6 @@ add_filter( $params['disable_host_prefix_injection'] = true; $params['use_path_style_endpoint'] = true; $params['debug'] = WP_DEBUG && WP_DEBUG_DISPLAY; $params['region'] = ''; return $params; } ); Loading @@ -92,6 +72,36 @@ add_filter( endif; // Media URL Fix add_action( 'plugins_loaded', function() { add_filter( 'upload_dir', function( array $paths ) : array { $baseurl = parse_url( $paths['baseurl'] ); $fullurl = parse_url( $paths['url'] ); $subdir = $paths['subdir'] ?? ''; if ( defined( 'S3_UPLOADS_ENDPOINT_URL' ) ) { $s3 = S3_Uploads\Plugin::get_instance(); $basedir = str_replace( $paths['basedir'], $s3->get_s3_path(), $paths['basedir'] ); $paths['basedir'] = $basedir; $paths['path'] = "{$basedir}{$subdir}"; $baseurl = parse_url( $s3->get_s3_url() ); $fullurl = $baseurl; $fullurl['path'] = ($fullurl['path'] ?? '') . $subdir; } else { $baseurl['path'] = '/media'; $fullurl['path'] = '/media' . $subdir; } $paths['baseurl'] = unparse_url( $baseurl ); $paths['url'] = unparse_url( $fullurl ); return $paths; }); }); // Functions function unparse_url( array $parts ) { Loading scripts/entrypoint.sh +2 −5 Original line number Diff line number Diff line #!/bin/bash # # Copyright 2019-2023 Dominik Sekotill <dom.sekotill@kodo.org.uk> # Copyright 2019-2024 Dominik Sekotill <dom.sekotill@kodo.org.uk> # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this Loading Loading @@ -118,9 +118,6 @@ setup_s3() { [[ -v S3_ENDPOINT_SECRET ]] || return 0 composer update --prefer-dist --no-dev --with-dependencies \ humanmade/s3-uploads [[ -v S3_UPLOADS_USE_LOCAL ]] && wp config set S3_UPLOADS_USE_LOCAL true --raw Loading @@ -135,7 +132,7 @@ setup_s3() { wp config set S3_UPLOADS_SECRET ${S3_ENDPOINT_SECRET} --quiet # Plugin requires something here, it's not used wp config set S3_UPLOADS_REGION '' wp config set S3_UPLOADS_REGION 'eu-west-1' # Due to what appears to be a bug in the plugin, this MUST be a non-empty # string; mostly it just affects the log output Loading Loading
data/composer.json +1 −7 Original line number Diff line number Diff line { "type": "project", "license": "MPL-2.0", "repositories": [ { "type": "gitlab", "url": "https://code.kodo.org.uk/singing-chimes.co.uk/s3-uploads" } ], "require": { "humanmade/s3-uploads": "dev-develop", "humanmade/s3-uploads": "3.0.7", "ayesh/wordpress-password-hash": "2.*" }, "config": { Loading
plugins/docker-integration.php +31 −21 Original line number Diff line number Diff line <?php /** * Copyright 2019-2021 Dominik Sekotill <dom.sekotill@kodo.org.uk> * Copyright 2019-2021, 2024 Dominik Sekotill <dom.sekotill@kodo.org.uk> * * Plugin Name: Docker Image Integration * Plugin URI: https://code.kodo.org.uk/singing-chimes.co.uk/wordpress/tree/master/plugins Loading @@ -12,25 +12,6 @@ */ // Media URL Fix add_action( 'plugins_loaded', function() { add_filter( 'upload_dir', function( $paths ) { $baseurl = parse_url( $paths['baseurl'] ); $fullurl = parse_url( $paths['url'] ); $subdir = $paths['subdir']; $baseurl['path'] = '/media'; $fullurl['path'] = '/media' . ($subdir ? "/{$subdir}" : ''); $paths['baseurl'] = unparse_url( $baseurl ); $paths['url'] = unparse_url( $fullurl ); return $paths; }); }); // Block File Modification add_filter( Loading Loading @@ -84,7 +65,6 @@ add_filter( $params['disable_host_prefix_injection'] = true; $params['use_path_style_endpoint'] = true; $params['debug'] = WP_DEBUG && WP_DEBUG_DISPLAY; $params['region'] = ''; return $params; } ); Loading @@ -92,6 +72,36 @@ add_filter( endif; // Media URL Fix add_action( 'plugins_loaded', function() { add_filter( 'upload_dir', function( array $paths ) : array { $baseurl = parse_url( $paths['baseurl'] ); $fullurl = parse_url( $paths['url'] ); $subdir = $paths['subdir'] ?? ''; if ( defined( 'S3_UPLOADS_ENDPOINT_URL' ) ) { $s3 = S3_Uploads\Plugin::get_instance(); $basedir = str_replace( $paths['basedir'], $s3->get_s3_path(), $paths['basedir'] ); $paths['basedir'] = $basedir; $paths['path'] = "{$basedir}{$subdir}"; $baseurl = parse_url( $s3->get_s3_url() ); $fullurl = $baseurl; $fullurl['path'] = ($fullurl['path'] ?? '') . $subdir; } else { $baseurl['path'] = '/media'; $fullurl['path'] = '/media' . $subdir; } $paths['baseurl'] = unparse_url( $baseurl ); $paths['url'] = unparse_url( $fullurl ); return $paths; }); }); // Functions function unparse_url( array $parts ) { Loading
scripts/entrypoint.sh +2 −5 Original line number Diff line number Diff line #!/bin/bash # # Copyright 2019-2023 Dominik Sekotill <dom.sekotill@kodo.org.uk> # Copyright 2019-2024 Dominik Sekotill <dom.sekotill@kodo.org.uk> # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this Loading Loading @@ -118,9 +118,6 @@ setup_s3() { [[ -v S3_ENDPOINT_SECRET ]] || return 0 composer update --prefer-dist --no-dev --with-dependencies \ humanmade/s3-uploads [[ -v S3_UPLOADS_USE_LOCAL ]] && wp config set S3_UPLOADS_USE_LOCAL true --raw Loading @@ -135,7 +132,7 @@ setup_s3() { wp config set S3_UPLOADS_SECRET ${S3_ENDPOINT_SECRET} --quiet # Plugin requires something here, it's not used wp config set S3_UPLOADS_REGION '' wp config set S3_UPLOADS_REGION 'eu-west-1' # Due to what appears to be a bug in the plugin, this MUST be a non-empty # string; mostly it just affects the log output Loading