Skip to content

Commit

Permalink
Merge pull request #9613 from awesomemotive/release/3.1.0.5
Browse files Browse the repository at this point in the history
Adding 3.1.0.5 release
  • Loading branch information
cklosowski authored Jan 25, 2023
2 parents 968c712 + 157d8e7 commit 3c5c8d2
Show file tree
Hide file tree
Showing 26 changed files with 828 additions and 413 deletions.
96 changes: 85 additions & 11 deletions .buildkite/pipeline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,12 @@ set -eu
# begin the pipeline.yml file
echo "steps:"

phpVersions=('7.0' '7.1' '7.2' '7.3' '7.4')
wpVersions=('5.0.18' '5.1.15' '5.2.17' '5.3.14' '5.4.12' '5.5.11' '5.6.10' '5.7.8' '5.8.6' '5.9.5' '6.0.3' 'latest')

# Exclude combinations with <php version>-<wp version>
exclusions=('7.3-4.9.22' '7.4-4.9.22' '7.4-5.0.18' '7.4-5.1.15' '7.4-5.2.17')
phpVersions=('7.4')
wpVersions=('5.4.12' '5.5.11' '5.6.10' '5.7.8' '5.8.6' '5.9.5' '6.0.3' 'latest')

# add a new command step to run the tests in each test directory
for phpVersion in ${phpVersions[@]}; do
for wpVersion in ${wpVersions[@]}; do

if [[ " ${exclusions[@]} " =~ " ${phpVersion}-${wpVersion} " ]]; then
continue
fi

echo " - env:"
echo " TEST_INPLACE: \"0\""
echo " TEST_PHP_VERSION: \""$phpVersion"\""
Expand Down Expand Up @@ -62,6 +54,8 @@ echo " pull-retries: 3"
echo " graceful-shutdown: true"
echo " run: wordpress"

# Now test legacy PHP versions and WordPress versions.

echo " - env:"
echo " TEST_INPLACE: \"0\""
echo " TEST_PHP_VERSION: \"5.6\""
Expand All @@ -80,4 +74,84 @@ echo " - TEST_INPLACE"
echo " propagate-uid-gid: true"
echo " pull-retries: 3"
echo " graceful-shutdown: true"
echo " run: wordpress"
echo " run: wordpress"

echo " - env:"
echo " TEST_INPLACE: \"0\""
echo " TEST_PHP_VERSION: \"7.0\""
echo " TEST_WP_VERSION: \"5.0.18\""
echo " WP_MULTISITE: \"0\""
echo " COMPOSE_HTTP_TIMEOUT: 180"
echo " DOCKER_CLIENT_TIMEOUT: 180"
echo " label: 'PHP: "7.0" | WP: "5.0.18" | Multisite: No'"
echo " plugins:"
echo " - docker-compose#v3.7.0:"
echo " config: docker-compose-phpunit.yml"
echo " cpus: 2.5"
echo " env:"
echo " - WP_MULTISITE"
echo " - TEST_INPLACE"
echo " propagate-uid-gid: true"
echo " pull-retries: 3"
echo " graceful-shutdown: true"
echo " run: wordpress"

echo " - env:"
echo " TEST_INPLACE: \"0\""
echo " TEST_PHP_VERSION: \"7.1\""
echo " TEST_WP_VERSION: \"5.1.15\""
echo " WP_MULTISITE: \"0\""
echo " COMPOSE_HTTP_TIMEOUT: 180"
echo " DOCKER_CLIENT_TIMEOUT: 180"
echo " label: 'PHP: "7.1" | WP: "5.1.15" | Multisite: No'"
echo " plugins:"
echo " - docker-compose#v3.7.0:"
echo " config: docker-compose-phpunit.yml"
echo " cpus: 2.5"
echo " env:"
echo " - WP_MULTISITE"
echo " - TEST_INPLACE"
echo " propagate-uid-gid: true"
echo " pull-retries: 3"
echo " graceful-shutdown: true"
echo " run: wordpress"

