diff --git a/composer.json b/composer.json index f07253d6d..eb13c40aa 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "wordpress/wordpress": "^5.2", "wp-cli/wp-cli-bundle": "^2.2", "wp-coding-standards/wpcs": "^2.2", - "wpackagist-plugin/advanced-custom-fields": "*", + "wpackagist-plugin/advanced-custom-fields": "5.8.10", "wpsh/local": "^0.2.3", "xwp/wp-dev-lib": "^1.5" }, diff --git a/composer.lock b/composer.lock index 061740a07..0ef6360fb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7e61ba02f72f546bd72179a61c5e9217", + "content-hash": "80d79d264e80c53c2831d3e08b8da926", "packages": [ { "name": "composer/installers", @@ -213,16 +213,16 @@ }, { "name": "composer/composer", - "version": "1.10.7", + "version": "1.10.8", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "956608ea4f7de9e58c53dfb019d85ae62b193c39" + "reference": "56e0e094478f30935e9128552188355fa9712291" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/956608ea4f7de9e58c53dfb019d85ae62b193c39", - "reference": "956608ea4f7de9e58c53dfb019d85ae62b193c39", + "url": "https://api.github.com/repos/composer/composer/zipball/56e0e094478f30935e9128552188355fa9712291", + "reference": "56e0e094478f30935e9128552188355fa9712291", "shasum": "" }, "require": { @@ -241,12 +241,11 @@ "symfony/process": "^2.7 || ^3.0 || ^4.0 || ^5.0" }, "conflict": { - "symfony/console": "2.8.38", - "symfony/phpunit-bridge": "3.4.40" + "symfony/console": "2.8.38" }, "require-dev": { "phpspec/prophecy": "^1.10", - "symfony/phpunit-bridge": "^3.4" + "symfony/phpunit-bridge": "^4.2" }, "suggest": { "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", @@ -304,7 +303,7 @@ "type": "tidelift" } ], - "time": "2020-06-03T08:03:56+00:00" + "time": "2020-06-24T19:23:30+00:00" }, { "name": "composer/semver", @@ -5646,15 +5645,15 @@ }, { "name": "wpackagist-plugin/advanced-custom-fields", - "version": "5.8.12", + "version": "5.8.10", "source": { "type": "svn", "url": "https://plugins.svn.wordpress.org/advanced-custom-fields/", - "reference": "tags/5.8.12" + "reference": "tags/5.8.10" }, "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/plugin/advanced-custom-fields.5.8.12.zip" + "url": "https://downloads.wordpress.org/plugin/advanced-custom-fields.5.8.10.zip" }, "require": { "composer/installers": "~1.0" diff --git a/connectors/class-connector-acf.php b/connectors/class-connector-acf.php index 05e61497b..15ace08ff 100644 --- a/connectors/class-connector-acf.php +++ b/connectors/class-connector-acf.php @@ -196,38 +196,29 @@ public function callback_post_updated( $post_id, $posts_after, $posts_before ) { return; } - $_new = maybe_unserialize( $posts_after->post_content ); - $_old = maybe_unserialize( $posts_before->post_content ); + $_new = maybe_unserialize( $posts_after->post_content ) ?? array(); + $_old = maybe_unserialize( $posts_before->post_content ) ?? array(); // Get updated settings. - // Extract "location" property it will be compare separately. - $_new_location = acf_extract_var( $_new, 'location' ); - $_old_location = acf_extract_var( $_old, 'location' ); - - $updated = array_diff_assoc( $_new, $_old ); - - // Check if "location" changed. - if ( $_new_location !== $_old_location ) { - $updated['location'] = $_new_location; - $_old['location'] = $_old_location; - } + $updated_keys = $this->get_changed_keys( $_new, $_old ); + $updated_keys = empty( $updated_keys ) ? array_keys( $_new ) : $updated_keys; // Process updated properties. - if ( ! empty( $updated ) ) { - foreach ( $updated as $prop => $value ) { - $old_value = null; - if ( empty( $value ) && is_array( $_old ) && ! empty( $_old[ $prop ] ) ) { - $action = 'deleted'; - $old_value = $_old[ $prop ]; - } else { - $action = 'updated'; - } - - $this->log_prop( $action, $post_id, $posts_after, $prop, $value, $old_value ); + foreach ( $updated_keys as $prop ) { + $old_value = null; + $value = $_new[ $prop ]; + if ( empty( $value ) && is_array( $_old ) && ! empty( $_old[ $prop ] ) ) { + $action = 'deleted'; + $old_value = $_old[ $prop ]; + } else { + $action = 'updated'; } + + $this->log_prop( $action, $post_id, $posts_after, $prop, $value, $old_value ); } } + /** * Logs field/field group property changes (ACF v5 only). *