From 7e90dc7eb9260efccb4a3492efd8c17deb5b3f03 Mon Sep 17 00:00:00 2001 From: David Riccitelli Date: Tue, 19 Sep 2023 10:48:31 +0300 Subject: [PATCH] fix events sending IDs instad of URI; add compatibility with WPRM 8.10 --- src/install/class-wordlift-install-3-49-2.php | 24 +++++++++++++++++++ .../class-wordlift-install-service.php | 3 +++ .../Post_Entity/Events_Post_Entity_Jsonld.php | 2 +- .../Term_Entity/Events_Term_Entity_Jsonld.php | 2 +- .../food-kg/includes/Preconditions.php | 4 ++-- src/readme.txt | 5 ++++ src/wordlift.php | 2 +- 7 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 src/install/class-wordlift-install-3-49-2.php diff --git a/src/install/class-wordlift-install-3-49-2.php b/src/install/class-wordlift-install-3-49-2.php new file mode 100644 index 000000000..dd7837048 --- /dev/null +++ b/src/install/class-wordlift-install-3-49-2.php @@ -0,0 +1,24 @@ +query( "DELETE FROM $wpdb->termmeta WHERE meta_key = 'wl_mentions_count'" ); + $wpdb->query( "DELETE FROM $wpdb->termmeta WHERE meta_key = 'wl_about_count'" ); + $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key = 'wl_mentions_count'" ); + $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key = 'wl_about_count'" ); + + } + +} diff --git a/src/install/class-wordlift-install-service.php b/src/install/class-wordlift-install-service.php index a79e383b9..db1275474 100644 --- a/src/install/class-wordlift-install-service.php +++ b/src/install/class-wordlift-install-service.php @@ -80,6 +80,7 @@ public function __construct() { require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-44-4.php'; require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-45-0.php'; require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-45-1.php'; + require_once plugin_dir_path( __DIR__ ) . 'install/class-wordlift-install-3-49-2.php'; // Get the install services. $this->installs = array( @@ -127,6 +128,8 @@ public function __construct() { new Wordlift_Install_3_45_0(), new Wordlift_Install_3_45_1(), + + new Wordlift_Install_3_49_2(), ); self::$instance = $this; diff --git a/src/modules/events/includes/Post_Entity/Events_Post_Entity_Jsonld.php b/src/modules/events/includes/Post_Entity/Events_Post_Entity_Jsonld.php index 2200c449e..0a2b6f208 100644 --- a/src/modules/events/includes/Post_Entity/Events_Post_Entity_Jsonld.php +++ b/src/modules/events/includes/Post_Entity/Events_Post_Entity_Jsonld.php @@ -103,7 +103,7 @@ private function set_events_request( $jsonld_arr, $post_id ) { $change_status = $this->update_counts_if_necessary_post( $jsonld_arr, $counts, $post_id ); if ( $change_status ) { - $this->send_api_request_post( $counts, $post_id ); + $this->send_api_request_post( $counts, $permalink ); } return $jsonld_arr; diff --git a/src/modules/events/includes/Term_Entity/Events_Term_Entity_Jsonld.php b/src/modules/events/includes/Term_Entity/Events_Term_Entity_Jsonld.php index 57e32c260..1c0fa4b9c 100644 --- a/src/modules/events/includes/Term_Entity/Events_Term_Entity_Jsonld.php +++ b/src/modules/events/includes/Term_Entity/Events_Term_Entity_Jsonld.php @@ -61,7 +61,7 @@ public function set_events_request( $data, $term_id, $context ) { $change_status = $this->update_counts_if_necessary( $jsonld_arr, $counts, $term_id ); if ( $change_status ) { - $this->send_api_request( $counts, $term_id ); + $this->send_api_request( $counts, $term_url ); } return $data; diff --git a/src/modules/food-kg/includes/Preconditions.php b/src/modules/food-kg/includes/Preconditions.php index 3a970ed76..9e7a4dcea 100644 --- a/src/modules/food-kg/includes/Preconditions.php +++ b/src/modules/food-kg/includes/Preconditions.php @@ -26,13 +26,13 @@ private function has_prerequisites() { private function check_version() { $check = version_compare( WPRM_VERSION, '8.1.0', '>=' ) - && version_compare( WPRM_VERSION, '8.9.3', '<' ); + && version_compare( WPRM_VERSION, '8.11.0', '<' ); if ( ! $check ) { $this->notices->queue( 'warning', /* translators: 1: minimum supported WPRM version, 2: maximum supported WPRM version, 3: Detected WP Recipe Maker version. */ - sprintf( __( 'WordLift Food KG support requires WP Recipe Maker %1$s-%2$s, %3$s found.', 'wordlift' ), '8.1', '8.7', WPRM_VERSION ) + sprintf( __( 'WordLift Food KG support requires WP Recipe Maker %1$s-%2$s, %3$s found.', 'wordlift' ), '8.1', '8.10', WPRM_VERSION ) ); } diff --git a/src/readme.txt b/src/readme.txt index b11e97c40..5e88f4a17 100644 --- a/src/readme.txt +++ b/src/readme.txt @@ -143,6 +143,11 @@ You can open your datasets to the public, attaching to it a free or a commercial == Changelog == += 3.49.2 (2023-09-19) = + +* Events are sending IDs instead of URLs, squashed 💪 +* Added WPRM 8.10 compatibility. + = 3.49.1 (2023-08-16) = * Limit the increase of words in the structured data description property only to Products. diff --git a/src/wordlift.php b/src/wordlift.php index caabb6435..1954faca1 100644 --- a/src/wordlift.php +++ b/src/wordlift.php @@ -32,7 +32,7 @@ use Wordlift\Post\Post_Adapter; define( 'WORDLIFT_PLUGIN_FILE', __FILE__ ); -define( 'WORDLIFT_VERSION', '3.49.1' ); +define( 'WORDLIFT_VERSION', '3.49.2' ); // ## DO NOT REMOVE THIS LINE: WHITELABEL PLACEHOLDER ##