echo " - env:"
echo " TEST_INPLACE: \"0\""
echo " TEST_PHP_VERSION: \"7.2\""
echo " TEST_WP_VERSION: \"5.2.17\""
echo " WP_MULTISITE: \"0\""
echo " COMPOSE_HTTP_TIMEOUT: 180"
echo " DOCKER_CLIENT_TIMEOUT: 180"
echo " label: 'PHP: "7.2" | WP: "5.2.17" | Multisite: No'"
echo " plugins:"
echo " - docker-compose#v3.7.0:"
echo " config: docker-compose-phpunit.yml"
echo " cpus: 2.5"
echo " env:"
echo " - WP_MULTISITE"
echo " - TEST_INPLACE"
echo " propagate-uid-gid: true"
echo " pull-retries: 3"
echo " graceful-shutdown: true"
echo " run: wordpress"

echo " - env:"
echo " TEST_INPLACE: \"0\""
echo " TEST_PHP_VERSION: \"7.3\""
echo " TEST_WP_VERSION: \"5.3.14\""
echo " WP_MULTISITE: \"0\""
echo " COMPOSE_HTTP_TIMEOUT: 180"
echo " DOCKER_CLIENT_TIMEOUT: 180"
echo " label: 'PHP: "7.3" | WP: "5.3.14" | Multisite: No'"
echo " plugins:"
echo " - docker-compose#v3.7.0:"
echo " config: docker-compose-phpunit.yml"
echo " cpus: 2.5"
echo " env:"
echo " - WP_MULTISITE"
echo " - TEST_INPLACE"
echo " propagate-uid-gid: true"
echo " pull-retries: 3"
echo " graceful-shutdown: true"
echo " run: wordpress"
12 changes: 6 additions & 6 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
steps:

- label: "Pull PHP 5.6"
command: "docker pull public.ecr.aws/q7y6e9n2/unit-test-images/php:5.6"
command: "docker pull public.ecr.aws/q7y6e9n2/unit-test-images/php:5.6-legacy"
retry:
automatic: true

- wait

- label: "Pull PHP 7.0"
command: "docker pull public.ecr.aws/q7y6e9n2/unit-test-images/php:7.0"
command: "docker pull public.ecr.aws/q7y6e9n2/unit-test-images/php:7.0-legacy"
retry:
automatic: true

- label: "Pull PHP 7.1"
command: "docker pull public.ecr.aws/q7y6e9n2/unit-test-images/php:7.1"
command: "docker pull public.ecr.aws/q7y6e9n2/unit-test-images/php:7.1-legacy"
retry:
automatic: true

- wait

- label: "Pull PHP 7.2"
command: "docker pull public.ecr.aws/q7y6e9n2/unit-test-images/php:7.2"
command: "docker pull public.ecr.aws/q7y6e9n2/unit-test-images/php:7.2-legacy"
retry:
automatic: true

- label: "Pull PHP 7.3"
command: "docker pull public.ecr.aws/q7y6e9n2/unit-test-images/php:7.3"
command: "docker pull public.ecr.aws/q7y6e9n2/unit-test-images/php:7.3-legacy"
retry:
automatic: true

- wait

- label: "Pull PHP 7.4"
command: "docker pull public.ecr.aws/q7y6e9n2/unit-test-images/php:7.4"
command: "docker pull public.ecr.aws/q7y6e9n2/unit-test-images/php:7.4-legacy"
retry:
automatic: true

Expand Down
4 changes: 2 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = function( grunt ) {

// Clean up build directory
clean: {
main: [ 'build/<%= pkg.name %>' ],
main: [ 'build/**' ],
},

// Copy the plugin into the build directory
Expand Down Expand Up @@ -147,6 +147,6 @@ module.exports = function( grunt ) {
} );

