Skip to content

Commit

Permalink
Merge branch 'develop' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
dkotter committed Jul 15, 2024
2 parents eade6a0 + 9024dff commit 246f3fe
Show file tree
Hide file tree
Showing 22 changed files with 618 additions and 3,693 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
matrix:
core:
- {name: 'WP latest', version: 'latest'}
- {name: 'WP minimum', version: 'WordPress/WordPress#6.3'}
- {name: 'WP minimum', version: 'WordPress/WordPress#6.4'}
- {name: 'WP trunk', version: 'WordPress/WordPress#master'}
steps:
- name: Checkout
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file, per [the Ke

## [Unreleased] - TBD

## [4.5.0] - 2024-07-15
### Added
- Feature to replace images at the blob storage level (props [@hugosolar](https://github.com/hugosolar), [@rickalee](https://github.com/rickalee), [@dkotter](https://github.com/dkotter) via [#230](https://github.com/10up/windows-azure-storage/pull/230)).
- Constant for `MICROSOFT_AZURE_OVERRIDE_CONTAINER_PATH` (props [@rickalee](https://github.com/rickalee), [@engrshakirali](https://github.com/engrshakirali), [@hugosolar](https://github.com/hugosolar) via [#240](https://github.com/10up/windows-azure-storage/pull/240)).

### Changed
- Bump WordPress "tested up to" version 6.6 (props [@hugosolar](https://github.com/hugosolar), [@jeffpaul](https://github.com/jeffpaul) via [#242](https://github.com/10up/windows-azure-storage/pull/242)).
- Update WordPress minimum supported version to 6.4 (props [@hugosolar](https://github.com/hugosolar), [@jeffpaul](https://github.com/jeffpaul) via [#242](https://github.com/10up/windows-azure-storage/pull/242)).

### Removed
- Image with special character which isn't needed anymore (props [@hugosolar](https://github.com/hugosolar), [@dkotter](https://github.com/dkotter), [@rickalee](https://github.com/rickalee), [@jeffpaul](https://github.com/jeffpaul) via [#234](https://github.com/10up/windows-azure-storage/pull/234)).

### Fixed
- Issue with the use of `array_flip` and not ensuring it was an actual array (props [@hugosolar](https://github.com/hugosolar), [@rickalee](https://github.com/rickalee), [@dkotter](https://github.com/dkotter) via [#230](https://github.com/10up/windows-azure-storage/pull/230)).
- `webp` compatibility when uploading original images (props [@hugosolar](https://github.com/hugosolar), [@rickalee](https://github.com/rickalee), [@ali-awwad](https://github.com/ali-awwad) via [#231](https://github.com/10up/windows-azure-storage/pull/231)).
- Issue with unchecking year/month option under Settings > Media causes intermediate images not being uploaded to the container (props [@hugosolar](https://github.com/hugosolar), [@rickalee](https://github.com/rickalee), [@glowmedia](https://github.com/glowmedia) via [#232](https://github.com/10up/windows-azure-storage/pull/232)).
- Media uploader title "Uploading to Azure..." stuck after image is uploaded (props [@hugosolar](https://github.com/hugosolar), [@rickalee](https://github.com/rickalee), [@eflorea](https://github.com/eflorea) via [#233](https://github.com/10up/windows-azure-storage/pull/233)).
- Issue with enqueuing admin script in the footer (props [@hugosolar](https://github.com/hugosolar), [@rickalee](https://github.com/rickalee) via [#238](https://github.com/10up/windows-azure-storage/pull/238)).

## [4.4.2] - 2024-05-06
**Note that this release bumps the minimum WordPress version from 5.7 to 6.3.**

Expand Down Expand Up @@ -266,6 +285,8 @@ All notable changes to this project will be documented in this file, per [the Ke
- First release of Microsoft Azure Storage plugin for WordPress.

[Unreleased]: https://github.com/10up/windows-azure-storage/compare/trunk...develop
[4.5.0]: https://github.com/10up/windows-azure-storage/compare/4.4.2...4.5.0
[4.4.2]: https://github.com/10up/windows-azure-storage/compare/4.4.1...4.4.2
[4.4.1]: https://github.com/10up/windows-azure-storage/compare/4.4.0...4.4.1
[4.4.0]: https://github.com/10up/windows-azure-storage/compare/4.3.5...4.4.0
[4.3.5]: https://github.com/10up/windows-azure-storage/compare/4.3.4...4.3.5
Expand Down
2 changes: 1 addition & 1 deletion CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The following individuals are responsible for curating the list of issues, respo

Thank you to all the people who have already contributed to this repository via bug reports, code, design, ideas, project management, translation, testing, etc.

[Microsoft Open Technologies (@msopentech)](https://github.com/msopentech), [10up (@10up)](https://github.com/10up), [Morgan Estes (@morganestes)](https://github.com/morganestes), [Steve Grunwell (@stevegrunwell)](https://github.com/stevegrunwell), [Lukas Pawlik (@lukaspawlik)](https://github.com/lukaspawlik), [Ritesh Patel (@Ritesh-patel)](https://github.com/Ritesh-patel), [Peter Sorensen (@psorensen)](https://github.com/psorensen), [Eugene Manuilov (@eugene-manuilov)](https://github.com/eugene-manuilov), [Allan Collins (@allan23)](https://github.com/allan23), [(@jpaarhuis)](https://github.com/jpaarhuis), [Thorsten Ott (@tott)](https://github.com/tott), [Scott Lee (@scottlee)](https://github.com/scottlee), [Emmanuel Fidelino (@EmmanF)](https://github.com/EmmanF), [Joey Blake (@joeyblake)](https://github.com/joeyblake), [(@mrgregwaugh)](https://github.com/mrgregwaugh), [Elliott Stocks (@elliott-stocks)](https://github.com/elliott-stocks), [Brad Parbs (@bradp)](https://github.com/bradp), [Bibin Kurian (@bibinkurian)](https://github.com/bibinkurian), [Anu Thomas Chandy (@anuchandy)](https://github.com/anuchandy), [Suman Chawla (@suchawla)](https://github.com/suchawla), [(@mksunitha)](https://profiles.wordpress.org/mksunitha/), [Justin Kopepasah (@kopepasah)](https://github.com/kopepasah), [John Watkins (@johnwatkins0)](https://github.com/johnwatkins0), [Eduard Florea (@eflorea)](https://github.com/eflorea), [Jay Wood (@jaywood)](https://github.com/jaywood), [Ravi Chandra (@ravichdev)](https://github.com/ravichdev), [Ricky Lee Whittemore (@rickalee)](https://github.com/rickalee), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Oscar Sanchez S. (@oscarssanchez)](https://github.com/oscarssanchez), [Ricardo Moraleida (@moraleida)](https://github.com/moraleida), [Kentaro Ohkouchi (@nanasess)](https://github.com/nanasess), [David Greenwald (@davidegreenwald)](https://github.com/davidegreenwald), [Shah Qureshi (@ShahAaron)](https://github.com/ShahAaron), [(@lostfields)](https://github.com/lostfields), [Matthew McAchran (@mmcachran)](https://github.com/mmcachran), [Jake Edwards (@ShadowXVII)](https://github.com/ShadowXVII), [Cole Geissinger (@colegeissinger)](https://github.com/colegeissinger), [(@cally423)](https://github.com/cally423), [(@FreuxF)](https://github.com/FreuxF), [Eric Greenfield (@saltnpixels)](https://github.com/saltnpixels), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc), [Max Lyuchin (@cadic)](https://github.com/cadic), [Marius L. Jensen (@Clorith)](https://github.com/Clorith), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Debabrata Karfa (@debabratakarfa)](https://github.com/debabratakarfa), [Sudip Dadhaniya (@sudip-10up)](https://github.com/sudip-10up), [Curtis Loisel (@csloisel)](https://github.com/csloisel), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Jayedul Kabir (@jayedul)](https://github.com/jayedul), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [Andrew Herder (@superpowered)](https://github.com/superpowered), [Giovanbattista Amato (@gioamato)](https://github.com/gioamato), [Barney Jeffries (@barneyjeffries)](https://github.com/barneyjeffries), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [Ben Marshall (@bmarshall511)](https://github.com/bmarshall511), [Thrijith Thankachan (@thrijith)](https://github.com/thrijith), [Harshal Kadu (@QAharshalkadu)](https://github.com/QAharshalkadu), [Radovan Šmitala (@radeno)](https://github.com/radeno), [Ravinder Kumar (@ravinderk)](https://github.com/ravinderk), [Hugo Solar (@hugosolar)](https://github.com/hugosolar), [Mark Waser (@MWaser)](https://github.com/MWaser), [Oka Tai-Lee (@okadots)](https://github.com/okadots), [Sarah Nicholson (@sarahannnicholson)](https://github.com/sarahannnicholson), [Nicola Peluchetti (@nicoladj77)](https://github.com/nicoladj77).
[Microsoft Open Technologies (@msopentech)](https://github.com/msopentech), [10up (@10up)](https://github.com/10up), [Morgan Estes (@morganestes)](https://github.com/morganestes), [Steve Grunwell (@stevegrunwell)](https://github.com/stevegrunwell), [Lukas Pawlik (@lukaspawlik)](https://github.com/lukaspawlik), [Ritesh Patel (@Ritesh-patel)](https://github.com/Ritesh-patel), [Peter Sorensen (@psorensen)](https://github.com/psorensen), [Eugene Manuilov (@eugene-manuilov)](https://github.com/eugene-manuilov), [Allan Collins (@allan23)](https://github.com/allan23), [(@jpaarhuis)](https://github.com/jpaarhuis), [Thorsten Ott (@tott)](https://github.com/tott), [Scott Lee (@scottlee)](https://github.com/scottlee), [Emmanuel Fidelino (@EmmanF)](https://github.com/EmmanF), [Joey Blake (@joeyblake)](https://github.com/joeyblake), [(@mrgregwaugh)](https://github.com/mrgregwaugh), [Elliott Stocks (@elliott-stocks)](https://github.com/elliott-stocks), [Brad Parbs (@bradp)](https://github.com/bradp), [Bibin Kurian (@bibinkurian)](https://github.com/bibinkurian), [Anu Thomas Chandy (@anuchandy)](https://github.com/anuchandy), [Suman Chawla (@suchawla)](https://github.com/suchawla), [(@mksunitha)](https://profiles.wordpress.org/mksunitha/), [Justin Kopepasah (@kopepasah)](https://github.com/kopepasah), [John Watkins (@johnwatkins0)](https://github.com/johnwatkins0), [Eduard Florea (@eflorea)](https://github.com/eflorea), [Jay Wood (@jaywood)](https://github.com/jaywood), [Ravi Chandra (@ravichdev)](https://github.com/ravichdev), [Ricky Lee Whittemore (@rickalee)](https://github.com/rickalee), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Oscar Sanchez S. (@oscarssanchez)](https://github.com/oscarssanchez), [Ricardo Moraleida (@moraleida)](https://github.com/moraleida), [Kentaro Ohkouchi (@nanasess)](https://github.com/nanasess), [David Greenwald (@davidegreenwald)](https://github.com/davidegreenwald), [Shah Qureshi (@ShahAaron)](https://github.com/ShahAaron), [(@lostfields)](https://github.com/lostfields), [Matthew McAchran (@mmcachran)](https://github.com/mmcachran), [Jake Edwards (@ShadowXVII)](https://github.com/ShadowXVII), [Cole Geissinger (@colegeissinger)](https://github.com/colegeissinger), [(@cally423)](https://github.com/cally423), [(@FreuxF)](https://github.com/FreuxF), [Eric Greenfield (@saltnpixels)](https://github.com/saltnpixels), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc), [Max Lyuchin (@cadic)](https://github.com/cadic), [Marius L. Jensen (@Clorith)](https://github.com/Clorith), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Debabrata Karfa (@debabratakarfa)](https://github.com/debabratakarfa), [Sudip Dadhaniya (@sudip-10up)](https://github.com/sudip-10up), [Curtis Loisel (@csloisel)](https://github.com/csloisel), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Jayedul Kabir (@jayedul)](https://github.com/jayedul), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [Andrew Herder (@superpowered)](https://github.com/superpowered), [Giovanbattista Amato (@gioamato)](https://github.com/gioamato), [Barney Jeffries (@barneyjeffries)](https://github.com/barneyjeffries), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [Ben Marshall (@bmarshall511)](https://github.com/bmarshall511), [Thrijith Thankachan (@thrijith)](https://github.com/thrijith), [Harshal Kadu (@QAharshalkadu)](https://github.com/QAharshalkadu), [Radovan Šmitala (@radeno)](https://github.com/radeno), [Ravinder Kumar (@ravinderk)](https://github.com/ravinderk), [Hugo Solar (@hugosolar)](https://github.com/hugosolar), [Mark Waser (@MWaser)](https://github.com/MWaser), [Oka Tai-Lee (@okadots)](https://github.com/okadots), [Sarah Nicholson (@sarahannnicholson)](https://github.com/sarahannnicholson), [Nicola Peluchetti (@nicoladj77)](https://github.com/nicoladj77), [Shakir Ali (@engrshakirali)](https://github.com/engrshakirali), [Ali Awwad (@ali-awwad)](https://github.com/ali-awwad), [(@glowmedia)](https://github.com/glowmedia).

## Libraries

Expand Down
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
> Use the Microsoft Azure Storage service to host your website's media files.
[![Support Level](https://img.shields.io/badge/support-stable-blue.svg)](#support-level) [![Release Version](https://img.shields.io/github/release/10up/windows-azure-storage.svg)](https://github.com/10up/windows-azure-storage/releases/latest) ![WordPress tested up to version](https://img.shields.io/wordpress/plugin/tested/windows-azure-storage?label=WordPress) [![BSD 2-Clause License](https://img.shields.io/github/license/10up/windows-azure-storage.svg)](https://github.com/10up/windows-azure-storage/blob/trunk/LICENSE)
[![E2E test](https://github.com/10up/windows-azure-storage/actions/workflows/cypress.yml/badge.svg)](https://github.com/10up/windows-azure-storage/actions/workflows/cypress.yml) [![PHP Compatibility](https://github.com/10up/windows-azure-storage/actions/workflows/php-compatibility.yml/badge.svg)](https://github.com/10up/windows-azure-storage/actions/workflows/php-compatibility.yml) [![Dependency Review](https://github.com/10up/windows-azure-storage/actions/workflows/dependency-review.yml/badge.svg)](https://github.com/10up/windows-azure-storage/actions/workflows/dependency-review.yml)

## Description

Expand All @@ -15,7 +16,7 @@ For more details on configuring a Microsoft Azure Storage account and on using t
## Requirements

* PHP 8.0+ (For PHP 7.4 support you need to use 4.3.5)
* [WordPress](http://wordpress.org/) 5.7+
* [WordPress](http://wordpress.org/) 6.4+

## Installation

Expand All @@ -30,18 +31,9 @@ For multisites or to enforce Azure Blob Storage settings, you can define the fol
* MICROSOFT_AZURE_CONTAINER - Azure Blob Container
* MICROSOFT_AZURE_CNAME - Domain: must start with http(s)://
* MICROSOFT_AZURE_USE_FOR_DEFAULT_UPLOAD - boolean (default false)

* MICROSOFT_AZURE_OVERRIDE_CONTAINER_PATH - Override Container name in the Image URL , can be just "/"
See Settings->Microsoft Azure for more information.

## Upgrade Notice

### 3.0.0
This release features several security fixes and enhancements.
It is highly recommended that all users upgrade immediately.

## Support Level
**Stable:** 10up is not planning to develop any new features for this, but will still respond to bug reports and security concerns. We welcome PRs, but any that include new features should be small and easy to integrate and should not include breaking changes. We otherwise intend to keep this tested up to the most recent version of WordPress.

## Known Issues

### Storage Account Versions
Expand Down Expand Up @@ -70,6 +62,9 @@ Data should be updated in these tables:
2. Directly inside WordPress, using the [Better Search Replace plugin](https://wordpress.org/plugins/better-search-replace/).
3. Using an external tool that supports PHP serialization, like [Search Replace DB](https://github.com/interconnectit/Search-Replace-DB).

## Support Level
**Stable:** 10up is not planning to develop any new features for this, but will still respond to bug reports and security concerns. We welcome PRs, but any that include new features should be small and easy to integrate and should not include breaking changes. We otherwise intend to keep this tested up to the most recent version of WordPress.

## Changelog

A complete listing of all notable changes to Microsoft Azure Storage are documented in [CHANGELOG.md](https://github.com/10up/windows-azure-storage/blob/develop/CHANGELOG.md).
Expand Down
Binary file removed images/Azure 2017.png
Binary file not shown.
20 changes: 17 additions & 3 deletions includes/class-windows-azure-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,19 @@ static public function get_account_key() {
: get_option( 'azure_storage_account_primary_access_key' );
}

/**
* Return override container name.
*
* @since 4.5.0
*
* @return mixed|void Account key.
*/
static public function get_azure_storage_override_container_path() {
return defined( 'MICROSOFT_AZURE_OVERRIDE_CONTAINER_PATH' )
? MICROSOFT_AZURE_OVERRIDE_CONTAINER_PATH
: get_option( 'azure_storage_override_container_path' );
}

/**
* Return CNAME url.
*
Expand Down Expand Up @@ -509,10 +522,11 @@ static public function put_media_to_blob_storage( $container_name, $blob_name, $
* @param string $source_path Local path.
* @param string $account_name Account name.
* @param string $account_key Account key.
* @param int $cache Max-age cache
*
* @return bool|string|WP_Error False or WP_Error on failure URI on success.
*/
static public function copy_media_to_blob_storage( $container_name, $destination_path, $source_path, $mime_type, $account_name = '', $account_key = '' ) {
static public function copy_media_to_blob_storage( $container_name, $destination_path, $source_path, $mime_type, $account_name = '', $account_key = '', $cache = null ) {
list( $account_name, $account_key ) = self::get_api_credentials( $account_name, $account_key );
$rest_api_client = new Windows_Azure_Rest_Api_Client( $account_name, $account_key );

Expand All @@ -521,12 +535,12 @@ static public function copy_media_to_blob_storage( $container_name, $destination
return $result;
}

$cache_control = Windows_Azure_Helper::get_cache_control();
$cache_control = ( empty( $cache ) ) ? Windows_Azure_Helper::get_cache_control() : $cache;
if ( is_numeric( $cache_control ) ) {
$cache_control = sprintf( "max-age=%d, must-revalidate", $cache_control );
}

$rest_api_client->put_blob_properties( $container_name, $destination_path, array(
$rest_api_client->put_blob_properties( $container_name, $source_path, array(
Windows_Azure_Rest_Api_Client::API_HEADER_MS_BLOB_CONTENT_TYPE => $mime_type,
Windows_Azure_Rest_Api_Client::API_HEADER_MS_BLOB_CACHE_CONTROL => apply_filters( 'windows_azure_blob_cache_control', $cache_control ),
Windows_Azure_Rest_Api_Client::API_HEADER_MS_ACCESS_TIER => apply_filters( 'windows_azure_blob_access_tier', 'Hot' ),
Expand Down
Loading

0 comments on commit 246f3fe

Please sign in to comment.