Skip to content

Commit

Permalink
Committing built version of bbf97f1
Browse files Browse the repository at this point in the history
  • Loading branch information
10upbot on GitHub committed Feb 29, 2024
1 parent 9accef3 commit f763bbc
Show file tree
Hide file tree
Showing 20 changed files with 104 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Reqest, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/repo-automator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 'Repo Automator'
on:
issues:
types:
- opened
push:
branches:
- develop
pull_request:
types:
- opened
- edited
- synchronize
- converted_to_draft
- ready_for_review
branches:
- develop

jobs:
Validate:
runs-on: ubuntu-latest
steps:
- uses: 10up/action-repo-automator@trunk
with:
fail-label: needs:feedback
pass-label: needs:code-review
conflict-label: needs:refresh
reviewers: |
dkotter
team:open-source-practice
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file, per [the Ke

## [Unreleased] - TBD

## [2.0.4] - 2024-02-29
### Added
- Repo Automator GitHub Action to automate repo operations (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul) via [#1191](https://github.com/10up/distributor/pull/1191)).

### Changed
- Address typos across the codebase (props [@szepeviktor](https://github.com/szepeviktor), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1184](https://github.com/10up/distributor/pull/1184)).

### Fixed
- Address an issue with data being cached incorrectly (props [@leogermani](https://github.com/leogermani), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1185](https://github.com/10up/distributor/pull/1185)).

## [2.0.3] - 2024-01-18
### Added
- New filter, `dt_post_to_pull`, that allows modifying the post to be pulled (props [@leogermani](https://github.com/leogermani), [@peterwilsoncc](https://github.com/peterwilsoncc), [@dkotter](https://github.com/dkotter) via [#1181](https://github.com/10up/distributor/pull/1181)).
Expand All @@ -25,7 +35,7 @@ All notable changes to this project will be documented in this file, per [the Ke
- Bump WordPress "tested up to" version 6.4 (props [@severine-pozzo](https://github.com/severine-pozzo), [@QAharshalkadu](https://github.com/QAharshalkadu), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter) via [#1151](https://github.com/10up/distributor/pull/1151)).

### Fixed
- Copy the htaccess file when initilizing the E2E test environment (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@theskinnyghost](https://github.com/theskinnyghost), [@dkotter](https://github.com/dkotter) via [#1143](https://github.com/10up/distributor/pull/1143)).
- Copy the htaccess file when initializing the E2E test environment (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@theskinnyghost](https://github.com/theskinnyghost), [@dkotter](https://github.com/dkotter) via [#1143](https://github.com/10up/distributor/pull/1143)).
- Prevent early publishing of scheduled posts when pulled internally (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@maxledoux](https://github.com/maxledoux), [@pcrumm](https://github.com/pcrumm) via [#1156](https://github.com/10up/distributor/pull/1156)).
- Avoid a PHP fatal error when pulling content that has previously been pulled into a different network site (props [@dkotter](https://github.com/dkotter), [@jeffpaul](https://github.com/jeffpaul), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1159](https://github.com/10up/distributor/pull/1159)).

Expand Down Expand Up @@ -515,6 +525,7 @@ This adds a post type selector when viewing the Pull Content list for both exter
- Initial closed release.

[Unreleased]: https://github.com/10up/distributor/compare/trunk...develop
[2.0.4]: https://github.com/10up/distributor/compare/2.0.3...2.0.4
[2.0.3]: https://github.com/10up/distributor/compare/2.0.2...2.0.3
[2.0.2]: https://github.com/10up/distributor/compare/2.0.1...2.0.2
[2.0.1]: https://github.com/10up/distributor/compare/2.0.0...2.0.1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ You can navigate to the `Posts` > `All Posts` table list view to see all content

## Known Caveats/Issues

__Remote Request Timeouts__ - With external connections, HTTP requests are sent back and forth - creating posts, transfering images, syncing post updates, etc. In certain situations, mostly commonly when distributing posts with a large number of images (or very large file sizes), using poorly configured or saturated servers / hosts, or using plugins that add significant weight to post creation, Distributor requests can fail. Although we do some error handling, there are certain cases in which post distribution can fail silently. If distribution requests are taking a long time to load and/or failing, consider adjusting the timeout; you can filter the timeout for pushing external posts using the [`dt_push_post_timeout` filter](https://10up.github.io/distributor/dt_push_post_timeout.html). More advanced handling of large content requests, and improved error handling is on the road map for a future update.
__Remote Request Timeouts__ - With external connections, HTTP requests are sent back and forth - creating posts, transferring images, syncing post updates, etc. In certain situations, mostly commonly when distributing posts with a large number of images (or very large file sizes), using poorly configured or saturated servers / hosts, or using plugins that add significant weight to post creation, Distributor requests can fail. Although we do some error handling, there are certain cases in which post distribution can fail silently. If distribution requests are taking a long time to load and/or failing, consider adjusting the timeout; you can filter the timeout for pushing external posts using the [`dt_push_post_timeout` filter](https://10up.github.io/distributor/dt_push_post_timeout.html). More advanced handling of large content requests, and improved error handling is on the road map for a future update.

__Post Meta Associations__ - A distributed post includes all of the post meta from the original version. Sometimes arbitrary post meta references an ID for another piece of content on the original site. Distributor _does not_ "bring along" the referenced content or update references for arbitrary post meta (it will take care of updating references in the case of core WordPress features, such as the featured image ID). This issue is very common when using field management plugins like Advanced Custom Fields (ACF). This can be addressed on a case by case basis by extending the plugin; for external connections, you can manually handle post meta associations using [the `dt_push_post` hook](https://github.com/10up/distributor/blob/f7b60740e679bce4671ccd69a670abadce4f2f93/includes/classes/ExternalConnections/WordPressExternalConnection.php#L646). For internal connections, use the [`dt_push_post` hook](https://10up.github.io/distributor/dt_push_post.html). Note that while named the same, these hooks accept different parameters.

Expand Down
4 changes: 2 additions & 2 deletions distributor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin URI: https://github.com/10up/distributor
* Update URI: https://distributorplugin.com
* Description: Makes it easy to distribute and reuse content across your websites, whether inside of a multisite or across the web.
* Version: 2.0.3
* Version: 2.0.4
* Requires at least: 5.7
* Requires PHP: 7.4
* Author: 10up Inc.
Expand All @@ -28,7 +28,7 @@
exit; // Exit if accessed directly.
}

define( 'DT_VERSION', '2.0.3' );
define( 'DT_VERSION', '2.0.4' );
define( 'DT_PLUGIN_FILE', preg_replace( '#^.*plugins/(.*)$#i', '$1', __FILE__ ) );
define( 'DT_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
define( 'DT_PLUGIN_FULL_FILE', __FILE__ );
Expand Down
2 changes: 1 addition & 1 deletion includes/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Bootstrap the main plugin.
*
* This file is included by the main plugin file and is responsible for
* bootstraping the plugin. This allows the main file to be used for version
* bootstrapping the plugin. This allows the main file to be used for version
* support and therefore support earlier versions of PHP and WP than the
* minimum requirements.
*
Expand Down
2 changes: 1 addition & 1 deletion includes/classes/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function format_post_args( $args, $context = array() ) {
* Store pre-sanizited auth credentials in DB
*
* @param int $external_connection_id External connection ID.
* @param array $args Array of creds to store. Should be pre-sanitized.
* @param array $args Array of credentials to store. Should be pre-sanitized.
* @since 0.8
*/
public static function store_credentials( $external_connection_id, $args ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class WordPressDotcomOauth2Authentication extends Authentication {
public static $requires_credentials = true;

/**
* Auth hanlder pretty label
* Auth handler pretty label
*
* @var string
*/
Expand Down
8 changes: 5 additions & 3 deletions includes/classes/DistributorPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,9 @@ protected function parse_media_blocks() {
$found = false;

// Note: changes to the cache key or group should be reflected in `includes/settings.php`
$media = wp_cache_get( 'dt_media::{$post_id}', 'dt::post', false, $found );
$cache_key = "dt_media::{$this->post->ID}";
$cache_group = 'dt::post';
$media = wp_cache_get( $cache_key, $cache_group, false, $found );

if ( ! $found ) {
// Parse blocks to determine attached media.
Expand All @@ -679,7 +681,7 @@ protected function parse_media_blocks() {
}

// Only the IDs are cached to keep the cache size down.
wp_cache_set( 'dt_media::{$post_id}', $media, 'dt::post' );
wp_cache_set( $cache_key, $media, $cache_group );
}

/*
Expand Down Expand Up @@ -919,7 +921,7 @@ protected function to_pull_list( $args = array() ) {
$display_data['distributor_original_site_url'] = $this->source_site['home_url'];

/**
* Filters the post data for when they are being formated for a pull
* Filters the post data for when they are being formatted for a pull
*
* @since 2.0.3
* @hook dt_post_to_pull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ public function check_connections() {


/**
* Whether if the post type is not distibutor internal post type.
* Whether if the post type is not distributor internal post type.
*
* @param string $post_type Post type
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ public static function update_syndicated( $post ) {

/**
* Maybe set post modified date
* On wp_insert_post, modified date is overriden by post date
* On wp_insert_post, modified date is overridden by post date
*
* https://core.trac.wordpress.org/browser/tags/4.7.2/src/wp-includes/post.php#L3151
*
Expand Down
28 changes: 24 additions & 4 deletions includes/debug-info.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ function add_debug_info( $info ) {
],
[
'label' => __( 'Internal Connections', 'distributor' ),
'value' => get_formatted_internal_connnections(),
'value' => get_formatted_internal_connections(),
],
[
'label' => __( 'External Connections', 'distributor' ),
'value' => get_formatted_external_connnections(),
'value' => get_formatted_external_connections(),
],
]
);
Expand All @@ -144,9 +144,19 @@ function add_debug_info( $info ) {
/**
* Get and format internal connections.
*
* @return array
* @deprecated x.x.x Use get_formatted_internal_connections
*/
function get_formatted_internal_connnections() {
_deprecated_function( __FUNCTION__, 'x.x.x.', __NAMESPACE__ . '\\get_formatted_internal_connections' );
return get_formatted_internal_connections();
}

/**
* Get and format internal connections.
*
* @return array
*/
function get_formatted_internal_connections() {
if ( empty( Connections::factory()->get_registered()['networkblog'] ) ) {
return __( 'N/A', 'distributor' );
}
Expand Down Expand Up @@ -176,9 +186,19 @@ function get_formatted_internal_connnections() {
/**
* Get and format external connections.
*
* @return array
* @deprecated x.x.x Use get_formatted_external_connections
*/
function get_formatted_external_connnections() {
_deprecated_function( __FUNCTION__, 'x.x.x', __NAMESPACE__ . '\\get_formatted_external_connections' );
return get_formatted_external_connections();
}

/**
* Get and format external connections.
*
* @return array
*/
function get_formatted_external_connections() {

$output = [];

Expand Down
6 changes: 3 additions & 3 deletions includes/external-connection-cpt.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,9 @@ function save_post( $post_id ) {
$connection_class = \Distributor\Connections::factory()->get_registered()[ sanitize_key( $_POST['dt_external_connection_type'] ) ];
$auth_handler_class_again = $connection_class::$auth_handler_class;

$auth_creds = $auth_handler_class_again::prepare_credentials( array_merge( (array) $current_auth, array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['dt_external_connection_auth'] ) ) ) );
$auth_credentials = $auth_handler_class_again::prepare_credentials( array_merge( (array) $current_auth, array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['dt_external_connection_auth'] ) ) ) );

$auth_handler_class_again::store_credentials( $post_id, $auth_creds );
$auth_handler_class_again::store_credentials( $post_id, $auth_credentials );
}
}

Expand Down Expand Up @@ -597,7 +597,7 @@ function dashboard() {
global $connection_list_table;

$_GET['post_type'] = 'dt_ext_connection';
$_REQUEST['all_posts'] = true; // Default to replacite "All" tab
$_REQUEST['all_posts'] = true; // Default to replicate "All" tab

$connection_list_table->prepare_items();
?>
Expand Down
2 changes: 1 addition & 1 deletion includes/push-ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ function get_connections() {
*/
function ajax_push() {
if ( ! check_ajax_referer( 'dt-push', 'nonce', false ) ) {
wp_send_json_error( new \WP_Error( 'invalid-referal', __( 'Invalid Ajax referer.', 'distributor' ) ) );
wp_send_json_error( new \WP_Error( 'invalid-referral', __( 'Invalid Ajax referer.', 'distributor' ) ) );
exit;
}

Expand Down
2 changes: 1 addition & 1 deletion includes/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ function setup_fields_sections() {
add_settings_field( 'media_handling', esc_html__( 'Media Handling', 'distributor' ), __NAMESPACE__ . '\media_handling_callback', 'distributor', 'dt-section-1' );

if ( false === DT_IS_NETWORK ) {
add_settings_field( 'registation_key', esc_html__( 'Registration Key', 'distributor' ), __NAMESPACE__ . '\license_key_callback', 'distributor', 'dt-section-1' );
add_settings_field( 'registration_key', esc_html__( 'Registration Key', 'distributor' ), __NAMESPACE__ . '\license_key_callback', 'distributor', 'dt-section-1' );
}
}

Expand Down
2 changes: 1 addition & 1 deletion includes/subscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function create_remote_subscription( ExternalConnection $connection, $remote_pos
* For a post that is distributed, for each distributed post, we create a subscription (CPT) to keep track
* of the copy. Attached to each subscription is a unique signature. When a post is updated, we check for subscriptions.
* If subscriptions exist, we grab the signature for each subscription and send the update to the remote copy along
* with the signature. The signature is a passcode of sorts. The subscription signature must match the copied post's
* with the signature. The signature is a pass code of sorts. The subscription signature must match the copied post's
* signature otherwise the update is not authorized.
*
* You might be wondering why we don't just use HTTP Basic Auth or OAuth since we've already set that up.
Expand Down
4 changes: 2 additions & 2 deletions includes/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ function distributor_get_the_connection_source( $post_id = null ) {
/**
* Display information about where a post was distributed from.
*
* @param int|null|mixed $post_id Post ID.
* @param string |null|mixed $preface The string that will preceed the link.
* @param int|null|mixed $post_id Post ID.
* @param string|null|mixed $preface The string that will precede the link.
*/
function distributor_the_connection_source( $post_id = null, $preface = null ) {
if ( ! $post_id ) {
Expand Down
10 changes: 5 additions & 5 deletions includes/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ function prepare_taxonomy_terms( $post_id, $args = array() ) {
function set_taxonomy_terms( $post_id, $taxonomy_terms ) {
// Now let's add the taxonomy/terms to syndicated post
foreach ( $taxonomy_terms as $taxonomy => $terms ) {
// Continue if taxonomy doesnt exist
// Continue if taxonomy doesn't exist
if ( ! taxonomy_exists( $taxonomy ) ) {
continue;
}
Expand Down Expand Up @@ -642,9 +642,9 @@ function set_taxonomy_terms( $post_id, $taxonomy_terms ) {
*
* @return {bool} Whether term hierarchy should be updated.
*/
$update_term_hierachy = apply_filters( 'dt_update_term_hierarchy', true, $taxonomy );
$update_term_hierarchy = apply_filters( 'dt_update_term_hierarchy', true, $taxonomy );

if ( ! empty( $update_term_hierachy ) ) {
if ( ! empty( $update_term_hierarchy ) ) {
foreach ( $terms as $term_array ) {
if ( ! is_array( $term_array ) ) {
$term_array = (array) $term_array;
Expand Down Expand Up @@ -940,8 +940,8 @@ function process_media( $url, $post_id, $args = [] ) {
$source_file = $args['source_file'];

if ( ! is_a( $wp_filesystem, 'WP_Filesystem_Base' ) ) {
$creds = request_filesystem_credentials( site_url() );
wp_filesystem( $creds );
$credentials = request_filesystem_credentials( site_url() );
wp_filesystem( $credentials );
}

// Copy the source file so we don't mess with the original file.
Expand Down
11 changes: 8 additions & 3 deletions lang/distributor.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,42 @@
# This file is distributed under the GPLv2 or later.
msgid ""
msgstr ""
"Project-Id-Version: Distributor 2.0.3\n"
"Project-Id-Version: Distributor 2.0.4\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/distributor\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2024-01-18T17:29:51+00:00\n"
"POT-Creation-Date: 2024-02-29T15:20:16+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.9.0\n"
"X-Generator: WP-CLI 2.10.0\n"
"X-Domain: distributor\n"

#. Plugin Name of the plugin
#: distributor.php
#: dist/js/gutenberg-plugin.min.js:4
#: release/dist/js/gutenberg-plugin.min.js:1
msgid "Distributor"
msgstr ""

#. Plugin URI of the plugin
#: distributor.php
msgid "https://github.com/10up/distributor"
msgstr ""

#. Description of the plugin
#: distributor.php
msgid "Makes it easy to distribute and reuse content across your websites, whether inside of a multisite or across the web."
msgstr ""

#. Author of the plugin
#: distributor.php
msgid "10up Inc."
msgstr ""

#. Author URI of the plugin
#: distributor.php
msgid "https://distributorplugin.com"
msgstr ""

Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: content, distribution, syndication, management
Requires at least: 5.7
Tested up to: 6.4
Requires PHP: 7.4
Stable tag: 2.0.3
Stable tag: 2.0.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down

0 comments on commit f763bbc

Please sign in to comment.