// Build task(s).
grunt.registerTask( 'prep', [ 'force:checktextdomain', 'clean', 'replace' ] );
grunt.registerTask( 'prep', [ 'clean', 'force:checktextdomain', 'replace' ] );
grunt.registerTask( 'build', [ 'copy', 'compress' ] );
};
2 changes: 1 addition & 1 deletion assets/js/admin/components/chosen/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jQuery( document ).ready( function( $ ) {
// Add any option that doesn't already exist
$.each( data, function( key, item ) {
if ( ! $( 'option[value="' + item.id + '"]', select ).length ) {
select.prepend( '<option value="' + item.id + '">' + item.name + '</option>' );
select.append( '<option value="' + item.id + '">' + item.name + '</option>' );
}
} );

Expand Down
2 changes: 1 addition & 1 deletion assets/js/edd-admin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docker-compose-phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
version: "3.7"
services:
wordpress:
image: public.ecr.aws/q7y6e9n2/unit-test-images/php:${TEST_PHP_VERSION}
image: public.ecr.aws/q7y6e9n2/unit-test-images/php:${TEST_PHP_VERSION}-legacy
depends_on:
- mysql
volumes:
Expand Down
4 changes: 2 additions & 2 deletions easy-digital-downloads.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Description: The easiest way to sell digital products with WordPress.
* Author: Easy Digital Downloads
* Author URI: https://easydigitaldownloads.com
* Version: 3.1.0.4
* Version: 3.1.0.5
* Text Domain: easy-digital-downloads
* Domain Path: languages
* Requires PHP: 5.6
Expand All @@ -26,7 +26,7 @@
* @package EDD
* @category Core
* @author Easy Digital Downloads
* @version 3.1.0.4
* @version 3.1.0.5
*/

// Exit if accessed directly.
Expand Down
2 changes: 1 addition & 1 deletion includes/.blocks-hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
79f69a9565e7ffd6267294bf8e7cfa9a182dce47
966dbb903de4bd81492a05471b72ec8473906956
2 changes: 2 additions & 0 deletions includes/admin/downloads/metabox.php
Original file line number Diff line number Diff line change
Expand Up @@ -1331,3 +1331,5 @@ function edd_render_stats_meta_box() {
<?php
do_action('edd_stats_meta_box');
}

new EDD\Admin\Downloads\Meta();
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ class EDD_Batch_Earnings_Report_Export extends EDD_Batch_Export {
*/
public $export_type = 'earnings_report';

/**
* Refund amounts for partially refunded orders.
* Stored separately from the main data as it's only required for the net columns.
*
* @since 3.1.0.5
* @var array
*/
private $partial_refunds;

/**
* Set the export headers.
*
Expand Down Expand Up @@ -103,7 +112,7 @@ public function get_supported_statuses() {
unset( $statuses['pending'], $statuses['processing'], $statuses['preapproval'] );
$supported_statuses = array_keys( $statuses );

return apply_filters( 'edd_export_earnings_supported_statuses', $supported_statuses );
return array_unique( apply_filters( 'edd_export_earnings_supported_statuses', $supported_statuses ) );
}

/**
Expand Down Expand Up @@ -188,11 +197,9 @@ public function print_csv_rows() {
}
}

$supported_statuses = $this->get_supported_statuses();

$gross_count = 0;
$gross_amount = 0;
foreach ( $supported_statuses as $status ) {
foreach ( edd_get_gross_order_statuses() as $status ) {
$gross_count += absint( $data[ $status ]['count'] );
$gross_amount += $data[ $status ]['amount'];
}
Expand All @@ -212,7 +219,7 @@ public function print_csv_rows() {
}

// Allows extensions with other 'completed' statuses to alter net earnings, like recurring.
$completed_statuses = apply_filters( 'edd_export_earnings_completed_statuses', edd_get_complete_order_statuses() );
$completed_statuses = array_unique( apply_filters( 'edd_export_earnings_completed_statuses', edd_get_net_order_statuses() ) );

$net_count = 0;
$net_amount = 0;
Expand All @@ -223,6 +230,9 @@ public function print_csv_rows() {
$net_count += absint( $data[ $status ]['count'] );
$net_amount += floatval( $data[ $status ]['amount'] );
}
if ( ! empty( $this->partial_refunds ) ) {
$net_amount += floatval( $this->partial_refunds['total'] );
}
$row_data .= $net_count . ',';
$row_data .= '"' . edd_format_amount( $net_amount ) . '"';

Expand Down Expand Up @@ -265,15 +275,16 @@ public function get_data() {
$totals = $wpdb->get_results( $wpdb->prepare(
"SELECT SUM(total) AS total, COUNT(DISTINCT id) AS count, status
FROM {$wpdb->edd_orders}
WHERE date_created >= %s AND date_created <= %s
WHERE type = 'sale'
AND date_created >= %s AND date_created <= %s
GROUP BY YEAR(date_created), MONTH(date_created), status
ORDER by date_created ASC", $start_date, $end_date ), ARRAY_A );

$total_data = array();
foreach ( $totals as $row ) {
$total_data[ $row['status'] ] = array(
'count' => $row['count'],
'amount' => floatval( $row['total'] )
'amount' => floatval( $row['total'] ),
);
}

Expand All @@ -290,7 +301,30 @@ public function get_data() {
'amount' => $total_data[ $status ]['amount'],
);
}
}

// Get partial refund amounts to factor into net activity amounts.
$partial_refunds = $wpdb->get_results(
$wpdb->prepare(
"SELECT SUM(total) AS total, COUNT(DISTINCT id) AS count
FROM {$wpdb->edd_orders}
WHERE type = 'refund'
AND parent IN (
SELECT id
FROM {$wpdb->edd_orders}
WHERE status = 'partially_refunded'
AND date_created >= %s
AND date_created <= %s
GROUP BY YEAR(date_created), MONTH(date_created)
ORDER by date_created ASC
);",
$start_date,
$end_date
),
ARRAY_A
);
if ( ! empty( $partial_refunds ) ) {
$this->partial_refunds = reset( $partial_refunds );
}

$data = apply_filters( 'edd_export_get_data', $data );
Expand Down
22 changes: 13 additions & 9 deletions includes/admin/reporting/reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,9 @@ function edd_register_overview_report( $reports ) {
'data_callback' => function () use ( $dates ) {
$stats = new EDD\Stats();
return $stats->get_customer_count( array(
'range' => $dates['range'],
'relative' => true,
'range' => $dates['range'],
'relative' => true,
'purchase_count' => true,
) );
},
'display_args' => array(
Expand Down Expand Up @@ -2569,8 +2570,9 @@ function edd_register_customer_report( $reports ) {
'data_callback' => function () use ( $dates ) {
$stats = new EDD\Stats();
return $stats->get_customer_count( array(
'range' => $dates['range'],
'relative' => true,
'range' => $dates['range'],
'relative' => true,
'purchase_count' => true,
) );
},
'display_args' => array(
Expand Down Expand Up @@ -2663,11 +2665,13 @@ function edd_register_customer_report( $reports ) {

$results = $wpdb->get_results( $wpdb->prepare(
"SELECT COUNT(c.id) AS total, {$sql_clauses['select']}
FROM {$wpdb->edd_customers} c
WHERE c.date_created >= %s AND c.date_created <= %s
GROUP BY {$sql_clauses['groupby']}
ORDER BY {$sql_clauses['orderby']} ASC",
$dates['start']->copy()->format( 'mysql' ), $dates['end']->copy()->format( 'mysql' ) ) );
FROM {$wpdb->edd_customers} c
WHERE c.date_created >= %s AND c.date_created <= %s
AND c.purchase_count > 0
GROUP BY {$sql_clauses['groupby']}
ORDER BY {$sql_clauses['orderby']} ASC",
$dates['start']->copy()->format( 'mysql' ),
$dates['end']->copy()->format( 'mysql' ) ) );

$customers = array();

Expand Down
Loading

0 comments on commit 3c5c8d2

Please sign in to comment.