From b6e8ec21c8b2241b5765075fe0e7ce36db9136e6 Mon Sep 17 00:00:00 2001 From: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com> Date: Fri, 21 Oct 2022 11:38:45 +1100 Subject: [PATCH 1/8] Merge pull request #961 from 10up/fix/rename-blacklist Change from using the term `blacklist` to `excluded` --- CHANGELOG.md | 4 +-- includes/utils.php | 59 ++++++++++++++++++++++++++++++----------- tests/php/UtilsTest.php | 49 ++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07bd0d580..e8d5caadf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -288,7 +288,7 @@ All notable changes to this project will be documented in this file, per [the Ke - Add `dt_allowed_media_extensions` and `dt_media_processing_filename` filters so that different media types or specific files can be detected and targeted. ### Fixed -- Ensure media meta is passed through `prepare_meta()` to apply the blacklist. This completes the generated image size info fix from 1.3.3. +- Ensure media meta is passed through `prepare_meta()` to apply the exclusion. This completes the generated image size info fix from 1.3.3. - Avoid a PHP notice when only using the block editor on the receiving site. - Avoid a jQuery Migrate notice. @@ -370,7 +370,7 @@ This adds a post type selector when viewing the Pull Content list for both exter ### Changed - Don’t set Distributor meta data on REST API post creation unless post was created by Distributor -- Blacklist the `_wp_old_slug` and `_wp_old_date` meta +- Exclude the `_wp_old_slug` and `_wp_old_date` meta - Disable pull UI while switching between pull connections ### Fixed diff --git a/includes/utils.php b/includes/utils.php index 4118e0f2c..a88e7b8c8 100644 --- a/includes/utils.php +++ b/includes/utils.php @@ -181,17 +181,17 @@ function is_dt_debug() { /** * Given an array of meta, set meta to another post. * - * Don't copy in blacklisted (Distributor) meta. + * Don't copy in excluded (Distributor) meta. * * @param int $post_id Post ID. * @param array $meta Array of meta as key => value */ function set_meta( $post_id, $meta ) { - $existing_meta = get_post_meta( $post_id ); - $blacklisted_meta = blacklisted_meta(); + $existing_meta = get_post_meta( $post_id ); + $excluded_meta = excluded_meta(); foreach ( $meta as $meta_key => $meta_values ) { - if ( in_array( $meta_key, $blacklisted_meta, true ) ) { + if ( in_array( $meta_key, $excluded_meta, true ) ) { continue; } @@ -219,8 +219,8 @@ function set_meta( $post_id, $meta ) { /** * Fires after Distributor sets post meta. * - * Note: All sent meta is included in the `$meta` array, including blacklisted keys. - * Take care to continue to filter out blacklisted keys in any further meta setting. + * Note: All sent meta is included in the `$meta` array, including excluded keys. + * Take care to continue to filter out excluded keys in any further meta setting. * * @since 1.3.8 * @hook dt_after_set_meta @@ -366,23 +366,36 @@ function distributable_post_statuses() { } /** - * Returns list of blacklisted meta keys + * Returns list of excluded meta keys * * @since 1.2 + * @deprecated X.X.X Use excluded_meta() * @return array */ function blacklisted_meta() { + _deprecated_function( __FUNCTION__, 'X.X.X', '\Distributor\Utils\excluded_meta()' ); + return excluded_meta(); +} + +/** + * Returns list of excluded meta keys + * + * @since X.X.X + * @return array + */ +function excluded_meta() { + /** - * Filter meta keys that are blacklisted from distribution. + * Filter meta keys that are excluded from distribution. * * @since 1.0.0 - * @hook dt_blacklisted_meta + * @deprecated x.x.x * - * @param {array} $meta_keys Blacklisted meta keys. Default `dt_unlinked, dt_connection_map, dt_subscription_update, dt_subscriptions, dt_subscription_signature, dt_original_post_id, dt_original_post_url, dt_original_blog_id, dt_syndicate_time, _wp_attached_file, _wp_attachment_metadata, _edit_lock, _edit_last, _wp_old_slug, _wp_old_date`. + * @param array $meta_keys Excluded meta keys. * - * @return {array} Blacklisted meta keys. + * @return array Excluded meta keys. */ - return apply_filters( + $excluded_meta = apply_filters_deprecated( 'dt_blacklisted_meta', [ 'dt_unlinked', @@ -400,8 +413,23 @@ function blacklisted_meta() { '_edit_last', '_wp_old_slug', '_wp_old_date', - ] + ], + 'X.X.X', + 'dt_excluded_meta', + __( 'Please consider writing more inclusive code.', 'distributor' ) ); + + /** + * Filter meta keys that are excluded from distribution. + * + * @since X.X.X + * @hook dt_excluded_meta + * + * @param {array} $meta_keys Excluded meta keys. Default `dt_unlinked, dt_connection_map, dt_subscription_update, dt_subscriptions, dt_subscription_signature, dt_original_post_id, dt_original_post_url, dt_original_blog_id, dt_syndicate_time, _wp_attached_file, _wp_attachment_metadata, _edit_lock, _edit_last, _wp_old_slug, _wp_old_date`. + * + * @return {array} Excluded meta keys. + */ + return apply_filters( 'dt_excluded_meta', $excluded_meta ); } /** @@ -414,13 +442,12 @@ function blacklisted_meta() { function prepare_meta( $post_id ) { $meta = get_post_meta( $post_id ); $prepared_meta = array(); - - $blacklisted_meta = blacklisted_meta(); + $excluded_meta = excluded_meta(); // Transfer all meta foreach ( $meta as $meta_key => $meta_array ) { foreach ( $meta_array as $meta_value ) { - if ( ! in_array( $meta_key, $blacklisted_meta, true ) ) { + if ( ! in_array( $meta_key, $excluded_meta, true ) ) { $meta_value = maybe_unserialize( $meta_value ); /** * Filter whether to sync meta. diff --git a/tests/php/UtilsTest.php b/tests/php/UtilsTest.php index 9ed291375..02c15d3e3 100644 --- a/tests/php/UtilsTest.php +++ b/tests/php/UtilsTest.php @@ -53,6 +53,13 @@ public function test_set_meta_simple() { ] ); + \WP_Mock::userFunction( + 'apply_filters_deprecated', + [ + 'return_arg' => 1, + ] + ); + \WP_Mock::expectAction( 'dt_after_set_meta', [ 'key' => [ 'value' ] ], [], 1 ); \WP_Mock::expectAction( 'dt_after_set_meta', [ 'key' => [ [ 'value' ] ] ], [ 'key' => [ 'value' ] ], 1 ); @@ -143,6 +150,13 @@ public function test_set_meta_multi() { ] ); + \WP_Mock::userFunction( + 'apply_filters_deprecated', + [ + 'return_arg' => 1, + ] + ); + Utils\set_meta( 1, [ 'key' => [ 'value' ], @@ -202,6 +216,13 @@ public function test_set_meta_serialize() { ] ); + \WP_Mock::userFunction( + 'apply_filters_deprecated', + [ + 'return_arg' => 1, + ] + ); + Utils\set_meta( 1, [ 'key' => [ 'value' ], @@ -517,6 +538,13 @@ public function test_format_media_not_featured() { ] ); + \WP_Mock::userFunction( + 'apply_filters_deprecated', + [ + 'return_arg' => 1, + ] + ); + $formatted_media = Utils\format_media_post( $media_post ); $this->assertFalse( $formatted_media['featured'] ); @@ -605,6 +633,13 @@ public function test_format_media_featured() { ] ); + \WP_Mock::userFunction( + 'apply_filters_deprecated', + [ + 'return_arg' => 1, + ] + ); + $formatted_media = Utils\format_media_post( $media_post ); $this->assertTrue( $formatted_media['featured'] ); @@ -693,6 +728,13 @@ public function test_format_media_no_attachment_meta() { ] ); + \WP_Mock::userFunction( + 'apply_filters_deprecated', + [ + 'return_arg' => 1, + ] + ); + $formatted_media = Utils\format_media_post( $media_post ); $this->assertFalse( array_key_exists( '_wp_attachment_metadata', $formatted_media['meta'] ) ); @@ -855,6 +897,13 @@ public function test_set_media() { ] ); + \WP_Mock::userFunction( + 'apply_filters_deprecated', + [ + 'return_arg' => 1, + ] + ); + Utils\set_media( $post_id, [ $media_item ], [ 'use_filesystem' => false ] ); } From 65169781b62e4502668e80d58eef670874605737 Mon Sep 17 00:00:00 2001 From: Darin Kotter Date: Mon, 24 Oct 2022 08:43:11 -0600 Subject: [PATCH 2/8] Merge pull request #962 from 10up/fix/960-fast-follow-deprecated-hook-fix Pass arguments array to `apply_filters_deprecated()`. --- includes/utils.php | 32 +++++++++++++++++--------------- tests/php/UtilsTest.php | 28 +++++++++++++++++++++------- 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/includes/utils.php b/includes/utils.php index a88e7b8c8..7ba2e071f 100644 --- a/includes/utils.php +++ b/includes/utils.php @@ -398,21 +398,23 @@ function excluded_meta() { $excluded_meta = apply_filters_deprecated( 'dt_blacklisted_meta', [ - 'dt_unlinked', - 'dt_connection_map', - 'dt_subscription_update', - 'dt_subscriptions', - 'dt_subscription_signature', - 'dt_original_post_id', - 'dt_original_post_url', - 'dt_original_blog_id', - 'dt_syndicate_time', - '_wp_attached_file', - '_wp_attachment_metadata', - '_edit_lock', - '_edit_last', - '_wp_old_slug', - '_wp_old_date', + [ + 'dt_unlinked', + 'dt_connection_map', + 'dt_subscription_update', + 'dt_subscriptions', + 'dt_subscription_signature', + 'dt_original_post_id', + 'dt_original_post_url', + 'dt_original_blog_id', + 'dt_syndicate_time', + '_wp_attached_file', + '_wp_attachment_metadata', + '_edit_lock', + '_edit_last', + '_wp_old_slug', + '_wp_old_date', + ], ], 'X.X.X', 'dt_excluded_meta', diff --git a/tests/php/UtilsTest.php b/tests/php/UtilsTest.php index 02c15d3e3..77200d826 100644 --- a/tests/php/UtilsTest.php +++ b/tests/php/UtilsTest.php @@ -56,7 +56,9 @@ public function test_set_meta_simple() { \WP_Mock::userFunction( 'apply_filters_deprecated', [ - 'return_arg' => 1, + 'return' => function( $name, $args ) { + return $args[0]; + }, ] ); @@ -153,7 +155,9 @@ public function test_set_meta_multi() { \WP_Mock::userFunction( 'apply_filters_deprecated', [ - 'return_arg' => 1, + 'return' => function( $name, $args ) { + return $args[0]; + }, ] ); @@ -219,7 +223,9 @@ public function test_set_meta_serialize() { \WP_Mock::userFunction( 'apply_filters_deprecated', [ - 'return_arg' => 1, + 'return' => function( $name, $args ) { + return $args[0]; + }, ] ); @@ -541,7 +547,9 @@ public function test_format_media_not_featured() { \WP_Mock::userFunction( 'apply_filters_deprecated', [ - 'return_arg' => 1, + 'return' => function( $name, $args ) { + return $args[0]; + }, ] ); @@ -636,7 +644,9 @@ public function test_format_media_featured() { \WP_Mock::userFunction( 'apply_filters_deprecated', [ - 'return_arg' => 1, + 'return' => function( $name, $args ) { + return $args[0]; + }, ] ); @@ -731,7 +741,9 @@ public function test_format_media_no_attachment_meta() { \WP_Mock::userFunction( 'apply_filters_deprecated', [ - 'return_arg' => 1, + 'return' => function( $name, $args ) { + return $args[0]; + }, ] ); @@ -900,7 +912,9 @@ public function test_set_media() { \WP_Mock::userFunction( 'apply_filters_deprecated', [ - 'return_arg' => 1, + 'return' => function( $name, $args ) { + return $args[0]; + }, ] ); From 9d76aa8e9748d40f687ccef761a5f2ec7a5f5d1b Mon Sep 17 00:00:00 2001 From: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com> Date: Wed, 16 Nov 2022 08:23:32 +1100 Subject: [PATCH 3/8] Merge pull request #969 from 10up/fix/968-phpcs-action Fix PHP CS workflow. # Conflicts: # .github/workflows/lint.yml # composer.lock --- .github/workflows/lint.yml | 11 +++++--- composer.lock | 58 ++++++++++++++++++++++++-------------- 2 files changed, 44 insertions(+), 25 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 037f18a77..0e2393578 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -60,7 +60,7 @@ jobs: with: php-version: '7.4' coverage: none - tools: composer:v2 + tools: composer:v2, cs2pr - name: Install dependencies run: composer install --ignore-platform-reqs @@ -69,6 +69,9 @@ jobs: run: ./vendor/bin/phpcs -i - name: PHPCS check - uses: chekalsky/phpcs-action@v1 - with: - phpcs_bin_path: './vendor/bin/phpcs . --runtime-set testVersion 5.6-' + id: phpcs-sniffs + run: ./vendor/bin/phpcs . --runtime-set testVersion 5.6- --report-full --report-checkstyle=./.github/phpcs-report.xml + + - name: Show PHPCS results in PR + if: ${{ always() }} + run: cs2pr ./.github/phpcs-report.xml diff --git a/composer.lock b/composer.lock index 6c35d4bd4..6e7d1351d 100644 --- a/composer.lock +++ b/composer.lock @@ -74,20 +74,21 @@ "source": { "type": "git", "url": "https://github.com/10up/phpcs-composer.git", - "reference": "2f5c3608bc03fe1ca65acf462dd7b5008f6829a0" + "reference": "a3b05c0dafbb4a5df8b47f845074157c096e84a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/10up/phpcs-composer/zipball/2f5c3608bc03fe1ca65acf462dd7b5008f6829a0", - "reference": "2f5c3608bc03fe1ca65acf462dd7b5008f6829a0", + "url": "https://api.github.com/repos/10up/phpcs-composer/zipball/a3b05c0dafbb4a5df8b47f845074157c096e84a6", + "reference": "a3b05c0dafbb4a5df8b47f845074157c096e84a6", "shasum": "" }, "require": { "dealerdirect/phpcodesniffer-composer-installer": "*", "phpcompatibility/phpcompatibility-wp": "^2", - "squizlabs/php_codesniffer": "^3.4.0", + "squizlabs/php_codesniffer": "3.7.1", "wp-coding-standards/wpcs": "*" }, + "default-branch": true, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", "license": [ @@ -103,7 +104,7 @@ "issues": "https://github.com/10up/phpcs-composer/issues", "source": "https://github.com/10up/phpcs-composer/tree/master" }, - "time": "2021-01-08T03:03:06+00:00" + "time": "2022-11-03T18:34:24+00:00" }, { "name": "10up/wp_mock", @@ -720,16 +721,16 @@ }, { "name": "phpcompatibility/phpcompatibility-paragonie", - "version": "1.3.1", + "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", - "reference": "ddabec839cc003651f2ce695c938686d1086cf43" + "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/ddabec839cc003651f2ce695c938686d1086cf43", - "reference": "ddabec839cc003651f2ce695c938686d1086cf43", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", + "reference": "bba5a9dfec7fcfbd679cfaf611d86b4d3759da26", "shasum": "" }, "require": { @@ -766,22 +767,27 @@ "paragonie", "phpcs", "polyfill", - "standards" + "standards", + "static analysis" ], - "time": "2021-02-15T10:24:51+00:00" + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie/issues", + "source": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie" + }, + "time": "2022-10-25T01:46:02+00:00" }, { "name": "phpcompatibility/phpcompatibility-wp", - "version": "2.1.3", + "version": "2.1.4", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", - "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308" + "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/d55de55f88697b9cdb94bccf04f14eb3b11cf308", - "reference": "d55de55f88697b9cdb94bccf04f14eb3b11cf308", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", + "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", "shasum": "" }, "require": { @@ -816,9 +822,14 @@ "compatibility", "phpcs", "standards", + "static analysis", "wordpress" ], - "time": "2021-12-30T16:37:40+00:00" + "support": { + "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", + "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" + }, + "time": "2022-10-24T09:00:36+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -2145,16 +2156,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.0", + "version": "3.7.1", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "a2cd51b45bcaef9c1f2a4bda48f2dd2fa2b95563" + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/a2cd51b45bcaef9c1f2a4bda48f2dd2fa2b95563", - "reference": "a2cd51b45bcaef9c1f2a4bda48f2dd2fa2b95563", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", "shasum": "" }, "require": { @@ -2192,7 +2203,12 @@ "phpcs", "standards" ], - "time": "2022-06-13T06:31:38+00:00" + "support": { + "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", + "source": "https://github.com/squizlabs/PHP_CodeSniffer", + "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + }, + "time": "2022-06-18T07:21:10+00:00" }, { "name": "theseer/tokenizer", From 1e9fc8e925837c14adb89d342819585528e3df3b Mon Sep 17 00:00:00 2001 From: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com> Date: Wed, 16 Nov 2022 08:27:03 +1100 Subject: [PATCH 4/8] Merge pull request #967 from 10up/do/966-wordpress-61-support Tested up to WordPress 6.1. # Conflicts: # readme.txt --- README.md | 4 ++-- readme.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 267bda9c9..abb34c3b3 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ > Distributor is a WordPress plugin that makes it easy to distribute and reuse content across your websites — whether in a single multisite or across the web. -[![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Tests](https://github.com/10up/distributor/actions/workflows/test.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/test.yml) [![Linting](https://github.com/10up/distributor/actions/workflows/lint.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/lint.yml) [![Code scanning](https://github.com/10up/distributor/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/codeql-analysis.yml) [![Release Version](https://img.shields.io/github/release/10up/distributor.svg)](https://github.com/10up/distributor/releases/latest) ![WordPress tested up to version](https://img.shields.io/badge/WordPress-v6.0%20tested-success.svg) [![License](https://img.shields.io/github/license/10up/distributor.svg)](https://github.com/10up/distributor/blob/develop/LICENSE.md) +[![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Tests](https://github.com/10up/distributor/actions/workflows/test.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/test.yml) [![Linting](https://github.com/10up/distributor/actions/workflows/lint.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/lint.yml) [![Code scanning](https://github.com/10up/distributor/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/codeql-analysis.yml) [![Release Version](https://img.shields.io/github/release/10up/distributor.svg)](https://github.com/10up/distributor/releases/latest) ![WordPress tested up to version](https://img.shields.io/badge/WordPress-v6.1%20tested-success.svg) [![License](https://img.shields.io/github/license/10up/distributor.svg)](https://github.com/10up/distributor/blob/develop/LICENSE.md) *You can learn more about Distributor's features at [DistributorPlugin.com](https://distributorplugin.com) and documentation at the [Distributor documentation site](https://10up.github.io/distributor/).* @@ -74,7 +74,7 @@ To help inform our roadmap, keep adopters apprised of major updates and changes 1. Ensure that the current version of Distributor is active on BOTH sites being connected. We'll refer to these as mainsite.com and remotesite.com. 1. On mainsite.com, navigate to `Distributor` > `External Connections` and click `Add New`. 1. Enter a label for the connection (e.g., `remotesite`). -1. Enter the URL (e.g. `https://remotesite.com`) for your remote site below the External Site URL and press the `Authorize Connection` button. +1. Enter the URL (e.g. `https://remotesite.com`) for your remote site below the External Site URL and press the `Authorize Connection` button. 1. You will be prompted to enter the user name and password of an administrative role of the `remotesite.com` if you are not already logged into `remotesite.com` and then redirected to the Authorize Application screen. 1. At the Authorize Application screen, enter the name of the main site and press the 'Yes, I approve of this connection' button 1. Review the roles selected in `Roles Allowed to Push` are the ones you want to support, update if necessary, then press the `Update Connection` button. diff --git a/readme.txt b/readme.txt index ba78e8c96..ffbadb988 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: 10up Tags: content, distribution, syndication, management Requires at least: 4.7 -Tested up to: 6.0 +Tested up to: 6.1 Requires PHP: 5.6 Stable tag: 1.8.0 License: GPLv2 or later From ae884c0cde7f2244692781f7df8dcf2525353c81 Mon Sep 17 00:00:00 2001 From: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com> Date: Fri, 2 Dec 2022 10:24:35 +1100 Subject: [PATCH 5/8] Merge pull request #977 from 10up/fix/976-remember-classic-independently Prevent distribution of `classic-editor-remember` post meta. --- includes/utils.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/includes/utils.php b/includes/utils.php index 7ba2e071f..19c84b122 100644 --- a/includes/utils.php +++ b/includes/utils.php @@ -399,21 +399,22 @@ function excluded_meta() { 'dt_blacklisted_meta', [ [ + 'classic-editor-remember', 'dt_unlinked', - 'dt_connection_map', - 'dt_subscription_update', + 'dt_syndicate_time', 'dt_subscriptions', + 'dt_subscription_update', 'dt_subscription_signature', - 'dt_original_post_id', 'dt_original_post_url', + 'dt_original_post_id', 'dt_original_blog_id', - 'dt_syndicate_time', - '_wp_attached_file', + 'dt_connection_map', + '_wp_old_slug', + '_wp_old_date', '_wp_attachment_metadata', + '_wp_attached_file', '_edit_lock', '_edit_last', - '_wp_old_slug', - '_wp_old_date', ], ], 'X.X.X', From 3552b6ba0f707d74b6bf7c0037689f243622e2ed Mon Sep 17 00:00:00 2001 From: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com> Date: Mon, 5 Sep 2022 08:17:55 +1000 Subject: [PATCH 6/8] Merge pull request #936 from 10up/add/440-e2e-min-requirements Add E2E tests for Minumum Plugin Requirements # Conflicts: # .github/workflows/cypress.yml # tests/bin/set-core-version.js --- .github/workflows/cypress.yml | 18 +++++++++++++++--- .gitignore | 1 + tests/bin/set-core-version.js | 17 +++++++++-------- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index dee4b362b..c2625b9c7 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -12,14 +12,20 @@ on: - develop-v1 jobs: cypress: - name: ${{ matrix.core.name }} + name: ${{ matrix.core.name }} / ${{ matrix.php.name }} runs-on: ubuntu-latest strategy: matrix: + php: + - {name: 'PHP Default', version: null} core: - {name: 'WP latest', version: 'latest'} - - {name: 'WP minimum', version: 'WordPress/WordPress#5.2'} - {name: 'WP trunk', version: 'WordPress/WordPress#master'} + include: + - php: {name: 'PHP 8.1', version: '8.1'} + core: {name: 'WP stable', version: 'latest'} + - php: {name: 'PHP 7.4', version: '7.4' } + core: {name: 'WP minimum', version: 'WordPress/WordPress#5.2'} steps: - name: Checkout uses: actions/checkout@v3 @@ -37,11 +43,17 @@ jobs: run: composer install - name: Set the core version - run: ./tests/bin/set-core-version.js ${{ matrix.core.version }} + run: | + ./tests/bin/set-core-version.js ${{ matrix.core.version }} ${{ matrix.php.version }} - name: Set up WP environment run: npm run env:start + - name: Log WP environment versions + run: | + npx wp-env run cli "wp core version" + npx wp-env run cli "php --version" + - name: Convert to multisite run: npm run to-multisite diff --git a/.gitignore b/.gitignore index 2d91ef427..91238cb15 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ screenshots/ lang/ docs-built .phpunit.result.cache +/.wp-env.override.json diff --git a/tests/bin/set-core-version.js b/tests/bin/set-core-version.js index 2242d03e5..baddab88f 100755 --- a/tests/bin/set-core-version.js +++ b/tests/bin/set-core-version.js @@ -12,16 +12,17 @@ const args = process.argv.slice(2); if (args.length == 0) exit(0); if (args[0] == "latest") { - if (fs.existsSync(path)) { - fs.unlinkSync(path); - } - exit(0); + config.core = null; +} else { + let coreVersion = args[ 0 ]; + if ( ! coreVersion.match( /^WordPress\/WordPress\#/i ) ) { + coreVersion = 'WordPress/WordPress#' + coreVersion; + } + config.core = coreVersion; } -config.core = args[0]; - -if (!config.core.match(/^WordPress\/WordPress\#/)) { - config.core = "WordPress/WordPress#" + config.core; +if ( !! args[ 1 ] ) { + config.phpVersion = args[ 1 ]; } try { From a281d89d46bda7a65bc5e2728fc8fc9c6eee7078 Mon Sep 17 00:00:00 2001 From: Ravinder Kumar Date: Wed, 5 Oct 2022 11:14:19 +0530 Subject: [PATCH 7/8] Merge pull request #952 from 10up/fix/868 Show distributed author name when fetch author display name with get_the_author_meta --- .../classes/ExternalConnections/WordPressExternalConnection.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/classes/ExternalConnections/WordPressExternalConnection.php b/includes/classes/ExternalConnections/WordPressExternalConnection.php index 11f5dd8b8..e5a1dbf93 100644 --- a/includes/classes/ExternalConnections/WordPressExternalConnection.php +++ b/includes/classes/ExternalConnections/WordPressExternalConnection.php @@ -1008,6 +1008,7 @@ public static function canonicalize_front_end() { add_filter( 'wpseo_canonical', array( '\Distributor\ExternalConnections\WordPressExternalConnection', 'wpseo_canonical_url' ) ); add_filter( 'wpseo_opengraph_url', array( '\Distributor\ExternalConnections\WordPressExternalConnection', 'wpseo_og_url' ) ); add_filter( 'the_author', array( '\Distributor\ExternalConnections\WordPressExternalConnection', 'the_author_distributed' ) ); + add_filter( 'get_the_author_display_name', array( '\Distributor\ExternalConnections\WordPressExternalConnection', 'the_author_distributed' ) ); add_filter( 'author_link', array( '\Distributor\ExternalConnections\WordPressExternalConnection', 'author_posts_url_distributed' ), 10, 3 ); } From a17180c9db53b4d50f3939c934557494c90bae49 Mon Sep 17 00:00:00 2001 From: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com> Date: Wed, 14 Dec 2022 15:05:52 +1100 Subject: [PATCH 8/8] Merge pull request #984 from 10up/fix/888-author-display-override Show distributed author name via get_the_author_meta(). --- includes/classes/InternalConnections/NetworkSiteConnection.php | 1 + 1 file changed, 1 insertion(+) diff --git a/includes/classes/InternalConnections/NetworkSiteConnection.php b/includes/classes/InternalConnections/NetworkSiteConnection.php index 25484d8cf..354633888 100644 --- a/includes/classes/InternalConnections/NetworkSiteConnection.php +++ b/includes/classes/InternalConnections/NetworkSiteConnection.php @@ -932,6 +932,7 @@ public static function canonicalize_front_end() { add_filter( 'wpseo_canonical', array( '\Distributor\InternalConnections\NetworkSiteConnection', 'wpseo_canonical_url' ) ); add_filter( 'wpseo_opengraph_url', array( '\Distributor\InternalConnections\NetworkSiteConnection', 'wpseo_og_url' ) ); add_filter( 'the_author', array( '\Distributor\InternalConnections\NetworkSiteConnection', 'the_author_distributed' ) ); + add_filter( 'get_the_author_display_name', array( '\Distributor\InternalConnections\NetworkSiteConnection', 'the_author_distributed' ) ); add_filter( 'author_link', array( '\Distributor\InternalConnections\NetworkSiteConnection', 'author_posts_url_distributed' ), 10, 3 ); }